I'm trying to set up a page that gets an array of different company information from my database. Each one is returned in an array $row.
I'm trying to put the information into an HTML table that has a table with one row and two columns. I want info for the first company to appear in the first column (this includes a 2x2 table that has name, info, pic, and link). The second column has the same thing, but for the following company.... and so on and so forth for as many arrays of co. info is fetched from the DB.
Here's my code:
Code: Select all
//HERE'S A ONE ROW TABLE W/ TWO COLUMNS
echo'<table width="750">
<tr>
<td>nbsp;</td>
<td>nbsp;</td>
<tr>
</table>';
$sql = "select * from content
where pageid = '$pageid'
order by contentid
";
$sqlresult = mysql_query ($sql, $db);
//I WANT THE FIRST RETURN OF $row TO GO IN THE FIRST COLUMN
//I WANT THE SECOND RETURN OF $row TO GO IN THE 2ND COLUMN
//THEN CREATE A NEW ROW IN THE HTML TABLE, AND DO IT ALL AGAIN
while ($row= mysql_fetch_array($sqlresult)){
//I'M CREATING A FOUR SQUARE TABLE FOR THE INFO TO APPEAR IN W/IN COLUMN 1
//THIS FOLLOWING LINE PRINTS OUT THE COMPANY NAME
echo '<tr>
<td>
$rowї3]
</td>';
//THIS SHOWS THE COMPANY TEXT
echo '<td>
$rowї5]
</td>
<td></td>
<td> </td><tr>
<td>';
//THIS ADDS IN THE COMPANY PICTURE
echo '<img src="../images/'.$rowї8].'.jpg">';
echo '</td></tr></table>';
}I think what would help me most would be if I new how to increment through returns of $row. For example, put first instance of $row in this table, then put the second instance of $row in the next.
Any help would be greatly appreciated. I've been stuck on this for a couple days now, and would love to figure it out.
Thanks