I started php just for 2-3 days how should i insert an variable to db and for what reason i got this error?
i think i didnt underestand strings and inserting to db completely
if you can suggest me some books its very good
Thank you for your help
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\babak\register.php on line 21
When running this script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>register
</title>
</head>
<body>
<?php
mysql_connect('localhost', 'root', '');
mysql_select_db('babak');
?>
thanx for your registering <?php echo $_POST["name"]; ?><br/>
your email is <?php echo $_POST["E-MAIL"]; ?><br/>
<?php
$sql ="INSERT INTO users(id,pass) VALUES ($_POST['id']','$_POST['pass']')";
?>
</body>
</html>
the indicated quotes are not permitted when you’re directly inserting array values into a double-quoted string. Use either of