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

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

 



I don't understand what you're trying to do. Do you want two separate list boxes, one for product types and one for makers? If so, use two queries. Use the same block of code you have for product types to populate the makers box. If that's not what you're looking for, you need to describe what your goal is. You might also give more of your table structure since you're asking about joins.


kgt


Mark Sargent wrote:

Hi All,

with wanting to show both product types(Switch, Router etc) and Makers(Cisco, Avaya, etc) on the one page in select boxes, I was wondering, do you use 2 seperate queries to the database or do you inner join to get all in 1..? I have set up different tables with related id's etc. So, to get Products.product_name and Products.product_id along with what the below query pulls, what wold be best..? I believe if I do a 2nd query, than some variables need to be identified with the particular query, yes..? Cheers.

<html>
<body>
<hr>
<h1 align=center>JUMBO STATUS</h1><p>
<center>Used Hardware Specialist</center>
<hr>
<h2 align=center>Admin</h2>
<table align="center" border="2">
<tr>
<td><h3 align=center>PRODUCT TYPE</h3></td>
</tr>
<tr><td><center>
<select name="poduct_type">
<?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);
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>
</center>
</td></tr>
</table>
<p>
<p>
<p>
<hr><center>email: status1@xxxxxxxxxxxxx<p>
Telephone: 03-5209-1777<p>
Fax: 03-5209-2539
</center>
<hr>
</body>
</html>



-- 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