Okay, I’m sure there is an easy way to do this but, since I’m so new to MySQL, I don’t know it off the bat. I’m pulling two item numbers to do comparisons with from the script prior to this page. I need to pull the info for the first item, write it out, then go back through, find the second item and pull its info and write it out. Things I’ve tried previously haven’t worked. The only way I have been able to figure out how to do it is to actually call the DB info twice, which just doesn’t seem the cleanest way to do it, considering I’m actually pulling 26 fields from the DB. Here is the only way I’ve found to get it to work, but what’s better?
[code=php]
<?php
$product1 = $_POST[‘product1’];
$product2 = $_POST[‘product2’];
require_once (“DB_info_file”);
$result = mysql_query(“SELECT all_of_my_db_ info ORDER BY item_number”);
$result2 = mysql_query(“SELECT all_of_my_db_info_AGAIN ORDER BY item_number”);
print “<table width=650><tr><td>n”;
while ($row = mysql_fetch_array($result, MYSQL_BOTH))
{
if ($row{‘item_number’}==$product1)
{
print “<table width=325 border=1>n”;
print “<tr><td>”.$row{‘all_of_my_db_info1}.”</td></tr>n”;
print “<td>”.$row{‘all_of_my_db_info2}.”</td></tr>n”; \through 26 of em
}
}
print “</td><td>n”;
while ($row2 = mysql_fetch_array($result2, MYSQL_BOTH))
{
if ($row2{‘item_number’}==$product2)
{
print “<table width=325 border=1>n”;
print “<tr><td>”.$row2{‘all_of_my_db_info_AGAIN1}.”</td></tr>n”;
print “<td>”.$row2{‘all_of_my_db_info_AGAIN2}.”</td></tr>n”; \through 26 of em
}
}
print “</td></tr></table>n”;
?>