adam291086 Posted December 9, 2007 Share Posted December 9, 2007 Hey the code below just produces error with no mysql problem and no information is put into the database. Can anyone see why? <?php session_start(); // is the one accessing this page logged in or not? if (!isset($_SESSION['db_is_logged_in']) || $_SESSION['db_is_logged_in'] !== true) { // not logged in, move to login page header('Location: login.php'); exit; } $News = $_POST["News"]; $Major = $_POST["Major"]; $WRYL = $_POST["WRYL"]; $Development = $_POST["Development"]; $Events = $_POST["Events"]; $Board = $_POST["Board"]; $NRRC = $_POST["NRRC"]; $Latest = $_POST["Latest Results"]; $Ryedale = $_POST["Ryedale Rumble"]; $Home = $_POST["Home"]; $User = $_POST["User_Name"]; $Password = $_POST["Password"]; include 'config.php'; $conn; mysql_query(" INSERT INTO tbl_auth_user ( user_name, user_password, Home page, Ryedale Rumble, Latest Results, National Road Race Championship, Board, Events Workgroup, Development, WRYL, Majour Events, News) VALUES ( '$User', 'PASSWORD(Password)', '$Home', '$Ryedale', '$Latest', '$NRRC', '$Board', '$Events', '$Development', '$WRYL', '$Major', '$News')"); include 'closedb.php'; if (!mysql_query()) { die('Error: ' .mysql_error()); } echo "1 record added"; ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 9, 2007 Share Posted December 9, 2007 Well, whats the error? Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 9, 2007 Author Share Posted December 9, 2007 nothing is going into the database and there should be Quote Link to comment Share on other sites More sharing options...
peranha Posted December 9, 2007 Share Posted December 9, 2007 What error do you get on the screen, or in your log file if using apache. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 9, 2007 Share Posted December 9, 2007 Try this, and tell us what it gives you <?php $query =" INSERT INTO tbl_auth_user ( user_name, user_password, Home page, Ryedale Rumble, Latest Results, National Road Race Championship, Board, Events Workgroup, Development, WRYL, Majour Events, News) VALUES ( '$User', 'PASSWORD(Password)', '$Home', '$Ryedale', '$Latest', '$NRRC', '$Board', '$Events', '$Development', '$WRYL', '$Major', '$News')"; $result = mysql_query($query)or die(mysql_error()."<p>With Query<br>$query"); echo "<p>$query"; include 'closedb.php'; ?> Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 9, 2007 Author Share Posted December 9, 2007 I tried that code and now get the 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 'page, Ryedale Rumble, Latest Results, National Road Race Cham With Query INSERT INTO tbl_auth_user ( user_name, user_password, Home page, Ryedale Rumble, Latest Results, National Road Race Championship, Board, Events Workgroup, Development, WRYL, Majour Events, News) VALUES ( 'adam', 'PASSWORD(Password)', 'Home', '', '', 'NRRC', 'Board', 'Events', 'development', 'WRYL', 'Major Events', 'News') Quote Link to comment Share on other sites More sharing options...
revraz Posted December 9, 2007 Share Posted December 9, 2007 You have spaces in your DB Field names? Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 9, 2007 Author Share Posted December 9, 2007 working, was because of database spaces Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.