Jump to content

[SOLVED] What do these errors mean?


monkeypaw201

Recommended Posts

I am getting these errors

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /public_html/human-resources/confirm.php on line 55

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /public_html/human-resources/confirm.php on line 58

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /public_html/human-resources/confirm.php on line 61

No recipient addresses found in header

 

when i run this code:

 

mysql_select_db("database", $connection);
$user = mysql_query("SELECT * FROM `users` WHERE `activation_key` = '" . $_POST['key'] . "' AND `email` = '" . $_POST['email'] . "'") or die(mysql_error());
$row_user = mysql_fetch_array($user);
$user_count = mysql_num_rows($user);

 

and im not sure what it means

Link to comment
https://forums.phpfreaks.com/topic/116994-solved-what-do-these-errors-mean/
Share on other sites

Ok, thanks, this is the code for the form ... i checked th variables.. but did i miss something?

 

<form name="form1" method="post" action="confirm.php">

  <table width="100%" border="0">

    <tr>

      <td>Activation Key:</td>

      <td><label>

        <input type="text" name="key" id="key" <?php if(isset($_GET['key'])){ echo "value=\"" . $_GET['key'] . "\" disabled"; } ?> />

      </label></td>

    </tr>

    <tr>

      <td>E-Mail Address:</td>

      <td><label>

        <input type="text" name="email" id="email" />

      </label></td>

    </tr>

    <tr>

      <td> </td>

      <td> </td>

    </tr>

    <tr>

      <td colspan="2"><label>

        <div align="center">

          <input type="submit" name="submit" id="button" value="Activate Account & Log-In">

          </div>

      </label></td>

    </tr>

  </table>

</form>

1) always use mysql_escape_string to avoid mysql injection.

2) you have already used mysql_error(), so it should some error before these warnings if query is failing.

3) echo your query to check if key and email are passed properly.

4) Try to check if there are any records returned before fetching them

 

mysql_select_db("database", $con);
$user = mysql_query("SELECT * FROM `users` WHERE `activation_key` = '" . $_POST['key'] . "' AND `email` = '" . $_POST['email'] . "'") or die(mysql_error());
$user_count = mysql_num_rows($user);
if($user_count>0) {
$row_user = mysql_fetch_array($user);
}

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.