-1

I have been looking the problem but I really dont know where the problem could be. It just give an error. (Parse error: 14 Line)

<?php

$conect = mysql_connect('localhost','root') or die('No se pudo conectar: ' . mysql_error());;

$telefono = $_GET["telefono"];
$empresa = $_GET["empresa"];
$mensaje = $_GET["mensaje"];
$codigo = $_GET["codigo"];
$remitente = $_GET["remitente"];
$tiempo = $_GET["tiempo"];
$db = "test_david";
echo "Telefono: ".$telefono." Empresa: ".$empresa." mensaje: ".$mensaje." codigo: ".$codigo." remitente: ".$remitente." tiempo: ".$tiempo   

mysql_select_db($db,$conect) ;
or die("No se pudo seleccionar la base de datos");

$update = "INSERT INTO datos (telefono,empresa,mensaje,codigo,remitente,tiempo) values('".$telefono."','".$empresa."','".$mesaje."','".$codigo."','"$remitente"','"$tiempo"')";
//mysql_close($conect);
?>
Musa
  • 96,336
  • 17
  • 118
  • 137
DavidQuezada7
  • 149
  • 2
  • 7

2 Answers2

1

You forget the ; character at the end of the following line:

echo "Telefono: ".$telefono." Empresa: ".$empresa." mensaje: ".$mensaje." codigo: ".$codigo." remitente: ".$remitente." tiempo: ".$tiempo   

And be aware of XSS and SQL-Injection vulnerableness, you should use a htmlspecialchars for outputting user input and mysql_real_escape_string for writing it into a MySQL-Query!

Flixer
  • 938
  • 1
  • 7
  • 20
  • Ur awesome (thanks). Now I got a new problem :( at the 16 line I have the next error: Parse error: syntax error, unexpected '"','"' (T_CONSTANT_ENCAPSED_STRING) – DavidQuezada7 Feb 05 '14 at 22:46
  • There must not a ";" character between the "mysql_select_db" and the "or" - it is all one statement/line. – Flixer Feb 05 '14 at 22:52
  • Also there are missing some "." characters in your last mysql statement. – Flixer Feb 05 '14 at 22:54
0

Just to clarify a little, the answers to the problems posted so far are correct, but your problem is more around understanding why this happened. When PHP gives you an error about missing semi-colons, the best thing to do first is to look at the previous line and determine if that line is OK before taking a look at the line that was actually reported. PHP usually gives you syntax errors in this way: the line BEFORE the reported line is the one that has the actual problem.

Hope that helps you the next time you see an error like this.

Shafiq Jetha
  • 1,337
  • 16
  • 30