ODBC insert query
Posted: Tue Apr 26, 2005 11:34 am
Hello i am using ODBC to connect my access database to my website, i have everything set up ok, because i have performed a query and can access information,
I am trying to add a new user, into my User table, i have a form called join.htm and the action points to newuser.php
I get the information from each field and run this query
I know i havent done any validation but i thought this query would work, i have an id which in my table is an autonumber so i thought it would automatically create an id for this recordset.
Am i doing something wrong?
Regards
Andy
feyd | Please review how to post code using
I am trying to add a new user, into my User table, i have a form called join.htm and the action points to newuser.php
I get the information from each field and run this query
Code: Select all
<?php
$surname = $_POST['surname'];
$forename = $_POST['forename'];
$houseNo = $_POST['houseNo'];
$address = $_POST['address'];
$address2 = $_POST['address2'];
$county = $_POST['county'];
$postcode = $_POST['postcode'];
$telephone = $_POST['telephone'];
$username = $_POST['username'];
$password = $_POST['password'];
require_once('odbc.php');
$query = "INSERT INTO User (Surname, Forename, House name/number,Address1,Address2,County,Post Code,tel) ".
"values ('$surname','$forename','$houseNo','$address','$address2','$county','$postcode','$telephone')";
odbc_exec($odbc, $query) or die (odbc_errormsg());
?>Am i doing something wrong?
Regards
Andy
feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]