Friday 15 July 2011

php - My drop down div isn't visible -


I am working on an online shopping website.
This is a div that will display items and the image should also be used from the database.

Help me!

This is the code by which I am trying to get data from the mysql database created on phpmyadmin and I am creating this div.

The problem is that I can not see any output

  & lt; Include php "connect_database.php"; $ Sql ​​= "Select from product"; $ Result = mysqli_query ($ connection, $ sql); $ Rows = mysqli_fetch_assoc ($ result); While ($ rows = mysqli_fetch_assoc ($ result)) {echo "div class = 'item' & gt; & lt; img class = 'image' src = '". $ Rows ["image"]. ' & Gt; & Lt; Br / & gt; & Lt; Span & gt; "$ Rows [" product_name "]". & Lt; / Span & gt; & Lt; Hr / & gt; & Lt; Span & gt; $ Rows ["model_no"]. "& Lt; / span & gt; & lt; hour />  Rs" $ lines ["amount"]. "& Lt; / span & gt; & lt; / div & Gt; "; }? & Gt;    

You call mysqli_fetch_assoc before the first loop. That call reads the first row, but the result is not used. After that, while kicks in the loop and outputs processes and other rows, if you have only one line, then you will not be able to see anything.

So you can try it, it has been removed from that line.

Note that I $ rows to $ line . This is not required, but since the variable only includes data for one line, I think this name is better, it will help you understand better code if you need to change it later.

  & lt ;? Include php "connect_database.php"; $ Sql ​​= "Select from product"; $ Result = mysqli_query ($ connection, $ sql); While ($ line = mysqli_fetch_assoc ($ result)) {resonant "and 

No comments:

Post a Comment