Jump to content

PHP expect parameter


Aido89

Recommended Posts

Hi

 

I am getting the error below;

Warning: mysql_fetch_array() expects parameter 1 to be resource, object given in C:\xampp\htdocs\getuser.php on line 17

 

See below the code i am using, i also have an ajax file for this but that is working 100% the issue lies in the code below.

 

Any ideas?

<?php
$q=$_GET["q"];

$con = mysqli_connect('localhost','root','','db');
if (!$con)
  {
  die('Could not connect: ' . mysqli_error($con));
  }

mysqli_select_db($con,"db");
$sql="SELECT * FROM db WHERE id = '".$q."'";

$result = mysqli_query($con,$sql);



while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['item'] . "</td>";
  echo "<td>" . $row['description'] . "</td>";
  echo "<td>" . $row['price'] . "</td>";
  echo "<td>" . $row['category'] . "</td>";
  echo "<td>" . $row['paypal'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

mysqli_close($con);
?>
Link to comment
https://forums.phpfreaks.com/topic/280232-php-expect-parameter/
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.