techker Posted December 14, 2008 Share Posted December 14, 2008 hey guys i have a script that selects client from a databse.now that client is either in a programme simple or combo. there is a link on that page that gets a grid with exercises on it. now i need a script between that process thats like if the client is simple fetch page...if client is combo fetch page x.. Link to comment https://forums.phpfreaks.com/topic/136970-if/ Share on other sites More sharing options...
DeanWhitehouse Posted December 14, 2008 Share Posted December 14, 2008 then start on one and when you get a problem/question post here Link to comment https://forums.phpfreaks.com/topic/136970-if/#findComment-715392 Share on other sites More sharing options...
techker Posted December 14, 2008 Author Share Posted December 14, 2008 sorry fergot to post it..lol ok so i have 2 questions in this: <? // Connects to your Database mysql_connect("localhost", "l", "techker") or die(mysql_error()); mysql_select_db("techker_llls") or die(mysql_error()); $id = mysql_escape_string($_GET['id']); $q = "SELECT * FROM cardio_select WHERE id = '$id'"; $res = mysql_query($q); $row = mysql_fetch_assoc($res); $plan = "$row['simple']"; //is this ok?will it get table simple? $plan2 = "$row['combo']"; if ( $plan == "on" ) {; //if that table's value is on then it should get page x } elseif($plan2 == "on"){; //if this one is on then it gets page b } ?> now it's the getting that page the part were i freeze.. i was looking at fetch but i think it is only for arays. then i looked at another page i did and the echo echo "<meta http-equiv=Refresh content=4;url=emplacement.php>"; but was woundering if 2 would the script get confused? Link to comment https://forums.phpfreaks.com/topic/136970-if/#findComment-715416 Share on other sites More sharing options...
techker Posted December 14, 2008 Author Share Posted December 14, 2008 ok i got it going i remove the " " cause it was giving me a white space error.. <? // Connects to your Database mysql_connect("localhost", "l_l", "l") or die(mysql_error()); mysql_select_db("techker_l") or die(mysql_error()); $id = mysql_escape_string($_GET['id']); $q = "SELECT * FROM cardio_select WHERE id = '$id'"; $res = mysql_query($q); $row = mysql_fetch_assoc($res); $plan =$row['simple']; $plan2 =$row['combo']; if ( $plan == "on" ) { echo "<meta http-equiv=Refresh content=2;url=client_cardio.php>";; } elseif($plan2 == "on"){ echo "<meta http-equiv=Refresh content=2;url=emplacement.php>";; } ?> is this the write way to do it? Link to comment https://forums.phpfreaks.com/topic/136970-if/#findComment-715425 Share on other sites More sharing options...
DeanWhitehouse Posted December 14, 2008 Share Posted December 14, 2008 Why? $plan = "$row['simple']"; //is this ok?will it get table simple? $plan2 = "$row['combo']"; simpler if you do $plan = $row['simple']; //is this ok?will it get table simple? $plan2 = $row['combo']; for this you could do if ( $plan == "on" ) { //if that table's value is on then it should get page x echo file_get_contents("filename.php"); //or include("file.php"); } elseif($plan2 == "on") { //if this one is on then it gets page b echo file_get_contents("filename.php"); //or include("file.php"); } or header("Location:filename.php"); would work, as long as there is no whitespace of HTML before the header Link to comment https://forums.phpfreaks.com/topic/136970-if/#findComment-715426 Share on other sites More sharing options...
techker Posted December 14, 2008 Author Share Posted December 14, 2008 nice we were posting at the same time i guess..lol thx Link to comment https://forums.phpfreaks.com/topic/136970-if/#findComment-715430 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.