I have 4 fields in my databse .... name, id, img and description.
They must be displayed on my website in blocks,
Something like: (i hope this makes sense)
NOW, I AM VERY BAD WITH PHP. I recently started using this great programming language but as you will see with my code below, it is pretty screwed up too say the least! I really hope you can help me to just sort out my styling and how to display the fields in the right places.
td td td
tr. PRODUCT NAME
tr. PRODUCT IMG product id: (ID)
tr. product description:
tr. DESCRIPTION DESCRIPTION
DESCRIPTION DESCRIPTION
My code currently displays all of the information in the same table, i want them each to have an individual table. Also, styling seems to be a factor here, because when i try to change a table background color nothing happens.
My code:
Code: Select all
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>\n";
echo "<tr background-color:\#9CAA48><td>Name</td></tr>\n";
echo "<tr><td>IMG PLACEHOLDER</td><td>Product ID:></td><td>PRODUCT ID PLACEHOLDER</td></tr>\n";
echo "<tr><td>DESCRIPTION:></td></tr>\n";
echo "<tr><td>DESCRIPTION PLACEHOLDER></td></tr>\n";
do {
printf("<tr><td>%s %s</td><td>%s</tr>\n", $myrow["name"], $myrow["img"], $myrow["id"], $myrow["description"]);
} while ($myrow = mysql_fetch_array($result));
echo "</table>\n";
} else {
echo "Sorry, no records were found!";
}