Jump to content

Recommended Posts

The code show like this

 

Pic text Pic text Pic text

 

I want it to look it like this

 

Pic Pic Pic

text text text

 

This is the coding

 

I have bold the echo coding

 

 

 

<?php

// Run a select query to get my letest 6 items

// Connect to the MySQL database

include "storescripts/connect_to_mysql.php";

$dynamicList = "";

$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 500");

$productCount = mysql_num_rows($sql); // count the output amount

if ($productCount > 0) {

while($row = mysql_fetch_array($sql)){

$id = $row["id"];

$product_name = $row["product_name"];

$price = $row["price"];

$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));

$dynamicList .='';

echo '<a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="77" height="102" border="1" /></a>' . $product_name . '';

 

 

}

} else {

$dynamicList = "We have no products listed in our store yet";

}

mysql_close();

?>

Link to comment
https://forums.phpfreaks.com/topic/270398-need-little-help/
Share on other sites

Give that a try. Move the </a> just before the close </div> if you want the text to be hyperlinked too

 

 

<?php

// Run a select query to get my letest 6 items

// Connect to the MySQL database

include "storescripts/connect_to_mysql.php";

$dynamicList = "";

$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 500");

$productCount = mysql_num_rows($sql); // count the output amount

if ($productCount > 0) {

while($row = mysql_fetch_array($sql)){

$id = $row["id"];

$product_name = $row["product_name"];

$price = $row["price"];

$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));

$dynamicList .='';

echo '<div style='float:left;'><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="77" height="102" border="1" /></a><br />' . $product_name . ''</div>";

}

} else {

$dynamicList = "We have no products listed in our store yet";

}

mysql_close();

?>

Link to comment
https://forums.phpfreaks.com/topic/270398-need-little-help/#findComment-1390797
Share on other sites

Give that a try. Move the </a> just before the close </div> if you want the text to be hyperlinked too

 

 

<?php

// Run a select query to get my letest 6 items

// Connect to the MySQL database

include "storescripts/connect_to_mysql.php";

$dynamicList = "";

$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 500");

$productCount = mysql_num_rows($sql); // count the output amount

if ($productCount > 0) {

while($row = mysql_fetch_array($sql)){

$id = $row["id"];

$product_name = $row["product_name"];

$price = $row["price"];

$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));

$dynamicList .='';

echo '<div style='float:left;'><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="77" height="102" border="1" /></a><br />' . $product_name . ''</div>";

}

} else {

$dynamicList = "We have no products listed in our store yet";

}

mysql_close();

?>

 

Great Man.....

 

Thanks alot :)

 

It work :)

 

Thanks thanks thanks alots................... :happy-04: :happy-04: :happy-04: :happy-04: :happy-04: :happy-04:

Link to comment
https://forums.phpfreaks.com/topic/270398-need-little-help/#findComment-1390814
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.