Web Hosting Talk







View Full Version : would this...


michael-lane
09-04-2005, 02:06 AM
would this below code output the data in no particular order if the order by collumn name didnt actually exsist (dont ask me why it wouldnt) was not set or would it return no results:

<?php
//connect to a database
include("db_info.php");
//perform query
$query = mysql_query("SELECT * FROM table ORDER BY fieldname");
//show results
while($row = mysql_fetch_row($query)) {
foreach($row as $field) {
echo "<b>$row</b><br>\n";
}
echo "---------";
}
echo "the above is a bunch of results from \"table\"";
?>

BillyConnite
09-04-2005, 11:08 AM
I dont quite know what u mean exactly, by "if the collumn name didnt actually exist or was not set"... If the column were not there, it should bring up an error afaik

michael-lane
09-04-2005, 11:19 AM
1 person said ordered by a non exsistant collumn it returns no rows another and another said it will return them with no order. and you say this, now im really confused, i would try it but my hosting is upgrading cpanel or something and its not gonna allow me to use it till like 7pm tonite.