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.

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.