PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Basically the idea is to show multiple results (if more than one exists) in a nicely formatted style. But this code shows one healthy result, then 5 "This record does not exist". Sorry if I sound noobish, I'm only 19.
So is there a better way of displaying multiple results?
If you only want a certain number of records then use the LIMIT clause in your query.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
GradyLorenzo wrote:It works, and it takes care of the "record does not exist." But I have two records with a 28379 zipcode, but it only shows one of them.
Sorry, I didn't look at your query. When you use an aggregate function like COUNT() or SUM() the way you have it will only return one row. Try this:
$query1 = mysql_query("SELECT * FROM `maildrop` WHERE `zipcode` = '" . mysql_real_escape_string($_POST['zipcode']) . "'") or die(mysql_error());
Also, be sure to use mysql_real_escape_string() on user submitted data.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.