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

Web Host List
Here is a list of web hosts that offer PHP and MySQL. It is no where near a full list, but it is mos

Custom array sort? asc then desc
Any ideas how I could sort this array? I've been trying for a while. Maybe with usort, but I have no

File upload issues
Hi Guys,

Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages

Is there a way to override built in php functions without APD?
I am trying to use the
rename_function()
override_function()
options that are built into

restricting another login once you logout
Hello,

how can I restrict a page from login authenticating against info in a MySQL DB for a s

Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a ne

Default TimeZone
The server I'm working with is hosted in America so all times inserted into the database are coming

Curl & sessions PLS HELP
Hello,

I have a problem with curl and sessions and i will try to explain the best i could.

New Login Script
Hi all, i attempted to create a whole new login script witch isnt working for some reason i dont kno

login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php

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