Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display all table row contents of my database in PHP?
    text
    copied!<p>I'm trying to do a shopping gallery. I managed to display my database table's first row content (content includes: image thumbnail of product, product name and product price). now i'm trying to display my table's second row content. how do i do this? when i try it, PHP still shows all of the first row's contents.</p> <p>HTML CODE: </p> <pre><code>&lt;div id="Dress1"&gt; &lt;a href="Prod1.php"&gt;&lt;img id="Image1" src="../imgs/thumb/&lt;?=$imgsml?&gt;"&gt;&lt;/a&gt; &lt;p id="ProductCodeText"&gt; &lt;?php echo $prd_name;?&gt;&lt;br/&gt;Price: &lt;?php echo $price; ?&gt; &amp;nbsp;Php&lt;/p&gt; &lt;/div&gt; &lt;div id="Dress2"&gt; &lt;a href="Prod2.php"&gt;&lt;img id="Image1" src="../imgs/thumb/&lt;?=$imgsml?&gt;"&gt;&lt;/a&gt; &lt;p id="ProductCodeText"&gt; &lt;?php echo $prd_name;?&gt;&lt;br/&gt;Price: &lt;?php echo $price; ?&gt; &amp;nbsp;Php&lt;/p&gt; &lt;/div&gt; </code></pre> <p>then Dress3 and 4</p> <p>PHP CODE:</p> <pre><code>&lt;?php include_once("../incs/dbcon.php"); if ($_SERVER['REQUEST_METHOD'] == "POST") { $prd_id = $_REQUEST["prd_id"]; $sub_id = $_REQUEST["sub_id"]; $prd_name = $_REQUEST["prd_name"]; $descr = $_REQUEST["descr"]; $price = $_REQUEST["price"]; $sizes = $_REQUEST["sizes"]; /*$imgsml = $_REQUEST["imgsml"]; $imgbig = $_REQUEST["imgbig"];*/ $featured = $_REQUEST["featured"]; $prd_status = $_REQUEST["prd_status"]; $colors = $_REQUEST["colors"]; $prd_code = $_REQUEST["prd_code"]; $date_release = $_REQUEST["date_release"]; $stk_status = $_REQUEST["stk_status"]; $ctr_id = $_REQUEST["ctr_id"]; $price_sale = $_REQUEST["price_sale"]; $onsale = $_REQUEST["onsale"]; $mostPopular = $_REQUEST["mostPopular"]; $mn = $_REQUEST["mn"]; $year = $_REQUEST["year"]; $imagewidth = $_REQUEST["imagewidth"]; $newArrival = $_REQUEST["newArrival"]; $cat_name = $_REQUEST["cat_name"]; $sub_name = $_REQUEST["sub_name"]; if (isset($_POST['prd_id'])) $prd_id = mysql_real_escape_string($_POST['prd_id']); if (isset($_POST['sub_id'])) $sub_id = mysql_real_escape_string($_POST['sub_id']); if (isset($_POST['prd_name'])) $prd_name = mysql_real_escape_string($_POST['prd_name']); if (isset($_POST['descr'])) $descr = mysql_real_escape_string($_POST['descr']); if (isset($_POST['price'])) $price = mysql_real_escape_string($_POST['price']); if (isset($_POST['sizes'])) $sizes = mysql_real_escape_string($_POST['sizes']); if (isset($_POST['imgsml'])) $imgsml = mysql_real_escape_string($_POST['imgsml']); if (isset($_POST['imgbig'])) $imgbig = mysql_real_escape_string($_POST['imgbig']); if (isset($_POST['featured'])) $featured = mysql_real_escape_string($_POST['featured']); if (isset($_POST['prd_status'])) $prd_status = mysql_real_escape_string($_POST['prd_status']); if (isset($_POST['colors'])) $colors = mysql_real_escape_string($_POST['colors']); if (isset($_POST['prd_code'])) $prd_code = mysql_real_escape_string($_POST['prd_code']); if (isset($_POST['date_release'])) $date_release = mysql_real_escape_string($_POST['date_release']); if (isset($_POST['stk_status'])) $stk_status = mysql_real_escape_string($_POST['stk_status']); if (isset($_POST['ctr_id'])) $ctr_id = mysql_real_escape_string($_POST['ctr_id']); if (isset($_POST['price_sale'])) $price_sale = mysql_real_escape_string($_POST['price_sale']); if (isset($_POST['onsale'])) $onsale = mysql_real_escape_string($_POST['onsale']); if (isset($_POST['mostPopular'])) $mostPopular = mysql_real_escape_string($_POST['mostPopular']); if (isset($_POST['mn'])) $mn = mysql_real_escape_string($_POST['mn']); if (isset($_POST['year'])) $year = mysql_real_escape_string($_POST['year']); if (isset($_POST['imagewidth'])) $imagewidth = mysql_real_escape_string($_POST['imagewidth']); if (isset($_POST['newArrival'])) $newArrival = mysql_real_escape_string($_POST['newArrival']); if (isset($_POST['cat_name'])) $cat_name = mysql_real_escape_string($_POST['cat_name']); if (isset($_POST['sub_name'])) $sub_name = mysql_real_escape_string($_POST['sub_name']); } $szQuery = "SELECT * FROM products"; $rs = mysql_query($szQuery) or die(mysql_error()."&lt;br&gt;$szQuery"); if ($row = mysql_fetch_object($rs)) { $prd_id = $row-&gt;prd_id; $sub_id = $row-&gt;sub_id; $prd_name = $row-&gt;prd_name; $descr = $row-&gt;descr; $price = $row-&gt;price; $sizes = $row-&gt;sizes; $imgsml = $row-&gt;imgsml; $imgbig = $row-&gt;imgbig; $featured = $row-&gt;featured; $prd_status = $row-&gt;prd_status; $colors = $row-&gt;colors; $prd_code = $row-&gt;prd_code; $date_release = $row-&gt;date_release; $stk_status = $row-&gt;stk_status; $ctr_id = $row-&gt;ctr_id; $price_sale = $row-&gt;price_sale; $onsale = $row-&gt;onsale; $mostPopular = $row-&gt;mostPopular; $mn = $row-&gt;mn; $year = $row-&gt;year; $imagewidth = $row-&gt;imagewidth; $newArrival = $row-&gt;newArrival; $cat_name = $row-&gt;cat_name; $sub_name = $row-&gt;sub_name; } ?&gt; </code></pre> <p>as much as possible i need someone who's willing to teach me step-by step and patiently. oh, and yes, i'm new at MySQL and PHP.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload