-1

When I try to insert a new row it gives me this error:

Parse error: syntax error, unexpected ';'

When I execute the query, what I am doing wrong?

// Selecting Database
$db = mysql_select_db("spinbb_weedworld", $connection) or die(mysql_error($db));
// SQL query to fetch information of registerd users and finds user match.
$query = "INSERT INTO login ('name','password', 'email','username')
        VALUES ('".$name."', '".$password."', '".$email."','".$username."')";
$query = mysql_query($query,$db) or die(mysql_error($db);

if ($query)
{
    header("location: profile.php");
}
else
{
    echo("MySQL error ".mysql_errno().": ".mysql_error()."\n<br>When executing:<br>\n$query\n<br>");
}

mysql_close($connection); // Closing Connection
Federkun
  • 36,084
  • 8
  • 78
  • 90

2 Answers2

3

Closing typo ) on

$query = mysql_query($query,$db) or die(mysql_error($db));
Saty
  • 22,443
  • 7
  • 33
  • 51
1

Try using the query as follows:

$query = "INSERT INTO login ('name','password', 'email','username')
        VALUES ('$name', '$password', '$email','$username')";
rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156
Yogesh Pawar
  • 336
  • 2
  • 17