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
}	
?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.