Re: Inner Join or 2nd Query...?
| From: | Mark Sargent | Date: | Fri, 13 May 2005 03:14:53 +0000 |
| Subject: | Re: Inner Join or 2nd Query...? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215109@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
On Thu, May 12, 2005 12:17 am, Mark Sargent said:$db = mysql_connect("localhost", "root", "grunger"); Don't connect to the database twice. That's the most expensive (time-wise) thing in your whole script, probably.Hi All, ok, this revised code produces the error below, <?phpYou took out the mysql_connect completely??? Don't do that. Sorry, was following what you suggested b4, no..?
mysql_select_db("status",$db); $maker_result = mysql_query("SELECT Makers.maker_id Makers.maker_detail FROM Makers",$db);if (!$maker_result) die(mysql_error()); Ok, will add that
Mark Sargent.Cheers.$maker_num = mysql_num_rows($maker_result); //Line 40?> <select name="slct_maker"> <?php for ($i=0; $i<$maker_num; $i++){ $maker_myrow=mysql_fetch_array($maker_result); $maker=mysql_result($maker_result,$i,"maker_detail"); $maker_id=mysql_result($maker_result,$i,"maker_id"); echo "<option value=\"$maker_id\">$maker</option><br>"; } ?> </select> *Warning*: mysql_num_rows(): supplied argument is not a valid MySQL result resource in */var/www/html/products.php* on line *40 Cheers. Mark Sargent. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php