Jump to content

Recommended Posts

 

Hi ALL,

 

When i run below code then i got and error as below:

mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/datalist_year.php on line 21

 

I am not getting y i got such an error. Any guidance and assist welcome.

 

Regards,

JIMI

-----------------------------------------------------------

<?PHP

 

$loginname = ''";

 

$password = "";

 

$database = "";

 

$con = mysql_connect("localhost", "$loginname", "$password") or die("could not connect");

mysql_select_db("$database");

 

$query = "SELECT candidate.first_name, candidate.last_name, candidate_foreign.value from candidate, candidate_foreign INNER JOIN candidate_foreign ON candidate.candidate_id = candidate_foreign.assoc_id WHERE candidate_foreign.field_name = 'IITYear' AND value >= '" .$_POST['from']. "' AND '".$_POST['to']."'";

 

$result = mysql_query ("$query");

 

echo "You are seaching between year '" .$_POST['from']. "' to '" .$_POST['to']. "'";

 

echo "<TABLE BORDER=1><TH>First Name</TH><TH>Last Name</TH><TH>Cell No</TH><TH>Email</TH>";

 

 

  while ($in = mysql_fetch_array($result))

      {

        echo "<TR>";

        echo "<TD>" . $in[first_name] . "</TD>";

        echo "<TD>" . $in[last_name] ."</TD>";

        echo "<TD>" . $in[value] ."</TD>";

        echo "</TR>";

      }

 

echo "</TABLE>";

 

mysql_close($con);

 

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.