sql problems


Posted on 16th Feb 2014 07:03 pm by admin

I am having a small problem with my sql statement. it is inserting into 4 of the fields.

fields it is inserting into:
First
Did you know?Explore Trending and Topic pages for more stories like this.
Last
email
password

it is saying the record has been added. is there something wrong with the sql statement?

Code: <?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="95887rj"; // Mysql password
$db_name="bccsl"; // Database name
$tbl_name="managers2"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql = sprintf("INSERT INTO Managers (First, Last, Address, City, Postal, Home, Cell, Email, Password, Church, Team)VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",$_POST['firstname'],$_POST['lastname'],$_POST['address'],$_POST['city'],$_POST['postal'],$_POST['home'],$_POST['cell'],$_POST['email'],$_POST['password'],$_POST['church'],$_POST['team']);

if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
echo "1 record added";

?>
No comments posted yet

Your Answer:

Login to answer
263 Like 53 Dislike
Previous forums Next forums
Other forums

Is it possible to stop reservation creation in PM Order?
Hi All,

Is it possible to stop reservation creation in PM Order?

Thanks in adv

adding 0 to numbers
Hey guys i need to create a 00001 number in a loop. Is there a better way of forcing a 5 digit numbe

Add code to enable passing of checkbox variable on login
Ok, I have a login page, but want to add a checkbox that when checked and successful login is made i

Can't find a decent web analytics!!!
I've downloaded and installed Piwik. It's location detection based on IP addresses is fairly inaccur

Detail Expenses Report by Cost Center
I would like to obtain a report out of SAP that shows a list of expenses by cost center that shows t

login box shows up again after logging in 2nd login works
Hello,

I am having trouble on my site Lockerz.rack111.com where when you login the login box

Undefined variables
hi
----------------------------------------------------------------------------------------------

How to form a xml form table with a single sql statement..?
Hi everyone,
I don't know if this is going to be a duplicate thread but i couldn't

How to ask a regex question?
Hi, I thought I'd share some of my insight after seeing too many bad questions that either get ignor

date function help
i need help with date function

Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD H

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash