Web Design Forum: dynamic switch - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

dynamic switch Rate Topic: -----

#1 User is offline   lee sands 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 134
  • Joined: 14-August 10
  • Reputation: 0
  • Gender:Male
  • Location:Gosport, Hampshire, UK
  • Experience:Beginner
  • Area of Expertise:Coder

Posted 05 February 2012 - 02:15 PM

hi all is it possable to make a php swich from a mysql statement ie

<?php 
  	$s = "SQL CODE"; 
  	$r = mysql_query("sql);  
  	switch($p) { 
     		while ($row = mysql_fetch_array($result)) {
                	case '$row[\'case\']': 
                       		$pg = $row['pg'];   		
                       		$title = $row['title']; 
                       		break;
            }
  	}
?>

0

#2 User is online   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,820
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 05 February 2012 - 02:27 PM

http://php.net/manua...ures.switch.php will answer all your questions :)
0

#3 User is offline   lee sands 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 134
  • Joined: 14-August 10
  • Reputation: 0
  • Gender:Male
  • Location:Gosport, Hampshire, UK
  • Experience:Beginner
  • Area of Expertise:Coder

Posted 05 February 2012 - 02:35 PM

that page don cover what i am looking for
0

#4 User is online   andyl 

  • White space enthusiast
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,535
  • Joined: 21-January 10
  • Reputation: 210
  • Gender:Male
  • Location:Surrey
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 05 February 2012 - 02:38 PM

WTF is $p?
0

#5 User is online   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,820
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 05 February 2012 - 02:41 PM

View Postandyl, on 05 February 2012 - 02:38 PM, said:

WTF is $p?


An unspoken variable. We don't talk about that here anymore :)
1

#6 User is online   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,820
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 05 February 2012 - 02:41 PM

View Postlee sands, on 05 February 2012 - 02:35 PM, said:

that page don cover what i am looking for


It does if you actually take in and understand what is being said.
0

#7 User is offline   SniderDK 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 697
  • Joined: 01-November 08
  • Reputation: 88
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 05 February 2012 - 03:30 PM

to point out the obvious... anno how silly of me... run the code on your machine and try it out...
0

#8 User is offline   lee sands 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 134
  • Joined: 14-August 10
  • Reputation: 0
  • Gender:Male
  • Location:Gosport, Hampshire, UK
  • Experience:Beginner
  • Area of Expertise:Coder

Posted 05 February 2012 - 04:52 PM

done tht and just get syntax errors
0

#9 User is online   rallport 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 3,820
  • Joined: 03-January 10
  • Reputation: 266
  • Gender:Male
  • Location:England, UK
  • Experience:Advanced
  • Area of Expertise:Web Developer

Posted 05 February 2012 - 08:30 PM

View Postlee sands, on 05 February 2012 - 04:52 PM, said:

done tht and just get syntax errors


I promise you, if you read and understand the php docs link I sent all will become clear.
0

#10 User is offline   Glowbridge 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 616
  • Joined: 15-July 11
  • Reputation: 99
  • Gender:Male
  • Location:Scotland
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 06 February 2012 - 12:02 PM

As a non-PHP developer.. that seems quite nifty.
0

#11 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,595
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 06 February 2012 - 12:07 PM

View Postrallport, on 05 February 2012 - 02:41 PM, said:

An unspoken variable. We don't talk about that here anymore :)


QFTUltimateW.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users