PHP Classes

Small error in class

Recommend this page to a friend!

      Simple PHP MySQLi  >  All threads  >  Small error in class  >  (Un) Subscribe thread alerts  
Subject:Small error in class
Summary:Error is not included in function log_db_errors
Messages:4
Author:Miodrag Ninkovic
Date:2013-02-27 11:07:47
Update:2013-03-12 14:18:30
 

  1. Small error in class   Reply   Report abuse  
Picture of Miodrag Ninkovic Miodrag Ninkovic - 2013-02-27 11:07:47
In function log_db_errors there is $error variable, which is correctly filled with mysqli_connect_errno(), but not showed anywhere in $message!
Just add line: $message .= 'Error: '. $error .'<br />';

Small, probably typing error, take me almost 30min in testing this very nice class.
Regards

  2. Re: Small error in class   Reply   Report abuse  
Picture of Bennett Stone Bennett Stone - 2013-02-27 18:20:33 - In reply to message 1 from Miodrag Ninkovic
Great catch! I've made the adjustment and added the corrected file to the package.

  3. Small error in Few Functions   Reply   Report abuse  
Picture of neeraj gupta neeraj gupta - 2013-03-12 10:22:30 - In reply to message 2 from Bennett Stone
There are same error in the few functions:
get_results,query,num_rows,get_row

Issue:

Query is not getting printed in the mail when there is some error in the query.

Reason:

Sql query is passed to variable $query,

and then same variable is used for fetching the data.

$query = $this->link->query( $query);

If there is error ,then the resulted 'query' is getting overwrite and then

passed to function: log_db_errors ,

which in turns shows nothing.







  4. Re: Small error in class   Reply   Report abuse  
Picture of neeraj gupta neeraj gupta - 2013-03-12 14:18:30 - In reply to message 3 from neeraj gupta
There are more issues:

Your insert function cannot be used for inserting string values as you are not appending single quotes(') while creating the value string.

The insert function creating string like:

insert into abc (id,name) values (12,neeraj);

which will give error.


Thanks.