Jump to content

Quick Question cant spot issue with insert script


fireice87

Recommended Posts

Just having an annoying moment where i really cant see the problem so any help would be great

 

I have a form that passes to reg_confirm.php that has the insert script i can echo out the variables on this page.

 

heres the code

  <?php 
require('functionlist.php'); 
   dbconnect();
$submitted = date('j F Y hA');
/*
echo $_POST[title];
echo $_POST[first_name];
echo $_POST[email];
echo $_POST[first_name];
echo $_POST[telephone];
echo $_POST[pcode];
echo $_POST[time_call];
*/
$sql = "INSERT INTO `training` (`tr_title` ,`tr_firstnames` ,`tr_email` ,`tr_telephone` , `tr_time` ,`tr_postcode`,`tr_date` ) 
VALUES (\"$_POST[title]\",\"$_POST[first_name]\",\"$_POST[email]\", \"$_POST[telephone]\", \"$_POST[time_call]\", \"$_POST[pcode]\",\"$submitted\");"; #Create Query
$result= mysql_query($sql, $conn )
or die(mysql_error()); #Run query

 

heres a copy and paste of table fields from phpmyadmin

 

 

tr_title

tr_firstnames

tr_email

tr_telephone

tr_time

tr_postcode

tr_date

 

:confused: Thanks alot

 

edit forgot to post the connection!

 

<?php 

function dbconnect()
{
global $conn, $db;
     $conn = @mysql_connect( "**", "**", "**")
or die ("could not connect to mysql");  #Connect to mysql
$db = @mysql_select_db( "**",  $conn )
or die ("Could not select database"); #select database
}	
?>

 

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.