Everything worked fine when using a localhost (data insertion and data retrieval worked well) I hosted our website today to develop coding for email activation and so on.
This site is for a computer store, there's a price list of several components categorized neatly. After the site was hosted I get the error:
"Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a3270569/public_html/products.php on line 92"
I'm not sure why this happens.
Here's my code to retrieve data from one table:
<?php
$con = mysql_connect("hostname","username","pass"); //i changed these ;)
if (!$con){
die("Can not connect: ".mysql_error());
}
mysql_select_db("users",$con);
$sql = "SELECT * FROM intel";
$myData = mysql_query($sql,$con);
echo "<table id=test1 border=1 bgcolor=white>
<tr bgcolor=green>
<th>Processors</th>
<th>Price</th>
<th>Warranty</th>
</tr>";
while ($record = mysql_fetch_array($myData)){ //this is line 92 in my code
echo "<tr>";
echo "<td>" . $record['name'] . "</td>";
echo "<td>" . $record['price'] . "</td>";
echo "<td>" . $record['war'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>