GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Nov-2009, 19:05
ebinz ebinz is offline
New Member
 
Join Date: Nov 2009
Posts: 2
ebinz is on a distinguished road

Parse error: parse error, expecting `T_VARIABLE' or `'$''


Hi ,
i m new to php, m doin a School project and i'm having a problem with

"Parse error: parse error, expecting `T_VARIABLE' or `'$'' in C:\wamp\www\poll\connect.php on line 30"

i ve tried many ways to eliminate this problem still cannot, so kindly help me

Ebin


PHP Code:

$user  = "root";
$pass     = "1234";
$host     = "localhost";
$database = "poll_surveydb";
$website  = "http://127.0.0.1/folder";
$con      =  mysql_connect($localhost,$root,$1234) or die(mysql_error()); // line 30
             mysql_select_db($poll_surveydb,$con) or die(mysql_error()); 


  #2  
Old 02-Nov-2009, 19:36
admin's Avatar
admin admin is offline
Administrator
 
Join Date: Sep 2002
Posts: 858
admin will become famous soon enough

Re: Parse error: parse error, expecting `T_VARIABLE' or `'$''


Hello ebinz,

It is either:

PHP Code:

$con      =  mysql_connect($host,$user,$pass) or die(mysql_error()); // line 30 



or

PHP Code:

$con      =  mysql_connect("localhost","root","1234") or die(mysql_error()); // line 30 



and NOT how you typed it in your post.
__________________
Custom BB codes you can use here:
[HTML] | [C++] | [CSS] | [JAVA] | [PY] | [VB]
  #3  
Old 09-Nov-2009, 19:09
ebinz ebinz is offline
New Member
 
Join Date: Nov 2009
Posts: 2
ebinz is on a distinguished road

Re: Parse error: parse error, expecting `T_VARIABLE' or `'$''


hi sorry for the late reply when i fixed the other error , i'm havin a new problem

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\wamp\www\pollstest\connect.php on line 30
Access denied for user 'root'@'localhost' (using password: YES)

PHP Code:

$user     = "root";
$pass     = "1234";
$host     = "localhost";
$database = "poll_surveydb";
$website  = "http://127.0.0.1/PollsSurvey";
$con      =  mysql_connect($host,$user,$pass) or die(mysql_error());  // Line 30
            mysql_select_db($poll_surveydb,$con) or die(mysql_error()); 


  #4  
Old 09-Nov-2009, 19:22
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,233
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Parse error: parse error, expecting `T_VARIABLE' or `'$''


That could possibly be a few things: (if not more)

1. The password is wrong
2. The MySQL port is configured to something other than default [3306]
3. The 'root' does not have localhost login [rare, but possible]

EDIT:
Also, based on your variables, shouldn't this line:
PHP Code:

mysql_select_db($poll_surveydb,$con) or die(mysql_error()); 


...be this:
PHP Code:

mysql_select_db($database,$con) or die(mysql_error()); 


Might also be a problem.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlogVista ?Widgets? on Windows XP by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in ukrspp21 MySQL / PHP Forum 41 25-Jan-2010 19:51
Parse error: parse error, unexpected T_STRING Richardknox PHP Code Library 3 19-May-2007 14:42
Parse error: parse error, unexpected T_STRING in /home/content/R/i/c/RichardAKnox/htm Richardknox MySQL / PHP Forum 5 18-Nov-2006 21:20
Apologies In Advance Parse error: parse error, unexpected T_STRING, expecting T_VARI sph2005 MySQL / PHP Forum 11 17-Jul-2006 09:28
Parse Error vigilantweather MySQL / PHP Forum 6 04-Feb-2006 13:15

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:35.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.