Re: Re: catch the error

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

 



Shawn McKenzie wrote:
> Boyd, Todd M. wrote:
>  > Jesus Christ... everyone on this list must've had a long week, because
>   
>> you guys are going blind. :D
>>
>> In examples sent to you, people foolishly replaced your $db var with
>> $db_connect ONLY FOR PART OF THE SCRIPT. You've defined your database
>> connection as $db_connect in some versions of the source, but then you
>> reference $db (without _connect) in your mysql_select call in that same
>> source.
>>
>> $db = mysql_connect([option list here]); # <-- this code instantiates a
>> connection
>> mysql_select_db([some name], $db); # notice how $db is here?
>> $result = mysql_query([some query], $db); # it's here, too!
>>
>> $db becomes your resource link when you use mysql_connect. That resource
>> link must then be passed to your mysql functions. Otherwise, they have
>> no idea which database connection you are attempting to use.
>>
>> # BAD:
>> $db = mysql_connect([options]);
>> $result = mysql_query([some query], $db_connect); # what's $db_connect?
>> who knows!
>>
>> # GOOD:
>> $db = mysql_connect([options]);
>> $result = mysql_query([some query], $db); # same resource link from
>> mysql_connect
>>
>> See?
>>
>> HTH,
>>
>>
>> // Todd
>>     
>
> Yes, and I would also strongly urge (scream at) PJ, to turn on E_ALL
> error reporting in any script he has problems with.
>
> #1 you'll figure out the problem because the errors will tell you
> exactly what the problem is "undefined variable db_connect", etc...
>
> #2 if you can't figure it out, someone here can easily if you give the
> errors.
>
> Virtually every problem you've posted throws an error(s) that will tell
> you what the F*** is the problem!
>
>   
Ok, ok, I understant the frustrations....
But, yes, I think that some of the suggestions were rather hastily made
as most of the guys must be very busy and as we are all somewhat normal,
we do make mistakes. I mixed up some suggestions with other errors of
mine and so we had spaghetti. So, now let's kiss and make up... or as
the Italians would say, "Amici, come prima". :-)

I'm glad you mention the error reporting and I admit i haven't been
doing much of that. I do not understand how it should be set up or where
I should look for the errors.
I did try
ini_set("display_errors","true");
error_reporting(E_STRICT|E_ALL);
but it meant absolutely nothing. I could not find any logs for mysql or
php errors and none appeared magically in the page.
Perhaps you could steer me to an explanation somewhere. I was able to
save some grief for all as I dif manage to find some guidelines on the
mysql manual site that were pretty helpful.
Thanks for your tolerance of my ignorance - love you all!
PJ

-- 

Phil Jourdan --- pj@xxxxxxxxxxxxx
   http://www.ptahhotep.com
   http://www.chiccantine.com


-- 
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