Jump to content

PVM

Members
  • Posts

    4
  • Joined

  • Last visited

PVM's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Thank you man you saved me, best wishes !!!
  2. I am trying that for like an 40 mins... can someone please write me that part of code where $row['Slika'] is my src of <img> tag ?
  3. Ok man thanks, i have managed to solve this problem now i am dealing with some other stuff... I need to output image from database, this is what happends when i try that, i only get path to the image: http://i.imgur.com/A9Ew2Sf.png This is my output code: if ($result->num_rows > 0) { // output data of each row $output = ""; while ($row = mysqli_fetch_array($result)) { $output .= '<table style="width: 45%;margin: 2%;"border="1">'; $output.= '<tr>'; $output.= '<td style="color: crimson">'; $output .= "<b>Model:</b>" . $row['Model'] . "<br />"; $output.= '</td>'; $output.= '</tr>'; $output.= '<tr>'; $output.= '<td style="max-height: 120px;height: 100px;text-align: justify">'; $output .= "<b>Opis: </b>" . $row['Opis'] . "<br />"; $output.= '</td>'; $output.= '</tr>'; $output.= '<tr>'; $output.= '<td style="height: 120px;max-height: 120px">'; $output .= "<b>Picture:</b>" . $row['Slika'] . "<br />"; //Picture is here! $output.= '</td>'; $output.= '</tr>'; $output.= '<tr>'; $output.= '<td style="color: green">'; $output .= "<b>Cena:</b>" . $row['Cena'] . "<br />"; $output.= '</td>'; $output.= '</tr>'; $output .= '</table>'; } echo $output;
  4. First i would like to thank you for accepting me in this large community, I have learned a lot from this website, but now I have a problem that I am trying to solve for like a couple days so I think I really need your help guys My problem is displaying results from SQL database to one XHTML file, here's the code, strings in code are mostly writent on my native language, if that is a problem i will easly translate it ofcourse... This is my XHTML part: <div id="content"> <form action="ispis.php" method="POST" style="margin-top: 2%;float: left;margin:2%;padding:2%;height: 100%;border: solid thin"> <label>Choose products group:</label><br/><br/> <select name="pd"> <option value="komp">Racunari</option> <!-- Computers --> <option value="laps">Laptopovi</option> <!-- Laptops --> <option value="moni">Monitori</option> <!-- Monitors --> </optgroup> </select> <input type="button" name="sd" value="Go"/> </form> </div> This is the PHP part writen in "ispis.php" <?php include("admin/db_config.php"); $pd=$_POST["pd"]; if ($pd=="komp") { $sql = "SELECT * FROM racunari"; $result = $connection->query($sql); if ($result->num_rows > 0) { // output data of each row $output = ""; while ($row = mysqli_fetch_array($result)) { $output .= "<b>Model:</b>" . $row['Model'] . "<br />"; $output .= "<b>Opis:</b>" . $row['Opis'] . "<br />"; $output .= "<b>Slika:</b>" . $row['Slika'] . "<br />"; $output .= "<b>Cena:</b>" . $row['Cena'] . "<br />"; } echo $output; } else { echo "Nema rezultata"; } } elseif ($pd=="laps") { $sql = "SELECT * FROM laptopovi"; $result = $connection->query($sql); if ($result->num_rows > 0) { // output data of each row $output = ""; while ($row = mysqli_fetch_array($result)) { $output .= "<b>Model:</b>" . $row['Model'] . "<br />"; $output .= "<b>Opis:</b>" . $row['Opis'] . "<br />"; $output .= "<b>Slika:</b>" . $row['Slika'] . "<br />"; $output .= "<b>Cena:</b>" . $row['Cena'] . "<br />"; } echo $output; } else { echo "Nema rezultata"; } } else { $sql = "SELECT * FROM monitori"; $result = $connection->query($sql); if ($result->num_rows > 0) { // output data of each row $output = ""; while ($row = mysqli_fetch_array($result)) { $output .= "<b>Model:</b>" . $row['Model'] . "<br />"; $output .= "<b>Opis:</b>" . $row['Opis'] . "<br />"; $output .= "<b>Slika:</b>" . $row['Slika'] . "<br />"; $output .= "<b>Cena:</b>" . $row['Cena'] . "<br />"; } echo $output; } else { echo "Nema rezultata"; } } $connection->close(); ?> This is my XHTML file and i would like to see results from SQL databases on this page: http://www.upslike.net/imgdb/rezsss-d17d85.png
×
×
  • Create New...