-2

I have WAMP installed. I am trying to connect the database and it will not work. I have all services started... I created a test file calledtes44.php and put it in the WWW folder to see if it wpuld work

The code is

 <?php phpinfo() ; ? >

When I run that file in browser I receive the error...

Parse error: syntax error, unexpected '?' in C:\wamp1\www\test44.php on line 1

What am I missing??

James

James_P
  • 41
  • 9

3 Answers3

1

You have a space at the end tag. Try it like this:

<?php phpinfo(); ?>
kaanmijo
  • 713
  • 1
  • 5
  • 14
0

You are using the wrong quotes. Use this:

$conn = mysqli_connect("localhost", "", "", "membersapp") or die(mysqli_error($conn));

Instead of this:

$conn = mysqli_connect(“localhost”,””,””,”membersapp”) or  die(mysqli_error($conn));

Also, add a semicolon at the end of your echo:

echo "Connected to database";
kaanmijo
  • 713
  • 1
  • 5
  • 14
0

This should be it:

// The connection string
$con = mysqli_connect("localhost", "", "", "membersapp");

// Check connection
if (mysqli_connect_errno())
{
    // Error! 
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}else{
    // Woohoo, success!
    echo "Connected succesfully!";
}
kaanmijo
  • 713
  • 1
  • 5
  • 14