willy ze great
JF-Expert Member
- Apr 30, 2013
- 1,066
- 1,293
database hairetrieve data za mtu anayetaka kuona vitu alivyonunua kutoka table ya manunuzi
lakini nikiedit hapo "where username='john'" inaretrieve data zote za john napata but now napata Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result
<?php
$host="localhost";
$user="root";
$password="";
$database="online";
$username=$_SESSION['username'];
$link= mysqli_connect($host, $user, $password,$database);
$query="select * from manunuzi where username=$username order by date desc";
$result= mysqli_query($link, $query);
echo "<table border='1' bgcolor='WHITE'>";
echo "<caption>YOUR BIDDING TABLE</caption>";
echo "<tr><th>PRODUCT</th><th>DATE</th>
<th>QUANTITY</th><th>PRICE</th><th>METHOD</th></tr>";
while ($row =mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$row['product']."</td>";
echo "<td>".$row['date']."</td>";
echo "<td>".$row['qty']."</td>";
echo "<td>".$row['price']."</td>";
echo "<td>".$row['method']."</td>";
echo "</tr>";
}
?>
lakini nikiedit hapo "where username='john'" inaretrieve data zote za john napata but now napata Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result
<?php
$host="localhost";
$user="root";
$password="";
$database="online";
$username=$_SESSION['username'];
$link= mysqli_connect($host, $user, $password,$database);
$query="select * from manunuzi where username=$username order by date desc";
$result= mysqli_query($link, $query);
echo "<table border='1' bgcolor='WHITE'>";
echo "<caption>YOUR BIDDING TABLE</caption>";
echo "<tr><th>PRODUCT</th><th>DATE</th>
<th>QUANTITY</th><th>PRICE</th><th>METHOD</th></tr>";
while ($row =mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$row['product']."</td>";
echo "<td>".$row['date']."</td>";
echo "<td>".$row['qty']."</td>";
echo "<td>".$row['price']."</td>";
echo "<td>".$row['method']."</td>";
echo "</tr>";
}
?>