Simple database query

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Simple database query

Post 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.
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post 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.
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post by mikebr »

Of course it is, the problem was smacking me in the face and I couldn't see it.

Thanks

Works fine now.
Post Reply