General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 13th, 2003, 09:07 PM
PhreakShow64 PhreakShow64 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 13 PhreakShow64 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to PhreakShow64
Adding Variables together

Alright im making a registration form for my website.. Users are asked enter there birthday... there is a dropdown menu with all the numbers from 1-31 to select there birthday, another dropdown with all the months from Jan. to Dec. to select there birthmonth and another dropdown to select there birthyear. Now the problem is it needs to be entered into the MySQL database in YYYY-MM-DD Format so I need to combine the variables into one string. I have $day, $month, and $year, so inorder to put it into the format i'd do $year-$month-$day but that would subtract them so i need a way where my string ($age) can be $year-$month-$day so it will look like 1989-02-02 and the database will accept it! Please Help, i've tryed all the ways i can think of to put the variables together into one string

Reply With Quote
  #2  
Old January 13th, 2003, 09:24 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
PhreakShow64,

The easiest way would be like so:

PHP Code:
 $age $year "-" $month "-" $day


In PHP, the concatenation character is the period (.)... If you need any other help, just ask!

Hope that helps!
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #3  
Old January 13th, 2003, 09:52 PM
PhreakShow64 PhreakShow64 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 13 PhreakShow64 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to PhreakShow64
Thanx a lot

Reply With Quote
  #4  
Old January 13th, 2003, 09:56 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
No problem! Welcome to DevArticles. Enjoy your stay!

Btw... Don't forget to "echo $myskill;" for your signature! :P (just kidding... I had to after seeing that! Made me laugh. )

It'll come eventually... We all start as beginners... If you need help, don't hestitate to post in the forums!

Reply With Quote
  #5  
Old January 13th, 2003, 10:42 PM
PhreakShow64 PhreakShow64 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 13 PhreakShow64 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to PhreakShow64
New Problem

Now my registration form doesnt work, and i cannot figure out why, I made one before that worked and this one is based on that but it wont work! heres part of the code... I'm not getting a parse error, im gettin my error, Error adding user!
PHP Code:
 $query "SELECT username FROM users WHERE username = '$username'";
$result mysql_query($query) OR DIE ("ERROR");
$name_check mysql_num_rows($result);
if (
$name_check 0) {
 Print 
"Sorry the username you have chosen is already being used by someone else.";
} else {
$sql "INSERT INTO users (
    username,
    password,
    galas,
    email,
    staff,
    parent,
    iq,
    first_name,
    last_name,
    age,
    disp1,
    disp2,
    profile)
    VALUES (
    '$username',
    '$password',
    '2500',
    '$email',
    'norm',
    '$parent';
    '5',
    '$first_name',
    '$last_name',
    '$age',
    '$emailer',
    '$gal',
    '$profile')"
;
    
$sql2 "INSERT INTO house (
    owner,
    style,
    url,
    cost)
    VALUES (
    '$username',
    'cardboard box',
    '/galaxus/houses/house1.jpg',
    '0')"
;

if ( @
mysql_query($sql) ) {
  if ( @
mysql_query($sql2) ) {
  Print 
"<table class=\"wel\"><tr><td bgcolor=\"black\"><center>Registration</center></td></tr><tr><td bgcolor=\"white\">";
  Print 
"You've succesfully registered! Login to start playing!</td></tr></table>";
  } else {
  Print 
"Error Creating House!";
  }
} else {
  Print 
"Error adding user!";
}
}
?> 

Reply With Quote
  #6  
Old January 13th, 2003, 10:43 PM
PhreakShow64 PhreakShow64 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 13 PhreakShow64 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to PhreakShow64
omg... i cant believe i just saw it!! a stupid little ; after $parent instead of a comma

Reply With Quote
  #7  
Old January 14th, 2003, 07:44 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Hehehe... It's a common mistake! We all do it! At least you can change your signature now:

$myskill = not as pathetic;



All is well?

Reply With Quote
  #8  
Old January 14th, 2003, 07:46 PM
PhreakShow64 PhreakShow64 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 13 PhreakShow64 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to PhreakShow64
Hows this signature??

Reply With Quote
  #9  
Old January 14th, 2003, 07:50 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Perfect!

We'll update it as we go along!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Adding Variables together


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT