PDA

View Full Version : php code error in browser


MaravillaEnt
05-14-2009, 09:08 PM
<?php
require_once("Connections/connection.php"); // database connection

///////////////////////////////////////////////////////////
$data2 = $_POST['data2'];
$data3 = $_POST['data3'];
$data3 = $_POST['data4'];
$submit = $_POST['submit'];
///////////////////////////////////////////////////////////

if ($submit && $data2 && data3 && $data4){

///////////////////////////////////////////////////////////
$query = sprintf("INSERT into table1 (field2, field3, field4) values ('$data2', '$data3', '$data4')");
mysql_query[$query]or die[mysql_error()];
///////////////////////////////////////////////////////////

}elseif($submit){

echo "One of your fields is empty !";

}

im getting parse error on line 15.
everything looks right to me .. but hey.. im no expert just yet.

davidj
05-14-2009, 11:04 PM
mysql_query[$query]or die[mysql_error()];

this should be

mysql_query($query)or die(mysql_error());

edbr
05-15-2009, 02:27 AM
i get my reading glasses from Seymour Clearly. :) its an easy mistake to make

Corrosive
05-15-2009, 09:17 AM
i get my reading glasses from Seymour Clearly. :) its an easy mistake to make

You are on fine form today Mr B. Something in the 'Barley' water?

edbr
05-15-2009, 09:27 AM
actually a very good villa opening last night might have something to do with it, no water involved though