[advanced search]
Results from the most recent live auction are here.
21 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Domain Name Industry Newsletter
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 06-02-2006, 09:36 AM   · #1
unknowngiver
Senior Member
 
Name: Zubair
Location: Ontario Canada
Trader Rating: (53)
Join Date: May 2005
Posts: 2,754
NP$: 724.15 (Donate)
unknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to allunknowngiver is a name known to all
query problem again

Hey
Whats wrong wid this code now
PHP Code:
@mysql_select_db($database) or die( "Unable to select database");
$query= 'INSERT INTO `user` (`id`, `username`, `pass`, `email`, `lastlogin`, `health`, `country`, `level`, `armysize`) VALUES (NULL, $username, $pass, $email, NULL, \'100\', $country, \'1\', \'1\');';
mysql_query($query);


its not giving any error but instead of adding whats in $username its adding the "$username" into the database..


Please register or log-in into NamePros to hide ads
unknowngiver is offline   Reply With Quote
Old 06-02-2006, 10:01 AM   · #2
iNod
Eating Pie
 
iNod's Avatar
 
Name: Steve
Location: Canada
Trader Rating: (66)
Join Date: Nov 2004
Posts: 2,284
NP$: 91.30 (Donate)
iNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud ofiNod has much to be proud of
Special Olympics AIDS/HIV Cystic Fibrosis Save The Children Baby Health Cystic Fibrosis
Change it too this.

PHP Code:
@mysql_select_db($database) or die( "Unable to select database");
$query= "INSERT INTO user ('username', 'pass', 'email', 'lastlogin', 'health','country', 'level', 'armysize') VALUES ($username, $pass, $email, NULL, \'100\', $country, \'1\', \'1\')";
mysql_query($query);


All use " (double quotes) while setting the mysql query. Also ` are extremely slow. So use ' insted.

" = text & variables
' = text (variables are thought of as text)

- Steve
__________________
RegisterDub.com - 200th Customer Milestone
ZuneParts.net - International Zune Parts and Accessories
FeaturedFont.com - One Top Free Font a Day!
iNod is offline   Reply With Quote
Old 06-02-2006, 10:11 AM   · #3
Shorty
Senior Member
 
Shorty's Avatar
 
Name: Thomas White
Location: England
Trader Rating: (15)
Join Date: Sep 2005
Posts: 1,033
NP$: 31.15 (Donate)
Shorty is just really niceShorty is just really niceShorty is just really niceShorty is just really nice
$query= "INSERT INTO `user` (`id`, `username`, `pass`, `email`, `lastlogin`, `health`, `country`, `level`, `armysize`) VALUES (NULL, $username, $pass, $email, NULL, \'100\', $country, \'1\', \'1\')";

That should do it...I think.
Shorty is offline   Reply With Quote
Old 06-02-2006, 11:08 AM   · #4
Palyriot
NamePros Regular
 
Palyriot's Avatar
 
Name: Derek
Location: Seattle, Wa
Trader Rating: (14)
Join Date: Jul 2004
Posts: 597
NP$: 69.00 (Donate)
Palyriot is a jewel in the roughPalyriot is a jewel in the roughPalyriot is a jewel in the rough
PHP Code:
@mysql_select_db($database) or die("Unable to select database");
$query= "INSERT INTO user(id, username, pass, email, lastlogin, health, country, level, armysize) VALUES (NULL, '$username', '$pass', '$email', NULL, 100, '$country', 1, 1)";
mysql_query($query);


That'll do it.
Palyriot is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
Pimps/RPG Game Script Buy Flash Arcade Game Script free webhosting
Advertise your business at NamePros
All times are GMT -7. The time now is 09:21 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0