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

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

 



Richard Lynch wrote:



On Thu, May 12, 2005 12:17 am, Mark Sargent said:


Hi All,

ok, this revised code produces the error below,

<?php



You took out the mysql_connect completely???

Don't do that.



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());



$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








Hi All,

all is well.

1st Query

<?php
$db = mysql_connect("localhost", "root", "grunger");
mysql_select_db("status",$db);
$result = mysql_query("SELECT ProductTypes.product_type_detail, ProductTypes.product_type_id FROM ProductTypes",$db);
$num = mysql_num_rows($result);
?>
<select name="slct_product_type">
<?php
for ($i=0; $i<$num; $i++){
$myrow=mysql_fetch_array($result);
$product_type=mysql_result($result,$i,"product_type_detail");
$product_type_id=mysql_result($result,$i,"product_type_id");
echo "<option value=\"$product_type_id\">$product_type</option><br>";
}
?>
</select>


2nd Query

<?php
$maker_result = mysql_query("SELECT Makers.maker_id, Makers.maker_detail FROM Makers",$db);
if (!$maker_result) die(mysql_error());
?>
<select name="slct_maker">
<?php
$maker_num = mysql_num_rows($maker_result);
for ($i=0; $i<$maker_num; $i++){
$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>


Thanx for everyone's patience. 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