mikebyrne Posted April 10, 2008 Share Posted April 10, 2008 At present my products are listed one after the other with the code below. How can I make sure the next product starts on a new line?? The last vaible to be displayed for each product is Price <?php if (isset($_POST['searchme'])) { include("adminconnect.php"); $tbl_name = "product"; $cat = mysql_real_escape_string($_POST['cat']); $input =mysql_real_escape_string($_POST['searchfield']); $query = "SELECT * FROM product WHERE Producttype = '$cat' AND Productname LIKE '%$input%'"; $result = mysql_query($query) or die ("error in the query" . mysql_error()); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_array($result)) { echo "Title <a href=\"product.php?id=".$row['ProductNo']."\">".$row['ProductName']."\n<br> Price ".$row['Price'].""; } } else { echo "No search results found"; } } else { echo "No search terms entered."; } ?> Link to comment https://forums.phpfreaks.com/topic/100535-solved-products-in-list-to-start-on-new-line/ Share on other sites More sharing options...
p2grace Posted April 10, 2008 Share Posted April 10, 2008 You'd have to create a counter, and then based off that counter have it create specific divs (or tables) to create new rows. Link to comment https://forums.phpfreaks.com/topic/100535-solved-products-in-list-to-start-on-new-line/#findComment-514212 Share on other sites More sharing options...
Zhadus Posted April 10, 2008 Share Posted April 10, 2008 If I understand correctly, you could just add another <br> after the Price statement. Otherwise organize it all into a table and echo each bit of data into it's own row. Link to comment https://forums.phpfreaks.com/topic/100535-solved-products-in-list-to-start-on-new-line/#findComment-514216 Share on other sites More sharing options...
mikebyrne Posted April 10, 2008 Author Share Posted April 10, 2008 Thanks <br><br> sloved my problem Link to comment https://forums.phpfreaks.com/topic/100535-solved-products-in-list-to-start-on-new-line/#findComment-514220 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.