Re: Stricter Error Checking?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <tommyhp2@xxxxxxxxx> wrote:
>
>
> ----- Original Message ----
>> From: Tim Legg <kc0ofc@xxxxxxxxx>
>> To: php-general@xxxxxxxxxxxxx
>> Sent: Wednesday, September 23, 2009 11:11:46 AM
>> Subject:  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 example of the problem I dealt with.
>>
>>
>>     $test = "SELECT * FROM `Materials` WHERE `Part_Number` = '125664'";
>>     $result = mysql_query($test,$handle);
>>     if(!$result)
>>     {
>>         die('Error: ' . mysql_error());
>>     }
>>     $row = mysql_fetch_array($result);
>>     echo $row['Number'];
>>
>> After retyping the code 3 or 4 times over the course of the morning, I finally
>> found where the problem was.  The problem is that the database field is called
>> 'Part_Number', not 'Number'.  The field 'Number' does not exist in the
>> database.  I am very surprised that I didn't even get a warning that there might
>> be a problem with the statement.  All I saw is that nothing was being returned
>> via the echo command.
>
> if(!$result)
> {
>        die('Error: ' . mysql_error());
> }
>
> This didn't work when you used 'Number' instead of 'Part_Number'? Strange...
>
>>
>> There really must be a stricter error checking that is turned on somewhere,
>> isn't there?
>>
>>
>> Thanks for your help.
>>
>> Tim
>>
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux