PHP/MySQL error I can't figure out

ShadowBlade

Diamond Member
Feb 11, 2005
4,263
0
0
Error:
Parse error: syntax error, unexpected T_STRING

Everything I can find tells me I'm missing a semicolon or quote or something, but I've sat and stared at this tidbit for 20 minutes and can't find anything missing.
 

drebo

Diamond Member
Feb 24, 2006
7,034
1
81
Your mysql_close() function is wrong. mysql_close() takes a resource identifier, which is returned by mysql_open(). So, change it to $db = mysql_open("localhost","tlyon"); and mysql_close($db);

That should do it.
 

ShadowBlade

Diamond Member
Feb 11, 2005
4,263
0
0
Well I did that and the error is no longer on line 6, and is now on line 7.

EDIT:
Updated code, below. (I also realized I hadn't selected a database, so I added that line, probably just pushed the error down)
 

ShadowBlade

Diamond Member
Feb 11, 2005
4,263
0
0
Thanks hg403 - I figured it out before you responded :)
Also, in case anyone else reads this, it needs to be mysql_connect instead of mysql_open (i.e. different from what drebo said above)
 

drebo

Diamond Member
Feb 24, 2006
7,034
1
81
You're right. PHP is no longer my primary web development language. open...connect...same diff. :p