Jump to content

Warning: mysql_fetch_array(): supplied argument


ballhogjoni

Recommended Posts

Why do I get these errors:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/realfina/public_html/tests/cvlsofttest/testexcel.php on line 13

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/realfina/public_html/tests/cvlsofttest/testexcel.php on line 18

 

this is my code:

 

<?php

$username="xxxxx";
$password="xxxxx";
$database="xxxxx";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$sql = mysql_query("SELECT * FROM contactinfo");

$result=mysql_query($sql);
$result1 = mysql_fetch_array($result);

$sql1 = mysql_query("SELECT * FROM question2checkbox");

$result2=mysql_query($sql1);
$result3 = mysql_fetch_array($result2);

mysql_close();
?>

Should be:

<?php

$username="xxxxx";
$password="xxxxx";
$database="xxxxx";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$sql = mysql_query("SELECT * FROM contactinfo");

$result= mysql_fetch_array($sql);

$sql1 = mysql_query("SELECT * FROM question2checkbox");

$result2 =mysql_fetch_array ($sql1);

mysql_close();
?>

I only hda time for a quick check, but try this.

 

<?php

$username="xxxxx";
$password="xxxxx";
$database="xxxxx";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$sql = mysql_query("SELECT * FROM contactinfo");


$result1 = mysql_fetch_array($sql);

$sql1 = mysql_query("SELECT * FROM question2checkbox");


$result2 = mysql_fetch_array($sql1);

mysql_close();
?>

 

EDIT- AAh Beat me to it.

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.