Jump to content

Parse Error


turbocueca

Recommended Posts

Parse error: parse error, unexpected T_STRING in /home/vhosts/infocenter.90megs.com/index2.php on line 11

This is the error that my page does. What is the cause of this and how can I fix it?
This is the link to the page with the error:

[a href=\"http://infocenter.90megs.com/index2.php\" target=\"_blank\"]http://infocenter.90megs.com/index2.php[/a]
Link to comment
https://forums.phpfreaks.com/topic/4863-parse-error/
Share on other sites

(...)
$selecao=mysql_select_db ("5684",$connection);
$consulta="CREATE TABLE turma (codigo INT AUTO_INCREMENT PRIMARY KEY, aluno CHAR(30), idade INT, email CHAR (40))";
$execucao=mysql_query($consulta,$connection);
$registo="INSERT INTO turma (aluno,idade,email) VALUES ("Anibal Varalonga",16,"[email protected]")"; [b][Line11][/b]
$insercao=mysql_query($registo,$connection);
(...)
Link to comment
https://forums.phpfreaks.com/topic/4863-parse-error/#findComment-17112
Share on other sites

In this line
[code]<?php $registo="INSERT INTO turma (aluno,idade,email) VALUES ("Anibal Varalonga",16,"[email protected]")"; ?>[/code]
You have double quotes inside a string delimited by double quotes. The inside double quotes should be single quotes, since MySQL delimite strings with single quotes.
[code]<?php $registo="INSERT INTO turma (aluno,idade,email) VALUES ('Anibal Varalonga', 16, '[email protected]')"; ?>[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/4863-parse-error/#findComment-17120
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.