3 messages in com.mysql.lists.mysqlRE: Include error (MySQL connect issu...| From | Sent On | Attachments |
|---|---|---|
| Woody Mon | 07 May 2003 11:47 | |
| Jennifer Goodie | 07 May 2003 14:03 | |
| Woody Mon | 07 May 2003 15:46 |
| Subject: | RE: Include error (MySQL connect issue via PHP)![]() |
|---|---|
| From: | Jennifer Goodie (goo...@apollointeractive.com) |
| Date: | 05/07/2003 02:03:16 PM |
| List: | com.mysql.lists.mysql |
This is a PHP issue, not a mySQL issue. You are getting a parse error because the @ is completely in the wrong place. I would suggest reading the PHP manual section on error suppression http://www.php.net/manual/sv/language.operators.errorcontrol.php Correct format would be <?php $db = @mysql_pconnect('localhost', 'user','password'); ?>
You are supressing errors returned from the function, so you place the operator up against the function call.
-----Original Message----- From: Woody Mon [mailto:medi...@yahoo.com] Sent: Wednesday, May 07, 2003 11:48 AM To: mys...@lists.mysql.com Subject: Include error (MySQL connect issue via PHP)
I'm having difficulties connecting to a mySQL database via a PHP web page when using a require or an include statement.
In my php file (e.g. example.php) I have an entry:
include('dbconnect.php');
And the full contents of dbconnect.php is as follows:
<?php @ $db = mysql_pconnect('localhost', 'user', 'password'); ?>
Then I receive the following errors on my web page when attempting to connect to the database:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/virtual/site20/fst/var/www/html/dbconnect.php on line 2
Parse error: parse error, unexpected T_STRING in /home/virtual/site20/fst/var/www/html/dbconnect.php on line 2 Error: Could not connect to database. Please try again later.




