Better use mysqli rather mysql. It supports all new features of MySQL.
I solved the problem in following manner.
1. Detect the return value of mysqli->query function.
2. If it is FALSE get the error no, error msg etc and store in a Mysql table
for further review. You can also write it in a error
Tim Legg wrote:
> Hello,
>
> I just spent way, way to much time trying to debug code due to a misnamed
> element. Here is a simplified example of the problem I dealt with.
>
>
> $test = "SELECT * FROM `Materials` WHERE `Part_Number` = '125664'";
> $result = mysql_query($test,$handl
Bob McConnell wrote:
> From: Tommy Pham
>>> From: Tim Legg
>>>
>>> I just spent way, way to much time trying to debug code due to a
> misnamed
>>> element. Here is a simplified example of the problem I dealt with.
>>>
>>>
>>> $test = "SELECT * FROM `Materials` WHERE `Part_Number` =
> '125664'
>> I think the problem is that he didn't check that the key he used
>> actually existed before using the value it pointed to. So he got an
>> empty string for $row['Number']; because the key should have been
>> 'Part_Number'. I don't know that even E_STRICT would catch that one.
>>
>> Bob McConnell
- Original Message
> From: Bob McConnell
> To: Tommy Pham ; php-general@lists.php.net
> Sent: Wednesday, September 23, 2009 11:37:00 AM
> Subject: RE: [PHP] Stricter Error Checking?
>
> From: Tommy Pham
> >> From: Tim Legg
> >>
> >> I jus
From: Tommy Pham
>> From: Tim Legg
>>
>> I just spent way, way to much time trying to debug code due to a
misnamed
>> element. Here is a simplified example of the problem I dealt with.
>>
>>
>> $test = "SELECT * FROM `Materials` WHERE `Part_Number` =
'125664'";
>> $result = mysql_query
I think he meant that he is using 'Number' instead of 'Part_Number'
when accessing the array and not in the SQL, his SQL was correct, this
was wrong:
> echo $row['Number'];
E_STRICT catches that kind of error.
Jonathan
On Wed, Sep 23, 2009 at 3:28 PM, Tommy Pham wrote:
>
>
> - Original
- Original Message
> From: Tim Legg
> To: php-general@lists.php.net
> Sent: Wednesday, September 23, 2009 11:11:46 AM
> Subject: [PHP] Stricter Error Checking?
>
> Hello,
>
> I just spent way, way to much time trying to debug code due to a misnamed
> element. Here is a simplified ex
Hi,
There is, see here (or it can also be set through php.ini):
http://www.php.net/manual/en/function.error-reporting.php
You are looking for E_STRICT.
Regards,
Jonathan
On Wed, Sep 23, 2009 at 3:11 PM, Tim Legg wrote:
> Hello,
>
> I just spent way, way to much time trying to debug code due
9 matches
Mail list logo