Knowledgebase

Portal Home > Knowledgebase > Articles Database > A bug in PHP?


A bug in PHP?




Posted by Phalanxer, 07-17-2012, 01:30 PM
In my SQL table, column number4 equals '18' and column set0 equals '1'$row['number4'] echo's fine, but $row['set0'] does not echo at all. Is this a bug in PHP?

Posted by alpha, 07-17-2012, 02:14 PM
What type of column is set0? Run this on the mysql database and post the output here: I'm going to assume it's an integer (and not a literal string/blog/varchar). In which case, try type casting the array element: If that doesn't work for whatever reason, try to run var_dump on $row to see what's going on there:

Posted by Matt R, 07-17-2012, 07:09 PM
Try using print_r($row); to see all of the output of row and make sure that the variable/array key is even set to begin with.

Posted by foobic, 07-17-2012, 09:19 PM
Not a chance. My first thought is to ask whether that column name is really set0 or setO (ie. is the last character a zero or a capital o), and did you use the same in your PHP code? Then if the column name is right you'll need to check the value being returned. The suggestions above should clarify it for you. This seems like a good example of why not to use "SELECT *" in your queries. If you had used "SELECT `number4`, `set0`" instead, and either of those columns didn't exist, it would throw an error.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
ResellerZoom vs Gazzin (Views: 597)
Moon-Hosting.com (Views: 568)


Language:

Contact us