SQL: Limit 1 usage?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently I have a script that contains this piece of code:


	$sql = "SELECT MIN(network) 
	AS 'network' FROM accessnums WHERE areacode='$_POST[areacode]' and city='$_POST[cityselected]'";


This works fine and accomplishes what I need.  Some requirements changed today and I now need to get more than just "network".  In MySQL command line I tried this:

	SELECT * FROM accessnums WHERE areacode="504" and city="New Orleans" ORDER BY network LIMIT 1;

This gives me the exact response I require.  However, when plugging it into my php code:

	$sql = "SELECT * FROM accessnums WHERE areacode=$_POST[areacode]' and city='$_POST[cityselected]' ORDER BY network LIMIT 1";

It can't execute the query.  Any suggestions?




Jason Wesley Upton - Web Design / Development - Application Development
=====================================================
Bayou Internet.........888.30.BAYOU............http://www.bayou.com
=====================================================
Tel: 318.338.2033  ICQ: 155895142  AIM: jasonwesleyupton  Fax: 318.323.5053




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux