Hey all,
I’m VERY new to PHP but I’ve managed to create a large part of my first program. I’m stuck on this one part which is preventing me from moving on.
I’m trying to populate a table with information from mysql. I’ve gotten the first column completed, but I can’t seem to get the 2nd column populated properly. There’s always repeating data from either column 1 or column 2.
Here’s my code…
[code=php]
if ($result)
{
while ($usa_carriers_row = mysql_fetch_array($usa_carriers_result)) {
while ($usa_prepaid_row = mysql_fetch_array($usa_prepaid_result)) {
echo “<tr><td>”;
echo $usa_carriers_row[0];
echo “</td><td>” ;
echo $usa_prepaid_row [0];
echo “</td></tr>” ;
}
}
}
echo “</table>”;
I’ve left out the html code for setting up the table columns etc. Does anyone know how to do this properly with loops? This is what it looks like right now.
COL #1 COL #2
Carrier#1 0.1
Carrier#1 0.5
What it should say is….
COL #1 COL #2
Carrier #1 0.1
Carrier #2 0.5
There’s about 6 columns that I need to use from my database. Any help is GREATLY appreciated!