I barely know PHP and a friend came over today and helped me immensely. I feel bad asking for more help. So I am hoping you guys can help me. I made a nice looking page but every product on it is called productFI1. I need them to be incremented in the for loop so I can style them in css so each can have its own name. Here is the code I have. I know I probably have to create some variable to hold them, but I have no idea how.
$query = "Select * from products where featuredItem = 1;";
$retval = mysql_query($query, $conn);
$rowNum = mysql_num_rows($retval);
<span class="sectionTitle">Featured Items </span><br /><br />
<table width="802" >
for($i=0;$i < $rowcount;$i++) //down
for($j=0;$j < $colcount;$j++) //across
while ($row = mysql_fetch_array($retval, MYSQL_ASSOC))
echo("<div id='productFI1'> <img src='" . $row['itemImg'] . "'/></div>" .
"<div id='prodName'>" . $row['prodName'] . "</div>" .
"<div id='prodDesc'>" . $row['prodDesc'] . "</div>" .
"<div id='prodPrice'>" . $row['prodPrice'] . "</div>" .
"<div id='prodRate'>" . $row['prodRate'] ."</div>");
echo("<div id='productFI$j'> <img src='" . $row['itemImg'] . "'/></div>" .
Thank you for the speedy reply fellgall( btw, I follow you on twitter), but now I am getting this error after replacing your line of code with the code I had.
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/62/7956662/html/test/index1.php on line 48
line 48 is this line.
"<div id='prodName'>" . $row['prodName'] . "</div>"
Are you sure you just replaced the 1 with $j and didn't accidentally change anything else (such as removing the dot from the end of the line so that line 48 is no longer identified as validly continuing the same statement.