cybtec Posted February 8, 2010 Share Posted February 8, 2010 I am attempting to retrieve 3 product element from each record in a database and display them in a table 4 cells across, with each cell holding the 3 elements for each product. I know this needs to use a multidimensional array, I don't know what the correct syntax is for the array and I can't figure it out. Below is where I'm at with the code, any help figuring out what I need to do would be appreciated. ----------- $query = "SELECT productId,productCode,Name FROM inventory ORDER BY productID ASC"; $result = mysql_query($query) or die(mysql_error()); echo "<table>"; while($row(4,3) = mysql_fetch_row($result)) { echo "<tr><td>$row[0], $row[1], $row[2]</td><td>$row[3], $row[4], $row[5]<td></td><td>$row[6], $row[7], $row[8]</td><td>$row[9], $row[10], $row[11]</td></tr>\n"; } echo "</table>"; -------------- thanks Link to comment https://forums.phpfreaks.com/topic/191350-array-help/ Share on other sites More sharing options...
wildteen88 Posted February 8, 2010 Share Posted February 8, 2010 For multicolumn results read this FAQ. Link to comment https://forums.phpfreaks.com/topic/191350-array-help/#findComment-1008997 Share on other sites More sharing options...
cybtec Posted February 8, 2010 Author Share Posted February 8, 2010 Thank you that direction. With that info I was able to modify my script and get it to work. Thanks again, cybtec Link to comment https://forums.phpfreaks.com/topic/191350-array-help/#findComment-1009062 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.