RE: [PHP-DB] problem with mysql_query
| From: | Rene Schoenmakers | Date: | Mon, 10 Jun 2002 11:15:16 +0000 |
| Subject: | RE: [PHP-DB] problem with mysql_query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19710@lists.php.net to get a copy of this message | ||
Hi,
I know what's causing the problem. In $newsText sometimes single quotes
are entered. There the error occurs. How can I escape these singel
quotes?
Regards,
Rene
-----Original Message-----
From: Markus Lervik [mailto:markus.lervik@vaasa.fi]
Sent: maandag 10 juni 2002 12:45
To: Rene Schoenmakers
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] problem with mysql_query
On Monday 10 Jun 2002 12:14 pm, Rene Schoenmakers wrote:
> Hi,
>
> I've a problem with the following script. Sometimes it does write the
> data into the database, sometimes it doesn't. When it doesn't $result
> is completely blank, otherwise it is 1. $sql always returns the
> propper values even though $result is blank. Can anybody tell me what
> I'm doing wrong?
> $result = mysql_query($sql);
Try changing this to (for example)
if(!$result = mysql_query($sql)) {
echo "MySQL error " . mysql_errno() . " - " . mysql_error();
die();
}
and see what you get. There's probably some problem with the database
connection.
Cheers,
Markus
--
Markus Lervik
Linux-administrator
Vaasa City Library - Regional Library, Finland markus.lervik@vaasa.fi
+358-6-325 3589/+358-40-832 6709
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php