Jas Posted February 25, 2009 Share Posted February 25, 2009 Hi there I have a range of tests i.e which have different results to be shown. So 1-10 and 26 should have results_a.php and all others should have results_b.php... So how can I write that.... need this urgently... _________________________ $test_names = array( 1 => "shshshshshs", 2 => "djdjkdjkjkjkdjkdj", 26 => "hshshhspihpihd", 4 => "slkjlsjlksjlkjskjlkjs", 5 => "djkjskj;s;kjs;kjsj", 11 => "021", 12 => "022", 13 => "031", 14 => "050", 15 => "061", 16 => "010", 17 => "032", 18 => "033", 19 => "040", 20 => "062", 21 => "070", 22 => "080", 23 => "090", 24 => "033" ); else $startday = $back30days; if ($test < 10) { include("./results_a.php"); } else { include("./results_b.php"); } ?> I would like to add Sql 26 to those under 10... so it would include results_a.php for all tests up to 10 and including no 26. So how can I write - if ($test is < 10 and also 26 then include results_a.php, anything else include results_b.php Hope this is clear Link to comment https://forums.phpfreaks.com/topic/146846-can-you-help-with-my-code-pls/ Share on other sites More sharing options...
MasterACE14 Posted February 25, 2009 Share Posted February 25, 2009 maybe... if ($test < 10 || $test == 26) { include("./results_a.php"); } or rather... if ($test < 10) { include("./results_a.php"); } elseif($test == 26) else { include("./results_b.php"); } Link to comment https://forums.phpfreaks.com/topic/146846-can-you-help-with-my-code-pls/#findComment-770932 Share on other sites More sharing options...
Jas Posted February 25, 2009 Author Share Posted February 25, 2009 Thanks mate - that really helped. But for some reason I do not get the Percentile and Average Percentile in the reuslts: mysql_select_db($database); $quiz_names = array( 1 => "hshjhsjhjs", 2 => "kldlkldlklkaka", 26 => "woroiowioiowi", 4 => "alkalklslksklkd", 5 => "wieiuiuieuwiuiq", etc etc./. // get the starting day list($within30days, $purchase_date, $back30days) = mysql_fetch_row(mysql_query("SELECT DATE_ADD(purchase_date, INTERVAL 30 DAY) > NOW(), DATE_FORMAT(purchase_date, '%Y-%m-%d'), DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 30 DAY), '%Y-%m-%d') FROM test WHERE username = '$my_username' AND (($quiz < 10 AND plan_type = 'a') OR ($quiz > 10 AND plan_type = 'b'))")); if ($within30days) $startday = $purchase_date; else $startday = $back30days; // Percentile list($last_date, $accuracy, $percentile) = mysql_fetch_row(mysql_query("SELECT FROM_UNIXTIME(time_finish, '%d/%m/%y'), ROUND(no_correct/no_total*100,0), percentile FROM quirex_record WHERE taker_name = '$my_username' AND quiz_id = '$quiz' AND FROM_UNIXTIME(time_finish) >= '$startday' ORDER BY time_finish DESC LIMIT 1")); list($num_taken) = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM quirex_record WHERE taker_name = '$my_username' AND quiz_id = '$quiz' AND FROM_UNIXTIME(time_finish) >= '$startday'")); if ($quiz < 10||$quiz == 26) { include("./results_a.php"); } else { include("./results_b.php"); } ?> Is it that some the red code needs to change as well? Thanks for your help... Link to comment https://forums.phpfreaks.com/topic/146846-can-you-help-with-my-code-pls/#findComment-770946 Share on other sites More sharing options...
Jas Posted February 25, 2009 Author Share Posted February 25, 2009 Hiya - for some reason the second style of code does not work but the first way does work. Link to comment https://forums.phpfreaks.com/topic/146846-can-you-help-with-my-code-pls/#findComment-770955 Share on other sites More sharing options...
Jas Posted February 25, 2009 Author Share Posted February 25, 2009 Ok so no help- how would I write the following in the below code please:(($quiz < 10 AND plan_type = 'a') OR ($quiz > 10 AND plan_type = 'b'))")); I want to add the quiz 26 for plan_type ="a" in the above. Any help would be great Link to comment https://forums.phpfreaks.com/topic/146846-can-you-help-with-my-code-pls/#findComment-771195 Share on other sites More sharing options...
Jas Posted February 25, 2009 Author Share Posted February 25, 2009 there must be someone who can help me write that code :'( Link to comment https://forums.phpfreaks.com/topic/146846-can-you-help-with-my-code-pls/#findComment-771202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.