Jump to content

Need Little Help.......


arunpatal

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

  On 11/7/2012 at 12:21 PM, winningdave said:

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.