Code: Select all
class Myclass{
var $dbh;
$this->dbh=mysql_connect ("localhost", "acount", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
}Moderator: General Moderators
Code: Select all
class Myclass{
var $dbh;
$this->dbh=mysql_connect ("localhost", "acount", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
}Yeah, that's invalid syntax for a class. Needs to be something likeclass Myclass{
var $dbh;
$this->dbh=mysql_connect ("localhost", "acount", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
}
Code: Select all
class Myclass{
var $dbh;
function DBConnect(){
$this->dbh=mysql_connect ("localhost", "acount", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
}
}Code: Select all
$result = mysql_query("SELECT * FROM table",$this->dbh);Code: Select all
<?php
$result = mysql_query("SELECT * FROM table",$this->dbh);
?>Code: Select all
<?php
$result = mysql_query("SELECT * FROM table,$this->dbh");
?>