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

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 April 26th, 2003, 08:21 AM
benos benos is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 233 benos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Article Discussion: Using Control Structures in PHP

Using Control Structures in PHP If you have any questions or comments about this article please post them here.

You can read the article here .

Reply With Quote
  #2  
Old April 28th, 2003, 09:20 AM
beetle18 beetle18 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Victoria, TX
Posts: 29 beetle18 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to beetle18 Send a message via AIM to beetle18
Where's switch? Should be mentioned along with if/else & if/elseif/else

Reply With Quote
  #3  
Old April 28th, 2003, 09:32 AM
benos benos is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 233 benos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I was thinking that aswell when I was putting this article up. Perhaps the writer is wishing to place the switch in another article. But I must agree with you.

The switch statement is an important Control Structure. For those wondering what this structure is, here is the low down.

PHP Code:
 swtich($var)
{
    case 
"condition1":
        echo 
"1";
        break;
    case 
"condition2":
        echo 
"2";
        break;
    case 
"condition3":
        echo 
"3";
        break;



The switch is great for multiple conditions. Saves writing multiple if/else if statements.

Reply With Quote
  #4  
Old April 11th, 2005, 09:26 PM
manicplanet manicplanet is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 1 manicplanet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 8 sec
Reputation Power: 0
Dynamic Pulldown from multiple columns

I think this is useful; more useful would be to know how to write PHP to pull both A) the option value and B) option from two different columns in the same MySQL table. I'm trying to set up a pulldown of country names from the column 'country_name' that will select a value from the 'country_id' column in the same table, because other related tables are keyed to 'country_id', not 'country_name.' Would it be easier just to run a second query to select the country_id from the table where country_name = $universe ?

the code that pulls the _same_ info for value and value option:

...
require_once ('../mysql_connect.php'); // Connect to the db.
echo '<b>Universe:</b>';
$sql = "SELECT DISTINCT(country_name) FROM country";
$resultd = @mysql_query($sql);
echo "<SELECT NAME=universe>";
while($row = @mysql_fetch_array($resultd))
{
echo "<OPTION VALUE=\"$row[0]\">$row[0]</OPTION>";
}

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Article Discussion: Using Control Structures in PHP


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 6 hosted by Hostway