Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

allphp

1. job.php
-------------------------------------------------------------------------------------------------

$dbname = "2216189_db";
$user = "2216189_db";
$pass = "[email protected]";
$servername = "fdb14.awardspace.net";

// Create connection
        $con =  mysqli_connect($servername,$user,$pass,$dbname);

$filter_field = isset($_GET['filter']) ? $_GET['filter'] : 10; //10 is the default

$sql = "SELECT * FROM job ORDER BY ".$filter_field;

$sql = "SELECT * FROM job ORDER BY salary";

$result  = array();

$ro = $con->query($sql);

if ($ro->num_rows > 0) {

while($row = $ro->fetch_assoc()) {

$date = new DateTime($row["last_date"]);
$res_date = $date->format('Y-m-d H:i:s');

$res[] = array("job_id" => $row["job_id"],"job_name" => $row["job_name"],"place" => $row["place"],"salary" => $row["salary"],"qualification" => $row["qualification"],"last_date" => $res_date);
}

} else {
echo "0 results";
}

$json = array("job12" => $res);

$con->close();

/* Output Header */
header('Content-type: application/json');
echo json_encode($json);

2. question_cat.php
--------------------------------------------
$dbname = "2216189_db";
$user = "2216189_db";
$pass = "[email protected]";
$servername = "fdb14.awardspace.net";

// Create connection
       $con =  mysqli_connect($servername,$user,$pass,$dbname);

   // Check connection

$sql = "SELECT * FROM questions_categories";
$ro = $con->query($sql);

if ($ro->num_rows > 0) {

while($row = $ro->fetch_assoc()) {
$result[] = array("cat_id" => $row["cat_id"], "catname" => $row["subjects"]);
}

} else {
echo "0 results";
}

$json = array("categoryname" => $result);

$con->close();

/* Output Header */
header('Content-type: application/json');
echo json_encode($json);


?>


3. report_question.php
--------------------------------------------------------------


$dbname = "2216189_db";
$user = "2216189_db";
$pass = "[email protected]";
$servername = "fdb14.awardspace.net";

// Create connection
        $con =  mysqli_connect($servername,$user,$pass,$dbname);

/* soak in the passed variable or set our own */
$cat_name = isset($_GET['cat_name']) ? $_GET['cat_name'] : 10; //10 is the default
$question  = isset($_GET['question']) ? $_GET['question'] : 10; //10 is the default
$complain  = isset($_GET['complain']) ? $_GET['complain'] : 10; //10 is the default

$sql = "INSERT INTO `Reported_Question` (cat_name, question, complain) VALUES                        ('$cat_name', '$question', '$complain')";

if(mysqli_query($con, $sql)){
echo "Records inserted successfully.";
}else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($con);
}
$con->close();
?>

4. fetch_question.php
------------------------------------------------------------


$dbname = "2216189_db";
$user = "2216189_db";
$pass = "[email protected]";
$servername = "fdb14.awardspace.net";

// Create connection
        $con =  mysqli_connect($servername,$user,$pass,$dbname);

$myArray = explode(',', $_GET['myData']);

$size = isset($_GET['size']) ? $_GET['size'] : 10;

for ($i = 0; $i    $resultOuter[] = $myArray[$i];
}

$resultOuter = array();

for ($i = 0; $i
$sql = "SELECT * FROM ".$myArray[$i];

$ro = $con->query($sql);

if ($ro->num_rows > 0) {

$result = array();

while($row = $ro->fetch_assoc()) {

$result[] = array("question_id" => $row["question_id"], "question" =>               $row["question"], "question" => $row["question"]
, "option1" => $row["option1"], "option2" => $row["option2"], "option3" => $row["option3"],"answer" => $row["answer"], "answer_f" => $row["option4"]);

}
     $resultOuter[$i]= array("questions" => $result);

} else {
echo "0 results";
}
}

$json = array("question_json" => $resultOuter);

$con->close();

/* Output Header */
header('Content-type: application/json');
echo json_encode($json);
?>



This post first appeared on Unity Coroutine, please read the originial post: here

Share the post

allphp

×

Subscribe to Unity Coroutine

Get updates delivered right to your inbox!

Thank you for your subscription

×