Questions tagged [node-mysql]

A pure node.js JavaScript Client implementing the MySql protocol. This is about the node package `mysql`, not `node-mysql` which is much less popular.

699 questions
0
votes
1 answer

Same value keeps appearing in Javascript callback

I have the following bit of code in Node.js. function homeCallback(reply, twid) { var c = reply.length; for (var i = c - 1; i >= 0; i--) { var isRT; var tweet_id; if (reply[i].hasOwnProperty('retweeted_status')) { …
Jasjeev
  • 385
  • 1
  • 4
  • 17
0
votes
1 answer

Contents of SQL export not executing properly with felixge/node-mysql

I have created an export of a sql database (all tables and views) from MySQL Workbench. After removing the database drop/create lines, I am able to run the contents of the export file through the SQL engine to recreate the tables and views over and…
clayperez
  • 807
  • 1
  • 9
  • 18
0
votes
3 answers

How to query with node-mysql and write out the results?

I am trying to connect to a db on my hosting and write out the result, I am not getting any error, just blank space. line like console.log('test'); put at any place always work but I am not getting any query results, what am I doing wrong? var mysql…
yadayada
  • 3
  • 1
  • 5
0
votes
1 answer

executing an array of queries before a callback

What i want to do is loop through an object of sql queries, execute them one by one while retrieving results and then call the callback after everything is finished. Here is the code: _.each(fieldValSQL, function(sql, fieldKey) { …
Joseph Persico
  • 602
  • 7
  • 20
0
votes
1 answer

Mysql join overwriting submission id

I've got 2 tables. submissions and users. They are related by submissions.user_id = users.id. users: +----------------+------------------------+------+-----+-------------------+-----------------------------+ | Field | Type …
bob_cobb
  • 2,229
  • 11
  • 49
  • 109
0
votes
2 answers

Convert mysql query from latin1 to utf8 using nodejs

I have a database in latin1 and I want to convert its queries to utf-8. Example: response.write returns this JSON: {"questions":[{"question":"Nação","answer":"País"}]} But I need it converted to…
ampc
  • 312
  • 1
  • 6
  • 17
0
votes
2 answers

node.js error when connecting mysql database

I'm new to node and I'm having trouble connecting to my local database. I have installed node-mysql module and everything and added routes in my server.js like this: var posts = require('./routes/posts'); server.get('/posts/index',…
Nikola_1988
  • 1
  • 1
  • 2
0
votes
2 answers

node-mysql: error when using object.query

I'm learning nodejs and using 'mysql' module. With this function I want to verify if a name already exists in the database. I have the current error TypeError: Object # has no method 'query' I think it is related to "this.query" but…
ampc
  • 312
  • 1
  • 6
  • 17
0
votes
1 answer

how to get the final results in nodejs mysql mutli sql query

how i can get the final results gracefully except using asyncjs. current code is not graceful, any othe method ? thanks a lot. exports.index = function(req, res){ connection.query('select * from ued_task where taskState=0 and isQ=0 order by…
lolocoo
  • 35
  • 5
0
votes
1 answer

Not able to display image in the browser for a simple express code

I have my express code:: var express=require('express'); var fs=require('fs'); var http=require('http'); var crypto=require('crypto'); var mysql=require('mysql'); var async=require('async'); var app=express(); var…
Devrath
  • 42,072
  • 54
  • 195
  • 297
0
votes
1 answer

module always returns null no matter what

I am new to node.js and was wondering why my code always return null. I have db.js exports.getItems = function(){ var conn = mysql.createConnection(); conn.connect(); conn.query("Select * From Items", function(err, rows, fields) { if…
jmogera
  • 1,689
  • 3
  • 30
  • 65
0
votes
1 answer

Trouble updating rows in node-mysql

I've just started with node-mysql, and have created a database 'users'. I can select and create just fine, following instructions from the repository. The database currently has values [ { id: 1, user_login: 'mwilson' }, { id: 2, user_login:…
arilaan
  • 384
  • 2
  • 17
0
votes
1 answer

Storing Images in server using ExpressJS

I am new to programming and I am trying to store images which i recieve as POST request from my Client to my server Client:: Android Server:: ExpressJS running on AWS Database i am using :: MySQL In MySQL DATABASE I have created a Database in…
Devrath
  • 42,072
  • 54
  • 195
  • 297
0
votes
1 answer

How to perform Insert statement by decoding Base64 in express

How to decode the param values received which were received as Base64 encoded form and insert into database ? This is what i have tried. According to this i am getting one value recieved from the client as param value and inserting into server ( I…
Devrath
  • 42,072
  • 54
  • 195
  • 297
0
votes
1 answer

how to get value from sql in express?

I am stuck @ one of the problem in express node js. I am getting error "url not defined" app.get("/id", function(req, res) { var id = req.param("id"); connection.query('SELECT `url` FROM dynamic_url where id ='+req.param("id"), function …
user2834795
  • 4,333
  • 2
  • 15
  • 10