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

storing results of a function - previous result overwritten with new result
I have created a function to validate input.

function validate_dimension($value,$name) {
<

question about stripslashes and real_escape_string
im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks.

I hav

header redirect problems? please help
Ok i am making a site that generates youtube thumbnails and i am generating an image that displays 1

Spliting paragraph into sentences and attach in
Here is what I am trying to do

example: Para1[123.456.789!] 3 sentences
Para2

Table colours fail when extra row added
Hey Gurus,

I got a weird problem with formating the colour of a table made in php. Everything

Using unserialize()
Hi there.

I have some data in my database that is serialized.

e.g.

a:2:{i:0

how to remove in php string display
My code is $message="We're looking at developing our website."; $body= "My mess

PHP and Javascript
Hi Guys,

Im trying to load the contents of an html file into a text area for editing, this is

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

How could I combine these arrays??
Hello.. I'm trying to figure out a way to combine these first two arrays to get the last array..

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