EdwardJ Posted November 6, 2008 Share Posted November 6, 2008 Hi, I'm new to php so please bare with me. I am trying to make a DB connection with the following files: constants.php <?php define("DB_SERVER", "localhost"); define("DB_USER", "root"); define("DB_PASS", "password"); define("DB_NAME", "vv_tmk"); ?> connect_class.php <?php include ("constants.php"); class MySQLDB{ var $connection; var $selection; function MySQLDB(){ $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS); if($this->connection){ echo "Success! ";} else{ die(mysql_error());} $this->selection = mysql_select_db(DB_NAME, $this->connection); if($this->selection){ echo "Success!";} else{ die(mysql_error());} } } ?> test2.php <?php include ("constants.php"); include ("connect_class.php"); ?> <HTML> <HEAD> <TITLE>Test 2</TITLE> </HEAD> <BODY> <?php function MySQLDB() ?> </BODY> </HTML> I am getting: Parse error: syntax error, unexpected ';', expecting '{' in C:\wamp\www\Testing\test2.php on line 12 If anyone can help, I'd really appreciate ??? Link to comment https://forums.phpfreaks.com/topic/131686-solved-nothing-here-is-working/ Share on other sites More sharing options...
rhodesa Posted November 6, 2008 Share Posted November 6, 2008 <?php include ("constants.php"); include ("connect_class.php"); ?> <HTML> <HEAD> <TITLE>Test 2</TITLE> </HEAD> <BODY> <?php $db = new MySQLDB(); ?> </BODY> </HTML> Link to comment https://forums.phpfreaks.com/topic/131686-solved-nothing-here-is-working/#findComment-684030 Share on other sites More sharing options...
EdwardJ Posted November 6, 2008 Author Share Posted November 6, 2008 can't believe I forgot that small detail!! Thanks a lot Link to comment https://forums.phpfreaks.com/topic/131686-solved-nothing-here-is-working/#findComment-684098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.