Craig White wrote:
> On Wed, 2005-02-23 at 22:54 -0700, todd hewett wrote:
>
>> I am having some difficulties with a PHP script that talks to a
>> database.
>>
>>
>>
>> I think the issue is: an undeclared variable…. Or perhaps a PHP
>> Version issue.
>>
In web based scripts I always put "debugging" in new code. So if I wrote
something like:
$link = mysql_connect(servername, db_user_name, password);
if (!$link){ die ("Couldn't connect to the database server"); }
if (!mysql_connect_db(database_name)) { die ("Couldn't connect to the
database"); }
$sql = "select $var1, $var2, from databasename.table";
echo "$sql"; //Should show the query from above including variables that
are preset.
echo "$link"; //Should show the contents of the link
$result = mysql_query($sql, $link)
echo "$result"; //Unless you only have exactly one result, this will
display Array
Once it's all working I start commenting out the code, that way it's
there the next time I have to find a bug.
Patrick
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss