shedokan Posted May 19, 2010 Share Posted May 19, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202272-mysqli-changes-the-last-column-in-the-query-to-the-tables-name/ Share on other sites More sharing options...
andrewgauger Posted May 19, 2010 Share Posted May 19, 2010 You don't want a semi colon in there. Only use semicolons in the actual mysql cli prompt. Quote Link to comment https://forums.phpfreaks.com/topic/202272-mysqli-changes-the-last-column-in-the-query-to-the-tables-name/#findComment-1060628 Share on other sites More sharing options...
shedokan Posted May 19, 2010 Author Share Posted May 19, 2010 I removed it, and it's the same problem. Quote Link to comment https://forums.phpfreaks.com/topic/202272-mysqli-changes-the-last-column-in-the-query-to-the-tables-name/#findComment-1060634 Share on other sites More sharing options...
PFMaBiSmAd Posted May 19, 2010 Share Posted May 19, 2010 It's more likely that you have an error in your actual code, because for a table like you show, the code you did post works correctly (just tested) and that's not your actual code. Quote Link to comment https://forums.phpfreaks.com/topic/202272-mysqli-changes-the-last-column-in-the-query-to-the-tables-name/#findComment-1060669 Share on other sites More sharing options...
Mchl Posted May 19, 2010 Share Posted May 19, 2010 Nothing wrong with this example. Show us actual query instead. Quote Link to comment https://forums.phpfreaks.com/topic/202272-mysqli-changes-the-last-column-in-the-query-to-the-tables-name/#findComment-1060670 Share on other sites More sharing options...
shedokan Posted May 19, 2010 Author Share Posted May 19, 2010 The actual query has a WHERE after it, but I tried removing the WHERE and it's still problematic: select entry,language,tokenmap from tokenize Quote Link to comment https://forums.phpfreaks.com/topic/202272-mysqli-changes-the-last-column-in-the-query-to-the-tables-name/#findComment-1060685 Share on other sites More sharing options...
PFMaBiSmAd Posted May 19, 2010 Share Posted May 19, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202272-mysqli-changes-the-last-column-in-the-query-to-the-tables-name/#findComment-1060699 Share on other sites More sharing options...
shedokan Posted May 19, 2010 Author Share Posted May 19, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202272-mysqli-changes-the-last-column-in-the-query-to-the-tables-name/#findComment-1060750 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.