Jump to content

MySqli changes the last column in the query to the table's name


shedokan

Recommended Posts

I have this code:

$sql = 'select column1,column2,column3 from table;';
$result=$mysqli->query($sql) or die($mysqli->error);
while($t = $result->fetch_assoc()){
  print_r($t);
}

 

And what I get is this:

Array

(

    [column1] => value of column1

    [column2] => value of column2

    [ table ] => value of column3

)

 

Why did mysqli change column3 to table? what am I doing wrong?

 

Thanks.

Link to comment
Share on other sites

It's more likely that you have an error in your actual code ...

 

If you seriously want someone in a forum to help find what is wrong, you need to be upfront and provide all the relevant information that you know about the problem. That includes the code that exhibits the problem, the expected results, and the actual results.

 

Don't play around with changing names or interpreting the output you are getting. Just post actual information and actual results.

Link to comment
Share on other sites

I'm not, you can clearly see from my first example that somehow colum3 got the table's name in the example and in the real query tokenmap got the name of the table which is: tokenize

 

I have given all of the code which I used to test this, and the result values are not important since it's the column name that has a problem not the values returned.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.