I have a mysql table that looks like this:
id | uid | title | description | parent
1 | 1 | Portraits | desc. | photostream
2 | 1 | Abstract | descr. | photostream
and I am trying to build a multi-dimensional array that would end up looking like this:
Array
(
[0]
[id] => 1
[uid] => 1
[title] => Portraits
[description] => desc.
[parent] => photostream
[1]
[id] => 2
[uid] => 1
[title] => Abstract
[description] => descr.
[parent] => photostream
)
I am using the select query:
$query = mysql_query(
"SELECT * FROM `table` WHERE `uid`='1' ORDER BY `id` DESC");
Does anyone know how to do this? Thanks, Levi
uid
is a numeric column, do not compare or assign it to a string (single quoted value). MySQL won't complain but you might be surprised when the cast from string to number doesn't result in the number you expected. – Dan Grossman Feb 21 '11 at 0:06