Jump to content

takisis

New Members
  • Posts

    4
  • Joined

  • Last visited

takisis's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am trying to display a slideshow using images and text from a database. Here is my php code to get images and text from database: <?php $dbhost = 'localhost'; $dbuser = 'takisis'; $dbpass = 'zifnab#666'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $query=mysql_query("SELECT * FROM vehicles"); echo 'ss = new slideshow("ss");'; while ($row=mysql_fetch_assoc($query)) { ?> s = new slide(); s.src = "<?php echo "<img src='data:image/jpeg;base64,".base64_encode($row['image'])."'?>"; s.text = "<?php echo "($row['year'] . $row['make'] . $row['model'] . $row['price'])"; ?>"; ss.add_slide(s); } ?> Please help
  2. I got my issues figured out. Thanks for all the help.
  3. Ok I now have the data displaying from the database. Thanks for the help. I need to get it to format so that one listing is right below the last in my table. Here is the new code so that you can see what is changed. I will also attach the file so that you can run it and give me suggestions. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Inventory</title> <style> table { font-family:Verdana, Geneva, sans-serif; font-size:12px; font-weight:bold; color:#FFF; } </style> </head> <body background="images/bg-image1.jpg"> <p align="center" style="font-family:Verdana, Geneva, sans-serif; color:#FFF; font-weight:bold"><font size="5">Vehicles for Sale</font><br /><font size="2">(All photos are file photos<br />Photos do not represent the actual vehicles)</font></p> <?php error_reporting(E_ALL); $dbhost = 'localhost'; $dbuser = 'takisis'; $dbpass = 'zifnab#666'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = "SELECT * FROM vehicles"; mysql_select_db('ezwayautos'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } echo "<table align='center' width='990' class='table'> <tr> <th>Picture</th> <th>Year</th> <th>Make</th> <th>Model</th> <th>Price</th> </tr>"; while($row = mysql_fetch_assoc($retval)) { echo "<tr>"; echo "<td>"; echo "<img src='data:image/jpeg;base64,".base64_encode($row['image'])."'>"; echo "</td>"; echo "<td>" .$row['year']. "</td>"; echo "<td>" .$row['make']. "</td>"; echo "<td>" .$row['model']. "</td>"; echo "<td>" .$row['price']. "</td>"; echo "</tr>"; echo "</table>"; } ?> </body> </html> inventory.php
  4. I have written a page to display vehicles for sale with a picture, year, make, model and price of vehicle. There is no syntax errors in the code and when I run the code It displays nothing. My code is listed below. Please help. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Inventory</title> <style> table { font-family:Verdana, Geneva, sans-serif; font-size:12px; font-weight:bold; color:#FFF; } </style> </head> <body background="images/bg-image1.jpg"> <p align="center" style="font-family:Verdana, Geneva, sans-serif; color:#FFF; font-weight:bold"><font size="5">Vehicles for Sale</font><br /><font size="2">(All photos are file photos<br />Photos do not represent actual vehicles)</font></p> <?php include_once('dbconnect.php'); $q = "SELECT * FROM vehicles"; $r = mysqli_query($q); echo "<table align='center' width='990' class='table'> <tr> <th>Picture</th> <th>Year</th> <th>Make</th> <th>Model</th> <th>Price</th> </tr>"; while($row = mysqli_fetch_array($r)){ echo "<tr>"; echo "<td width='203'>"; echo "<img src='data:image/jpeg;base64,".base64_encode($row['image'])."'>"; echo "</td>"; echo "<td>" .$row['year']. "</td>"; echo "<td>" .$row['make']. "</td>"; echo "<td>" .$row['model']. "</td>"; echo "<td>" .$row['price']. "</td>"; echo "</tr>"; echo "</table>"; } ?> </body> </html> Code from dbconnect.php: <?php mysqli_connect("localhost", "takisis", "zifnab#666") or die(mysqli_error()); mysqli_select_db("ezwayautos") or die(mysqli_error()); ?>
×
×
  • 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.