PDA

View Full Version : What am I missin?



Lacuna
April 21st, 2004, 11:50 AM
Hey All,

Im using php to send information to my .swf and my line :

$SQL = " SELECT * FROM course ORDER BY name ";

retrieves the info but doesnt sort by name... however.. when i add

$SQL = " SELECT * FROM course ORDER BY name limit 10";

then it sorts by name... what is goin on here ... lol :D

~ Seretha B. :love:

koorb
April 21st, 2004, 06:03 PM
try adding ASC or DESC after the field you want to order by (that is ASCending DESCending ;) )

Lacuna
April 21st, 2004, 07:07 PM
ok. well something is still messed cause i have

$SQL = "select * from course where city = 'copetown' order by name asc;";
$c = 1;
$t = 1;
$retid = mysql_db_query($db, $SQL, $cid);
if (!$retid) { echo( mysql_error()); }
$row = mysql_fetch_array($retid);
while ($row = mysql_fetch_array($retid)) {
$name = $row["name"];
$rating = $row["rating"];
$city = $row["city"];
$url = $row["url"];
$tel = $row["tel"];
$tolltel = $row["tolltel"];
$keyname = $row["keyname"];
$keyemail = $row["keyemail"];

print "&tab$t&loc$c=$name";
...blah blah blah

and it always skips the first entry and goes to the second....

Hans Kilian
April 22nd, 2004, 03:41 AM
You're fetching twice before you print anything.

in
$row = mysql_fetch_array($retid);
while ($row = mysql_fetch_array($retid)) {

delete the first statement.

Lacuna
April 22nd, 2004, 10:17 AM
im now in love with Hans Kilian. It's ALIVE. Thank you very much!!

~ Sertha B. :love:

Hans Kilian
April 22nd, 2004, 10:21 AM
Always happy to help the laydees :)

koorb
April 22nd, 2004, 10:37 AM
im now in love with Hans Kilian. It's ALIVE. Thank you very much!!

~ Sertha B. :love: I would have got there in the end :upset::+):P