It's not bizarre behaviour
$result = mysql_query(SELECT * FROM SOME_TABLE) || die (Unable to
execute
SQL query);
returns result of logical OR operation which is TRUE or 1
without || die(...) it returns valid MySQL resource
Regards
Sasha
Evan Morris [EMAIL PROTECTED] wrote in message
Possible error in SQL statement.
Are you sure that SOME_TABLE exists?
EM Hi all
EM I have successfully managed to connect to the mysql database, using the
EM following code:
EM mysql_connect('localhost','php','***') || die (Unable to connect to
EM MySQL server.);
EM $db =
Yo Evan,
Have you got an '@' in front of the mysql_query() to supress errors ?
Evan Morris wrote:
Hi all
I have successfully managed to connect to the mysql database, using the
following code:
mysql_connect('localhost','php','***') || die (Unable to connect to
MySQL server.);
$db =
- Original Message -
From: Max 'AMiGo' Gashkov [EMAIL PROTECTED]
To: Evan Morris [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, February 18, 2003 10:13 AM
Subject: Re: [PHP-DB] More help with mysql
Possible error in SQL statement.
Are you sure that SOME_TABLE exists?
Yes. I
Since I'm new to PHP, this concept is new to me. What does the @ do and
where do you put it?
- Original Message -
From: Corne' Cornelius [EMAIL PROTECTED]
To: Evan Morris [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, February 18, 2003 10:19 AM
Subject: Re: [PHP-DB] More help
Try listing of fields by name, not as '*', and put SOME_TABLE in qoutes (').
EM - Original Message -
EM From: Max 'AMiGo' Gashkov [EMAIL PROTECTED]
EM To: Evan Morris [EMAIL PROTECTED]
EM Cc: [EMAIL PROTECTED]
EM Sent: Tuesday, February 18, 2003 10:13 AM
EM Subject: Re: [PHP-DB] More help
If I remove the '|| die' part from the mysql_query() statement, it works
fine. This is bizarre, but there it is.
ie, if I have:
$result = mysql_query(SELECT * FROM SOME_TABLE);
it works.
If I have:
$result = mysql_query(SELECT * FROM SOME_TABLE) || die (Unable to execute
SQL query);
it
OK, now I see 8)
$result after your operations contains not SQL result, it's value is 1 (logical
TRUE) -- result of logical operation
mysql_query(SELECT * FROM SOME_TABLE) || die(
If you want to exit after error try this construction:
if(!mysql_query(SELECT * FROM SOME_TABLE))
{
]
Subject: Re[2]: [PHP-DB] More help with mysql -- solved (bizarre)
OK, now I see 8)
$result after your operations contains not SQL result, it's value is 1
(logical
TRUE) -- result of logical operation
mysql_query(SELECT * FROM SOME_TABLE) || die(
If you want to exit after error try
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 18 February 2003 08:26
If I remove the '|| die' part from the mysql_query()
statement, it works
fine. This is bizarre, but there it is.
ie, if I have:
$result = mysql_query(SELECT * FROM SOME_TABLE);
Hi all
I have successfully managed to connect to the mysql database, using the
following code:
mysql_connect('localhost','php','***') || die (Unable to connect to
MySQL server.);
$db = mysql_select_db(DB_NAME) || die (Unable to select requested
database.);
I then issue the following
11 matches
Mail list logo