FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » ~error,insert query failed....AND undefined index~
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
~error,insert query failed....AND undefined index~ [message #34033] Mon, 02 October 2006 07:03 Go to next message
tyngtyng is currently offline  tyngtyng   Malaysia
Messages: 1
Registered: October 2006
Location: MALAYSIA
Karma: 0
Junior Member
hi...
i'm new to the php and now i'm getting an error to insert my data inside the form..and also undefined index in latest_updated......
Now,i'm having trouble catching what i'm doing wrong.... Shocked Here's my code to the query entry...

<?php

include 'config.php';

$pili_id=$_POST['pili_id'];
$branch=$_POST['branch'];
$zone=$_POST['zone'];
$location=$_POST['location'];
$type=$_POST['type'];
$subtype=$_POST['subtype'];
$alamat=$_POST['alamat'];
$latest_updated=$_POST['latest_updated'];

$query = "INSECT INTO pili VALUES (pili_id, branch, zone, location, type, subtype, alamat, latest_updated)
('$pili_id', '$branch', '$zone', '$location', '$type', '$subtype', '$alamat', '$latest_updated')";

mysql_query($query) or die('Error, insert query failed');
echo " '$pili_id' <b> '$branch' </b> ,'$zone', '$location', '$type', '$subtype', '$alamat','$latest_updated'";



?>

Can anyone give me a clue..?
thanks...!!!!
icon14.gif  Re: ~error,insert query failed....AND undefined index~ [message #34134 is a reply to message #34033] Sat, 07 October 2006 12:44 Go to previous message
manishsanger is currently offline  manishsanger   India
Messages: 1
Registered: October 2006
Location: India
Karma: 0
Junior Member

Hi,
First create the connect to database and then try, your code should be some thing like that:

<?
include 'config.php';

$name=$_POST['name'];
$emailadd=$_POST['emailadd'];
$company_name=$_POST['company_name'];
$designation=$_POST['designation'];
$address=$_POST['address'];
$address1=$_POST['address1'];
$city=$_POST['city'];
$state=$_POST['state'];
$zip_code=$_POST['zip_code'];
$country=$_POST['country'];
$phone=$_POST[phone];
$mobile=$_POST[mobile];
$email=$_POST[email];
$password=$_POST[password];
$password1=$_POST['password1'];
$payment=$_POST['payment'];
$con = mysql_connect(DB_SERVER,DB_USER,DB_PASS);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(DB_NAME, $con);
$sql="INSERT INTO oemp_members
(`Email`,`password`,`name`,`emailadd`,`company_name`,`designation`,`address `,`address1`,`city`,`state`,`zip_code`,`country`,`phone`,`mobile`,`payment` )
VALUES
('$email','$password','$name','$emailadd','$company_name','$designation','$ address','$address1','$city','$state','$zip_code','$country','$phone','$mob ile','$payment') ";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Information Entered"; //message you want to Show
?>

Happy Coding
-Manish Kumar


Manish Kumar
Team Leader
Aone Innvovation (P) Ltd
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Creating Simple Redirect links
Next Topic: Apache on local pc -> DocumentRoot on a remote nas
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 20:39:37 GMT 2024

Total time taken to generate the page: 0.05513 seconds