Hi All, I am writing a script to enter values into a database and i keep getting the following error:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-con-fname, pri-con-lname, pri-con-mi, pri-con-pphone, pri-con-pphone-ext, pri-c' at line 1
<?php
session_start();
$con = mysql_connect($_SESSION['dbhost'],$_SESSION['dbuser'],$_SESSION['dbpass']);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("c2_dj", $con);
///===PRIMARY CONTACT===///
$sqlpri="INSERT INTO events (pri-con-fname, pri-con-lname, pri-con-mi, pri-con-pphone, pri-con-pphone-ext, pri-con-sphone, pri-con-sphone-ext, pri-con-pemail, pri-con-semail, pri-con-hrs)
VALUES
('$_POST[priconfname]', '$_POST[priconlname]', '$_POST[priconmi]', '$_POST[priconpphone]', '$_POST[priconpphext]', '$_POST[priconsphone]', '$_POST[priconsphext]', '$_POST[priconpemail]', '$_POST[priconsemail]', '$_POST[priconhrs1]')";
///===SECONDARY CONTACT===///
$sqlsec="INSERT INTO events (sec-con-lname, sec-con-mi, sec-con-pphone, sec-con-pphone-ext, sec-con-sphone, sec-con-sphone-ext, sec-con-pemail, sec-con-semail, sec-con-hrs)
VALUES
('$_POST[secconfname]', '$_POST[secconlname]', '$_POST[secconmi]', '$_POST[secconpph]', '$_POST[secconpphext]', '$_POST[secconsph]', '$_POST[secconsphext]', '$_POST[secconpemail]', '$_POST[secconsemail]', '$_POST[secconhrs1]')";
///===LOCATION INFO===///
$sqlloc="INSERT INTO events (loc-address, loc-aptunit, loc-town, loc-state, loc-zip, loc-rm-width, loc-rm-length, loc-rm-height, loc-rm-wall, loc-rm-ceiling)
VALUES
('$_POST[locaddress]', '$_POST[locaptunit]', '$_POST[loctown]', '$_POST[locstate]', '$_POST[loczip]', '$_POST[locwidth]', '$_POST[loclength]', '$_POST[locheight]', '$_POST[locwalls]', '$_POST[locceiling]')";
///===EVENT INFO===///
$sqleve="INSERT INTO events (event-theme, event-type, event-attend, event-marketing, event-pep)
VALUES
('$_POST[eventtheme]', '$_POST[eventtype]', '$_POST[eventattendees]', '$_POST[eventmarketing]', '$_POST[eventpep]')";
///===MUSIC INFO===///
$sqlmxk="INSERT INTO events (music-pgenre, music-sgenre, music-clean)
VALUES
('$_POST[musicpgenre]', '$_POST[musicsgenre]', '$_POST[musiclean]')";
///===LIGHT INFO===///
$sqllit="INSERT INTO events (light-scheme, light-list, light-fog, light-fog-pref)
VALUES
('$_POST[lightscheme]', '$_POST[lightlist]', '$_POST[fog]', '$_POST[fogpref]')";
///===SOUND & MISC INFO===///
$sqlsou="INSERT INTO events (sound-scheme, sound-mic, marketing-allowed)
VALUES
('$_POST[soundscheme]', '$_POST[mic]', '$_POST[marketingallowed]')";
///==========================================================================================///
if ((mysql_query($sqlpri,$con)) && mysql_query($sqlsec,$con) && mysql_query($sqlloc,$con) && mysql_query($sqleve,$con) && mysql_query($sqlmxk,$con) && mysql_query($sqllit,$con) && mysql_query($sqlsou,$con))
{
echo "<html><center><br><br><BR><BR><BR><BR><BR><BR>1 record added";
header("location:./new.event.php");
}
die('Error: ' . mysql_error());
/// $sqlsec,$sqlloc,$sqleve,$sqlmxk,$sqllit,$sqlsou,$con))
///header('./new.event.php');
mysql_close($con)
?>
I Am Using PHP5 on ubuntu server 10.10. with apache 2 7 MySQL
I Cant seem to figure this one out. Any ideas???
Thanks,
JL Griffin