Page 1 of 1

PHP Parse Error - T_STRING

Posted: Sun Aug 06, 2006 1:38 pm
by maxpax
When I try and connect to a database using php, I get this error:
PHP Parse error: parse error, unexpected T_STRING in D:\Documents and Settings\Administrator.THAKES_SERVER\Desktop\Intranet\Development\Website\index.php on line 168
This is the connection code I am using:

Code: Select all

$link = mysql_connect( "localhost", "root", "password" );
  if ( ! $link ) {
    die( "Couldn't connect to MySQL" );
  }
  $database = "website"
  mysql_select_db( $database ) or die ( "Couldn't open $database" );
  $table = "hits"
  mysql_select_table( $table ) or die ( "COuldn't open $table" );
Can anyone tell me how to get around this error?

Posted: Sun Aug 06, 2006 1:47 pm
by NiGHTFiRE
Yes,
Change

Code: Select all

$database = "website"
to:

Code: Select all

$database = "website";
and change:

Code: Select all

table = "hits"
to:

Code: Select all

table = "hits";

Posted: Sun Aug 06, 2006 2:04 pm
by maxpax
oops missed that, shows you I am new to this! :)

However, I am now getting this error:
PHP Fatal error: Call to undefined function mysql_select_table()
Obviously php doesn't like the mysql_select_table function. So being new, I have probably messed it up. Can anyone provide me with a solution to this one?

Posted: Sun Aug 06, 2006 2:31 pm
by NiGHTFiRE
No such function as mysql_select_table

Posted: Sun Aug 06, 2006 2:38 pm
by Chris Corbyn
http://www.php.net/mysql

See the functions listed at the bottom of that page for what's available for use with MySQL.

Posted: Sun Aug 06, 2006 4:09 pm
by maxpax
Thought it was probably that the function didn't exist. :oops:

Thanks for the link I will look at that. :)

Posted: Sun Aug 06, 2006 5:40 pm
by Ollie Saunders
Obviously php doesn't like the mysql_select_table function. So being new, I have probably messed it up. Can anyone provide me with a solution to this one?
Unless you are mucking around in the configuration you can't really mess PHP up. If it says a function is undefined it probably means the function is undefined, its not out there to trick you ok?