Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there iv been having problems with mysqli so i have resorted back to mysql and im having problems with mysql_fetch_arrey ( $results ) i keep getting the error message

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a8834432/public_html/secure/index.php on line 11


and line 11 is

while($row = mysql_fetch_array( $result )) {



here is a copy of the full script
i am using the include dbc.php to connect to mysql and that all works fine

<?php
include 'dbc.php';   // As functions.php is not included
//$mysql = new mysql(HOST, USER, PASSWORD, DATABASE);
//mysqli_select_db($DATABASE)or die("cannot select DB");
$usr = $_POST['user'];
$pas = $_POST['pass'];

$sql = "SELECT * FROM `website` WHERE user = '$usr'";
$result = mysql_query($sql);

    while($row = mysql_fetch_array( $result )) {
		//
		}
if ($result->num_rows = 0 )
{
	echo("noreults");
	echo(header("..\secure.php?error=E2"));
}
?>
Posted

1 solution

all sorted now changed to mysqli
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900