|
Posted by Fairul Izham on 08/01/05 04:20
slightly wrong in this line
$link = mysql_connect('$host', '$user', '$pass');
it should like this
$link = mysql_connect($host, $user, $pass);
without "single quotation"
"None" <ampeloso@verizon.net> wrote in message
news:QzeHe.1958$2y2.1405@trndny02...
> Hello,
> Im getting a Debug Warning: C:\wamp\www\php5\connection.php line 8 -
> mysql_connect(): Unknown MySQL Server Host '$host' (11001)
> I thought I was passing "localhost" to the function?
>
> <?php
> #Database Connection Class
> #Inputs: $host,$user,password
>
> class connDb{
> var $resourse;
> function Conn($host,$user,$pass){
> $link = mysql_connect('$host', '$user', '$pass');
> if (!$link) {
> die('Could not connect: ' . mysql_error());
> }
> mysql_select_db("sean");
>
> $resourse=$link;
> }
> }
> ?>
>
> #Test Script
> <?php
> $connTest = new connDb;
> $connTest->Conn("localhost", "root", "");
> echo '$resourse';
> ?>
> Thanks
> Mike
>
Navigation:
[Reply to this message]
|