php msaada kwa mara nyingine

willy ze great

JF-Expert Member
Apr 30, 2013
1,069
1,302
nimejitaidi wadau ila napata warning ila nia yangu ni idisplay jumla ya laptop zilizopo kwenye database yangu au mtu akitaka kununua saa aangalie jumla ya bidds za saa msaada
nimejaribu count function nimeshindwa any idea please, hapo nimejaribu idisplay table ya count

<?php
$host="localhost";
$user="root";
$password="";
$database="online";
$product="laptop";
$link= mysqli_connect($host, $user, $password,$database);
$query="select count(product)from registration where product='$product'";
echo "<table border='1' bgcolor='WHITE'>";
echo "<caption>HIGHEST RANK BIDDER'S TABLE</caption>";
echo "<tr><th>count</th></tr>";
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>".$row['product']."</td>";
echo "</tr>";

}


?>

@frankgalos kirakapacha
 
problem solved nimetumia hizi
<?php
$con=mysqli_connect("localhost","root","","online");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$sql="SELECT product,username FROM registration where product='laptop'";

if ($result=mysqli_query($con,$sql))
{
// Return the number of rows in result set
$rowcount=mysqli_num_rows($result);
printf("bids:%d .\n",$rowcount);
// Free result set
mysqli_free_result($result);
}

mysqli_close($con);
?>
 
Back
Top Bottom