Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <?php
  2. $host="localhost";
  3. $username="carinfo_admin";
  4. $password="mypwrod";
  5. $database="carinfo_listings";
  6. $conn = mysql_connect($host,$username,$password) or die(mysql_error());;
  7.  
  8. $query  = "SELECT `id`, `firstname`, `item`, `price`, `city`, `desc`, `email`, `phone` FROM listings LIMIT 10";
  9. $listings = '';
  10. if($result = mysql_query($query)){
  11.     if(mysql_num_rows($result)){
  12.         while($row=mysql_fetch_assoc($result)){
  13.             $listings.="
  14.                         <div class=\"addText\"><a href=\"#\"><em><strong>{$row['item']} - Part #{$row['id']}</strong></em></a>
  15.                <p>{$row['desc']}</p>
  16.                <p><span>Contact:</span> <a href=\"mailto:email\">{$row['firstname']} - {$row['phone']}</a><br />
  17.                  <span>Part Type: </span>{$row['item']}</p>
  18.               </div>";//endlistings            
  19.         }//whileres
  20.     }//ifrows
  21. }//ifquery
  22. ?>
  23.  
  24. Then below I echo the listings variable:
  25. <?php echo $listings;?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement