Re: Newbie to php
| From: | Chris Hogben | Date: | Fri, 12 Apr 2002 11:56:42 +0000 |
| Subject: | Re: Newbie to php | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13050@lists.php.net to get a copy of this message | ||
Sorry if i'm posting twice, but i used my nospam address, and i know this
server is pickky on addresses :P
Hi there,
You could always try using mysql_error() to get a better error description.
Try this:
<?php
$db = mysql_connect("nik", "", "");
if (!$db) {
echo "Cannot connect";
exit;
}
$selectdb = mysql_select_db("guestbook");
if (!$selectdb) {
$error = mysql_error();
echo "MySQL Error: $error";
}
?>
Hope this helps
Chris Hogben
"Nik Alleyne" <nik@guyanachronicle.com> wrote in message
news:20020409023120.74296.qmail@pb1.pair.com...
> Good evening everyone,
> I am new (very new) to php. I was doing some research on the net and learn
> of this packaged and after reading just a couple of pages, i figure i
should
> learn this instead of ASP. It looks so easy. Anyhow here is my problem.
>
> I am trying to connect to the database (MySQL) however, I can't I am
> connecting to the server, but I cannot connect to my sample database.
>
> Here is my script?
> <?php
> mysql_connect("nik", "", "") or
> die("could not connect to the database");
> mysql_select_db("guestbook") or
> die ("could not connect to the specified database");
> ?>
> I'm getting the "could not connect to the specified database" message.
>
> Please Help
> Thx
> Nik
>
>