PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 18th, 2004, 03:27 AM
ramyaivan ramyaivan is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 16 ramyaivan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
else statement

hi ,
how are u all.

I need some help in a very basic stuff. hope u will help me in that.

Actually on selecting a date in three dropdown menus, each one for year and date and month respectively, and
when concantenating them i am able to retrieve that respective date's (birthdate) name from the database.

My problem is, if the selected date doesnt have any name in the database, then how to specify the else-statement,
to show an error that "there is no name for this birthdate mentioned.

It will be great, if smbody would help me to slove this simple , basic doubt.

Thanking you,
ri

Reply With Quote
  #2  
Old August 18th, 2004, 05:03 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 956 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2Folding Points: 682581 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 8 h 23 m 34 sec
Reputation Power: 4
Send a message via ICQ to Itsacon
ok, say your three date fields are labelled day, month and year, I'd use something like the following, assuming your DB is MySQL:

PHP Code:
 $date $_POST['year'].str_pad($_POST['month'], 2'0'STR_PAD_LEFT).str_pad($_POST['day'], 2'0'STR_PAD_LEFT);

$query "SELECT Name FROM People WHERE Birthday='".$date."' ORDER BY Name";
$result mysql_query($query);
if(
mysql_num_rows($result) > 0)
{
    echo 
"<div>\nThe following people have their birthday on ".$_POST['day']."-".$_POST['month']."-".$_POST['year'].":\n<ul>\n";
    while(
$temp mysql_fetch_array($result))
        echo 
"<li>".$temp['Name']."</li>\n";
    echo 
"</ul>\n</div>\n";
}
else
    echo 
"<div>\nNo people have their birthday on ".$_POST['day']."-".$_POST['month']."-".$_POST['year']."\n</div>\n"


Hope this helps

Reply With Quote
  #3  
Old August 18th, 2004, 11:37 AM
ramyaivan ramyaivan is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 16 ramyaivan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool Absolutely worked

Thank you soooooooooooooooooooooo muchhhhhhhhhhhhhhhh
It worked

bye
ri

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > else statement


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