Author Topic: Error: with php/mysql code. I don't know what to fix  (Read 285 times)

hannah

  • New Member
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Error: with php/mysql code. I don't know what to fix
« on: July 28, 2010, 05:48:41 PM »
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '<?php // This script will connect the user to your mySQL database. // It wil' at line 1
 
that is what it told me when i was trying out this code.(IDK what it means the code is for connect.php)can someone tell me what im doing wrong?
 
PHP Code: [Select]
<?php
// This script will connect the user to your mySQL database.
// It will also check it they're logged in or not.
// It should be included on every page you create.
// Set the variables below to match your settings
$dbhost 'localhost';
$dbuser 'root';
$dbpass '';
$dbname 'mygame';
$link mysql_pconnect($dbhost$dbuser$dbpass
or die(
"Could not connect to server.");
$selectdb mysql_select_db($dbname$link
or die(
"Could not connect to database.");
// Check to see if user is logged in
session_start();
if((!isset(
$_SESSION['id'])) || (!isset($_SESSION['username'])) || 
(!isset(
$_SESSION['password'])))
{
unset(
$_SESSION['username']);
unset(
$_SESSION['password']);
unset(
$_SESSION['id']);
$loggedin 0;
}
else
{
$loggedin 1;
}
?>