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

Advice on how to delete a mysql row using my form
Hi,

I am very new to php and am struggling to work out how to delete a portfolio item (a row

Does design fit in FPGA ?
Hi all,

I've made a large HCC-Design. Because of the program-size the compile process with th

Extra fields in main body and php required.
I'm new to PHP so please be gentle. I have a little php script below that works well.
The &quo

Need help with simple code, back and forward buttons.
Basically, I have a set of pages in a folder, which have the title somephrasehere_09.php, somephrase

Generate multilayered array from string.
ok so i have a string that looks like this:
Code: [Select]blog:edit_all,delete_all|users:edit_all

selectbox+database connection retrive problem
Code: [Select]
<tr>
<th align="left" scope="c

Need help in Generating Combinations
Need help generating all possible combination of names in an array

Lets say i have the follow

Calling a Procedure with IN & OUT Parameters
Hello,

I usually call my procedures using the following way

declare variable e

DYNPRO_FIELD_CONVERSION
Hi gurus,

I got a dump when I run one of my program. the dump is described below:

MySQL Primary key gap
Alright, so I have a table with 26 entries in it (id, filename, caption) for my image randomiser (ht

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