Jump to content

[SOLVED] Nothing here is working!


EdwardJ

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.