Jump to content

Recommended Posts

I have just changed a password in a database directly. When running the following code, I get error E1105.

 

   $sql = "SELECT K_Type FROM usersX WHERE UserKey = '$val' AND K_Type = $type";
 $query = mysql_query ($sql) or die ("E0105");
 $total = mysql_num_rows($query) or die ("E1105");
 if($total == 0)
                   $ret = 0;
                if($total > 1)
                  $ret = -1;
                if($total == 1)
                   $ret = K_Type;
                return $ret;

It is perfectly true that no rows are returned. If I copy the sql into mysql directly, no errors and no rows returned. Why Error E1105? it is not an error. This is only a password change. Database connection has not changed.

 

Desmond.

 

 

Link to comment
https://forums.phpfreaks.com/topic/196618-error-with-or-die/
Share on other sites

So, is this solved now?

 

The error you're receiving is a result of hard coding on this line:

 

$query = mysql_query ($sql) or die ("E0105");

 

You should not be using or die()'s to handle errors but, you could have changed that line to:

 

$query = mysql_query ($sql) or die (mysql_error());

 

for a more descriptive error message.

 

You should read this blog post http://www.phpfreaks.com/blog/or-die-must-die to learn more about properly handling errors and exceptions.

Link to comment
https://forums.phpfreaks.com/topic/196618-error-with-or-die/#findComment-1032330
Share on other sites

too many brackets

$query = mysql_query ($sql) or die (mysql_error());

 

I do not want the world to see my sql error so they can hack my website

$query = mysql_query ($sql) or die ("E0105");

is fine. It does not show the world the error.

My question is WHAT Error. WHY.

 

 

Link to comment
https://forums.phpfreaks.com/topic/196618-error-with-or-die/#findComment-1032372
Share on other sites

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.