Page 1 of 1

Simple database query

Posted: Wed Jul 23, 2003 2:03 pm
by mikebr
I am making a simple database query, one that I have made many times before but it keeps throwing back the error text, this is the code:

Code: Select all

<?php
$sql="SELECT * FROM portfolio WHERE order=3";

$mysql_result=mysql_query($sql,$connection);

if (!mysql_query($sql,$connection)) {
			echo "Error!";
}

?>
OK, so if I use this following query then I don't get the error:

Code: Select all

<?php
$sql="SELECT * FROM portfolio";

$mysql_result=mysql_query($sql,$connection);

if (!mysql_query($sql,$connection)) {
			echo "Error!";
}

?>
Anyone any ideas where the problem could be? yes, there is a column called order in the portfolio table and it is an INT column.

Posted: Wed Jul 23, 2003 2:08 pm
by nielsene
order is a reserved word in most SQL DBMS's. I don't know if that's the case in MySQL or not.

Posted: Wed Jul 23, 2003 3:35 pm
by mikebr
Of course it is, the problem was smacking me in the face and I couldn't see it.

Thanks

Works fine now.