I nid help with mysql request. I have something like that but it wont work. I nid to get 10 rows ordered by other columns. One by one with function:
function take($nr, $column){ if ($sql = mysql_query("SELECT $column FROM table ORDER BY that,other LIMIT 10 ")){ $row2=mysql_fetch_array($sql); return($row2[$nr]); } else{ $yks=mysql_error(); return($yks); } }
eelixduppy
2:52 am on Feb 13, 2008 (gmt 0)
What doesn't work. The ordering of the results? Are you getting errors? Please elaborate.
SoulMaster
3:44 pm on Feb 13, 2008 (gmt 0)
i get only $row2[0]..but all the others will be blank$row2[1] $row2[2] and so on
coopster
3:22 pm on Feb 16, 2008 (gmt 0)
You are misunderstanding how the result set looks when it is returned. Each index in your result set corresponds to a column in that row. Your rows must be traversed using a fetch of some sort within a looping construct if there are multiple rows to be returned. Have a look at some of the examples on the PHP manual page for the fetch type you are using. mysql_fetch_array [php.net]
SoulMaster
8:26 pm on Feb 16, 2008 (gmt 0)
already got it...had to do it without function...directly, n with loopin...just like u said:P