NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Mysql/PHP issues using WHERE

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-13-2007, 03:04 PM THREAD STARTER               #1 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse

Mysql/PHP issues using WHERE


I'm currently using the following code to select and get info from the database:

(I am using mysql 5 and php 5)

PHP Code:
$result mysql_query("SELECT * FROM order WHERE status='pending'") or die(mysql_error());  
while(
$row mysql_fetch_array$result )) {  

<
outputs the data here>


Now on the page it displays:

Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order WHERE status='pending'' at line 1
This is really weird because I have never had such issue before. I have another script using almost identical code and it's working fine.
????: NamePros.com http://www.namepros.com/programming/361370-mysql-php-issues-using-where.html

Any help is much appreciated
Camron is offline  
Old 08-13-2007, 03:07 PM   #2 (permalink)
NamePros Member
Join Date: Jun 2007
Posts: 52
cheerio is an unknown quantity at this point
 



Replace
PHP Code:
  $result mysql_query("SELECT * FROM order WHERE status='pending'") or die(mysql_error()); 
????: NamePros.com http://www.namepros.com/showthread.php?t=361370
with
PHP Code:
  $result mysql_query"SELECT * FROM `order` WHERE `status`='pending'" ) or die(mysql_error()); 
"order" is an SQL Keyword - "ORDER BY fieldname DESC/ASC"
cheerio is offline  
Old 08-13-2007, 03:11 PM THREAD STARTER               #3 (permalink)
Senior Member
 
Camron's Avatar
Join Date: Jan 2006
Location: Portland, Oregon
Posts: 2,102
Camron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud ofCamron has much to be proud of
 



VA Tech Memorial 9/11/01 :: Never Forget Cancer Survivorship Child Abuse
Thanks a bunch, rep added!
__________________
HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo
Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo!
Camron is offline  
Old 08-13-2007, 04:44 PM   #4 (permalink)
NamePros Regular
 
-PS-'s Avatar
Join Date: Jun 2006
Location: Sydney
Posts: 251
-PS- will become famous soon enough-PS- will become famous soon enough
 



Camron, it would be good pratice to put `` around your field names, the better you get at creating complex queries, the easier it be to make mistakes, or use "keywords" in your queries.

=)
-PS- is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 04:40 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger