Jump to content

Can you help with my code pls


Jas

Recommended Posts

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

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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.