A parse error, unexpected T_STRING....what?

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
XepheX
Forum Newbie
Posts: 13
Joined: Thu Jun 06, 2002 5:30 am

A parse error, unexpected T_STRING....what?

Post by XepheX »

Hi!
Have som problems with mysql_query()

The code is:

Code: Select all

<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<?PHP
/*Öppna databasen*/
$open = mysql_connect("localhost","*****","*****");

mysql_select_db ("doom")

mysql_query ("INSERT INTO members (un, pw, email) VALUES ('".$_POST&#1111;"un"]."', '".$_POST&#1111;"pw"]."', '".$_POST&#1111;"email"]."')");

mysql_close ($open); &#123;

print "Thanks for register";
&#125; 
?>


<body topmargin="40" leftmargin="100">
<h2>So you wanna be a member?</h2>
<P>
Just fill put the forms below, and then, Have fun!
<p>
<table border="0" cellspacing="0" cellpadding="5" class="field">
  <form action="register.php" method="post"> 
    <tr>
		  <td>Username:</td>
			<td><input type="text" name="un" size="16" maxlength="16" class="box"></td>
		</tr>
		<tr>
		  <td>Password:</td>
			<td><input type="text" name="pw" size="16" maxlength="16" class="box"></td>
		</tr>
		<tr>
		  <td>E-mail:</td>
			<td><input type="text" name="email" size="16" maxlength="64" class="box"></td>
			</tr>
			<tr>
			<td>&nbsp;</td>
			<td align="left"><input type="submit" value="submit" class="field"></td>
		</tr>
	</table>
</form>
<p>
All fields are required!<br />
Note! the e-mail is only if you lost you´re password. No other things will be sent.


</body>
</html>
and the errormsg is:
Parse error: parse error, unexpected T_STRING in C:\Program\Apache Group\Apache2\htdocs\Doom_hell_on_net\register.php on line 13


Hope that you can help me!

XepheX
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

simply forgot a ;
mysql_select_db ("doom");
XepheX
Forum Newbie
Posts: 13
Joined: Thu Jun 06, 2002 5:30 am

Post by XepheX »

Thanks!
Now its just the variables who are undefined.

i changed the code to:

Code: Select all

mysql_query ("INSERT INTO members (un, pw, email) VALUES ('$un', '$pw' '$email')");
How do i fix that?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

read the sticky thread called 'Please, read this BEFORE posting'.
XepheX
Forum Newbie
Posts: 13
Joined: Thu Jun 06, 2002 5:30 am

Post by XepheX »

Hi again!

I read the sticky note, and as i can se it should look like this:

Code: Select all

mysql_query ("INSERT INTO members (un, pw, email) VALUES ($_POST&#1111;'un'],$_POST&#1111;'pw'],$_POST&#1111;'email'])");
But it still dosent work.

The errormsg. is:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program\Apache Group\Apache2\htdocs\Doom_hell_on_net\register.php on line 45
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

you have to 'mark' arrays in string for replacement

Code: Select all

mysql_query ("INSERT INTO members (un, pw, email) VALUES (&#123;$_POST&#1111;'un']&#125;,&#123;$_POST&#1111;'pw']&#125;,&#123;$_POST&#1111;'email']&#125;)");
XepheX
Forum Newbie
Posts: 13
Joined: Thu Jun 06, 2002 5:30 am

Post by XepheX »

It´s now working as it supposed to.

Thanks to you all
Post Reply