Hi I made this. <? //config.php $sqlhost = "localhost"; $sqluser = "root"; $sqlpasswd = "password"; $sqldatabase = "project"; ?>
<? //sqlclass.php require('config.php'); class Connect { var $link; function Connect() { $this->link = mysql_connect($sqlhost,$sqluser,$sqlpasswd); $select = mysql_select_db($sqldatabase,$this->link); } } ?> <? //index.php require('config.php'); require('sql.php'); $class = new Connect; $query = "SELECT * from houses WHERE city='toronto'"; $result = mysql_query($query,$class->link); $row = mysql_fetch_array($result); echo "$row[title]" ."$row[firstname]"; ?> What I'm trying to do is make a function or class that I can call up when ever I want to connect to mysql. If anyone can explain if I've done something wrong or if I'm not calling the function up. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php