for some reason mysql query not working, not inserting, please check it out


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

This code is not inserting anything into my db, don't know why, the $_SESSION variable does contain data.

Please have a look.
Code:
Did you know?Explore Trending and Topic pages for more stories like this.
function add_user_to_db()
{
//print_r($_SESSION['user_reg']);
$username = $_SESSION['user_reg']['username'];
$password = $_SESSION['user_reg']['password'];
$email = $_SESSION['user_reg']['email'];
$first_name = $_SESSION['user_reg']['first_name'];
$last_name = $_SESSION['user_reg']['last_name'];
$pharmacyname = $_SESSION['user_reg']['pharmacyname'];
$contact_number = $_SESSION['user_reg']['contact_number'];

$connection = db_connect();
$query = "INSERT INTO `pharma_edu`.`users` (`user_id`, `username`, `password`, `email`, `first_name`, `last_name`, `pharmacy_name`, `contact_number`, `user_access`, `active`) VALUES (NULL, '$username','$password', '$email', '$first_name', '$last_name', '$pharmacyname', '$contact_number', '1', 'n')";

if (mysql_query($query))
{
return true;
}else{
return false;
}
}
add_user_to_db();

No comments posted yet

Your Answer:

Login to answer
231 Like 21 Dislike
Previous forums Next forums
Other forums

IIS on 2003 anon access disabled issue
I have an IIS server that belongs to a domain, and anonymous access is turned off for all my sites.

'grab_files', multiple extension?
hey guys,

can anyone suggest a way to make to following line of code look for files with more

New Search Engine
Hey everyone,

I have a ZIP Code Radius search engine already functional. it displays all of t

mysql select query problem
how can i select multiple fields from multiple table in one query like

i have table name t1 a

bind error during socket programming
i am kinda new to socket programming. wrote the below code for a server. but getting the bind error

urldecode question
How would I format this line of code properly?

<?php echo urldecode($_GET['Title']); ?

PHP XML extraction text
I would like to extract an xml text and have that text directly echo(print) out on my web page. Her

How to secure my login data to my database?
Hi there,

It may be a stupid question but I don't know how to secure my login data to my data

Replacing a string on click of a button
Hi! Is there a way to replace a string on a click of a text link?

This is what I've come up w

Database connection failure
Hello All,

I am trying to create new connection to Oracle DB 10.1,
I could not see a

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