Jump to content

Coding help pls


jushiro

Recommended Posts

I have a sql statement w/c suppose to output only those records w/c has a name of seller.

But, it keeps showing all the records.

 

<?php
session_start();  
if(isset($_SESSION['name']) || ($_SESSION['contact']) || ($_SESSION['address']) ) {
ini_set('display_errors', 0);

$name =  $_SESSION['name'];
$contact = $_SESSION['contact'];
$address = $_SESSION['address'];

?>

<div id="apDiv1">
  <?php


echo "Name : $name";
echo "</br>";
echo "Name : $contact";
echo "</br>";
echo "Name : $address";

?>
<div id="apDiv2">
<?php
$host="localhost"; 
$username="root"; 
$password="";
$db_name="feedbackdb";


mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");


$sql="SELECT * FROM Feedbacks WHERE Seller = $name";
$result=mysql_query($sql);
echo "<table border=\"5\" width=\"600\" >";
echo "<tr><th>Feedbacks</th><th>From</th><th> To </th>";
    if(mysql_num_rows($result)) 
    { 
    while($row = mysql_fetch_assoc($result)) 
    { 
echo "<tr><td>";
    echo "" .$row['Feedback']."<br></td>";
echo "<td>".$row['From']."<br></td>";
echo "<td>".$row['Seller']."<br></td>";
echo "</tr>";
   } 

}
    else {		
    echo "<tr><td align=\"center\"> No Feedback</td></tr>";  
    } 	



?></div>


</div>


<?php 
}
else {
header("location:loginpage.php");;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/261525-coding-help-pls/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.