Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7801539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:58:51+00:00 2026-06-02T00:58:51+00:00

p_info_query(‘SELECT * FROM ‘ + <table> + ‘ WHERE name = ‘ + user_name,

  • 0
p_info_query('SELECT * FROM ' + <table> + ' WHERE name = ' + user_name, password, client_connect.id, p_info, function(results) {

This seems to produce a Unknown Column ‘user_name’.
I searched online for some examples of people doing this, but I couldn’t find any. I want to query for specific things, maybe even comparing 2 values, user and password.

Any help?

// edited for p_info_query function

function p_info_query(sql, password, client_socket_id, player_info_object, callback) {
  var result =  mysql_client.query(sql, function (error, results, fields) {
    if (error) {
        console.log('ERROR IN MYSQL LOGIN CALLBACK : '+ error);
        return false;
    }
    if (results.length  > 0) {

    // do stuff


    callback(true);
    } else {

    callback(false);
    }
    }
}); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:58:53+00:00Added an answer on June 2, 2026 at 12:58 am

    Your problem is that you’re not quoting the user_name so you end up with SQL like this:

    select * from table where name = whatever
    

    where whatever is the value of user_name, an unquoted value like that is parsed as an identifier (essentially a column name in that context), hence your “unknown column” error.

    Presumably p_info_query is something of your own as it isn’t part of node-mysql. You should modify it to use placeholders so that it can do things like this internally:

    client.query(
        'select * from ' + table_name + ' where name = ?',
        [ user_name ],
        function(err, results, fields) { /* ... */ }
    );
    

    Note the ? in the SQL and the [user_name] array.


    Now that we know what p_info_query looks like, we can fix that too; you should update it look more like this:

    function p_info_query(sql, params, password, client_socket_id, player_info_object, callback) {
      var result =  mysql_client.query(sql, params, function (error, results, fields) {
        // ...
    

    Then you can say this:

    p_info_query(
      'SELECT * FROM ' + table_name + ' WHERE name = ?',
      [user_name],
      password,
      client_connect.id,
      p_info,
      function(results) { /* ... */ }
    );
    

    to use a placeholder.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to use this function $conn = db_connect(); while ($newsfeed = $conn->query(select info,
I have my php code like this: $products = mysql_query(SELECT p.* FROM products AS
I am trying to translate the following query into entity framework: SELECT Subjects.Name FROM
I have a date field in the database table of this format 2012-02-1.i need
I have the following in linq-to-entities clientprojects = (from p in this.SAPMappingEntities.SAP_Master_Projects join c
if (isset($_POST['login'])) { $query = mysql_query(" SELECT id FROM users WHERE username = '".mysql_real_escape_string($_POST['username'])."'
I have the following Entity: @Entity @Table @NamedQuery(name = Constants.FINDALLFINDERNAME, query = Constants.FINDALLQUERY) public
To whom it may respond to, We would like to use SELECT function with
<? require(config.php); $result = mysql_query(select s_title, p_name, date from tbl_slist_info where publish='u' ORDER By
i have this query: var model2 = (from p in context.ViewChatPeoples where ((IQueryable<int>)(from q

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.