RE: Inner Join or 2nd Query...?

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

 



I think you need to have the result from a mysql_connect() in order for that
to work..

As in:
$myResource = mysql_connect(user, pass, host, etc....);

You just have a statement handle there. Which is good for the fetch commands
like mysql_fetch_row(), but not the num rows command.



Carl Furst
carl@xxxxxxxx


-----Original Message-----
From: Mark Sargent [mailto:powderkeg@xxxxxxxxxxxxxxxx] 
Sent: Thursday, May 12, 2005 3:17 AM
To: php-general@xxxxxxxxxxxxx
Subject: Re:  Inner Join or 2nd Query...?

Hi All,

ok, this revised code produces the error below,

<?php
mysql_select_db("status",$db);
$maker_result = mysql_query("SELECT Makers.maker_id Makers.maker_detail 
FROM Makers",$db);
$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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux