PHP Parse Error - T_STRING

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
maxpax
Forum Newbie
Posts: 18
Joined: Tue Aug 01, 2006 5:38 am
Location: England

PHP Parse Error - T_STRING

Post 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?
Last edited by maxpax on Sun Aug 06, 2006 2:05 pm, edited 3 times in total.
NiGHTFiRE
Forum Contributor
Posts: 156
Joined: Sun May 14, 2006 10:36 am
Location: Sweden

Post 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";
maxpax
Forum Newbie
Posts: 18
Joined: Tue Aug 01, 2006 5:38 am
Location: England

Post 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?
NiGHTFiRE
Forum Contributor
Posts: 156
Joined: Sun May 14, 2006 10:36 am
Location: Sweden

Post by NiGHTFiRE »

No such function as mysql_select_table
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
maxpax
Forum Newbie
Posts: 18
Joined: Tue Aug 01, 2006 5:38 am
Location: England

Post by maxpax »

Thought it was probably that the function didn't exist. :oops:

Thanks for the link I will look at that. :)
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post 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?
Post Reply