Jump to content

need your help pls


Jas

Recommended Posts

Hello,

 

I have a few labelled tests/quizzes... but the way my code is written it is not being picked up in the right area:

 

I have a test id:26 which should be part of plan a and not b.

 

The current code is as :

(($quiz < 10 AND plan_type = 'a') OR ($quiz > 10 AND plan_type = 'b'))"));

 

As you can see the plan_a excludes the 26 test ID and puts that in plan_b...

 

How can I add 26 to the code so it is recognised as plan-a..

 

Thanks in advance

 

Jas

Link to comment
https://forums.phpfreaks.com/topic/146914-need-your-help-pls/
Share on other sites

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");

  }

 

?>

Link to comment
https://forums.phpfreaks.com/topic/146914-need-your-help-pls/#findComment-771310
Share on other sites

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.