You are here: Re: New to objects « All PHP « IT news, forums, messages
Re: New to objects

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация