-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax.php
More file actions
31 lines (29 loc) · 780 Bytes
/
ajax.php
File metadata and controls
31 lines (29 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
require_once("common.inc.php");
if(isset($_POST['addSelect'])){
$subject = ereg_replace("[^A-Za-z0-9]", "", $_POST['addSelect']); //clean up post string
$sql = "INSERT INTO `musefis_story`.`subject` (`ID`, `Subject_name`) VALUES (NULL, '%s')";
$q = sprintf($sql,$subject);
// $q = mysql_real_escape_string($q);
$result = $db->run_query($q);
echo $result;
// $id = $db->get_id;
if (!$result) {
die('Invalid query: ' . mysql_error());
}else{
echo $result;
}
exit;
}
if(isset($_POST['retrieve_word_list'])){
$s = $_POST['s'];
$p = $_POST['p'];
$words = $db->fetch_array("SELECT word FROM words WHERE `subject_id` = $s AND `word_part_id` = $p order by word asc");
$i=0;
do{
echo ($words[$i]['word'])."<br />";
$i++;
}while($i<count($words));
exit;
}
?>