本文整理汇总了PHP中sql_q函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_q函数的具体用法?PHP sql_q怎么用?PHP sql_q使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_q函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
<?php
header("Content-Type:application/json; ");
require_once('loader.php');
$ans = sql_q("SELECT * FROM post WHERE post_no=? " ,array($_POST['post_no']));
$sum = array('map'=>$ans);
echo json_encode($sum);
示例2: calendar
if(!empty($_GET['rest_day3'])){$rest3 = reverseDate($_GET['rest_day3']);}
if(!empty($_GET['rest_day4'])){$rest4 = reverseDate($_GET['rest_day4']);}
if(!empty($_GET['rest_day5'])){$rest5 = reverseDate($_GET['rest_day5']);}
//работен ден
if(!empty($_GET['work_day'])){$work1 = reverseDate($_GET['work_day']);}
if(!empty($_GET['work_day2'])){$work2 = reverseDate($_GET['work_day2']);}
if(!empty($_GET['work_day3'])){$work3 = reverseDate($_GET['work_day3']);}
if(!empty($_GET['work_day4'])){$work4 = reverseDate($_GET['work_day4']);}
if(!empty($_GET['work_day5'])){$work5 = reverseDate($_GET['work_day5']);}
//основание
if(!empty($_GET['reason'])){$reason1 = $_GET['reason'];}
if(!empty($_GET['reason2'])){$reason2 = $_GET['reason2'];}
if(!empty($_GET['reason3'])){$reason3 = $_GET['reason3'];}
if(!empty($_GET['reason4'])){$reason4 = $_GET['reason4'];}
if(!empty($_GET['reason5'])){$reason5 = $_GET['reason5'];}
$sql = "INSERT INTO calendar(year, extra_work_day, extra_not_work_day, reason)";
if($_GET['check1'] == 1){$sql .= " VALUES('$year1','$work1','$rest1','" . urldecode($reason1) . "')";}
if($_GET['check2'] == 2){$sql .= ", ('$year2','$work2','$rest2','" . urldecode($reason2) . "')";}
if($_GET['check3'] == 3){$sql .= ", ('$year3','$work3','$rest3','" . urldecode($reason3) . "')";}
if($_GET['check4'] == 4){$sql .= ", ('$year4','$work4','$rest4','" . urldecode($reason4) . "')";}
if($_GET['check5'] == 5){$sql .= ", ('$year5','$work5','$rest5','" . urldecode($reason5) . "')";}
$res = sql_q($sql) or die(mysql_error());
if($res){
echo "good";
}else{
echo "bad";
}
?>
示例3: sql_q
<?include("../inc/conf.php");;
if (isset($_GET['asoc_id'])) $asoc_id=$_GET['asoc_id'];
if (isset($_GET['attach_id'])) $attach_id=$_GET['attach_id'];
//if (isset ($_GET['ans_id'])) $ans_id=$_GET['ans_id'];
$rows=mysql_fetch_array(sql_q("SELECT * FROM attached_files WHERE asoc_id='".$_GET['asoc_id']."' AND attach_id = ".$attach_id));
if (is_file($path.$rows['attach_dir'].$rows['attach_filename']))
{
// unlink($path.$rows['attach_dir'].$rows['attach_filename']);
// $sql = "DELETE FROM attached_files WHERE asoc_id=".$asoc_id." AND attach_id = ".$attach_id;
$sql = "UPDATE attached_files SET dell_flag=1 WHERE asoc_id=".$asoc_id." AND attach_id = ".$attach_id;
$res = sql_q($sql);
//$res1=sql_q("UPDATE answers SET attach_id = 0 WHERE attach_id = '".$attach_id."' AND ans_id='".$ans_id."' ");
$delete_flag = 1;
}
else
$delete_flag = 0;
echo $delete_flag;
?>
示例4: sql_q
else {
sql_q("INSERT INTO accounts_municipality (id_accounts, name_accounts, number, iban, bic, bank_name, bank_branch, bank_address, status, main) VALUES('NULL', '$name_accounts', '$number', '$iban', '$bic', '$bank_name', '$bank_branch', '$bank_address', '$status', '$main')");
}
if ($main ==1)
{
sql_q("UPDATE accounts_municipality SET main=0 WHERE id_accounts!='$id_accounts'");
}
?>
<script language="JavaScript">
window.close();
window.opener.location.href="Accounts.php";
</script>
<?
}
$result = sql_q("SELECT * FROM accounts_municipality WHERE id_accounts = '$id_accounts'");
$row = mysql_fetch_array($result);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Language" content="bg">
<title>Сметки</title>
<script language="JavaScript" src="JFunctions.js"></script>
</head>
<body background="Images/Stone.jpg" onload="fgroups_data.name.focus()">
<form name="faccounts_data" action="Accounts_data.php?edit_flag=<?=$_GET['edit_flag']?>" method="post">
<table width="100%" height="100%">
<tr valign="top">
示例5: sql_q
<?php
header("Content-Type:text/html; charset=utf-8");
require_once('loader.php');
$sql = "SELECT * FROM `rank` WHERE ac_no =? AND se_no =?";
$ans = sql_q( $sql,array( $_POST['ac_no'],$_POST['se_no']) );
if( count($ans)>0 )
echo json_encode($ans);
else
echo json_encode('未按過評分 !');
示例6: json_decode
array_push( $sql_arr,$url[$i]['showInfo'][0]['location'].$url[$i]['showInfo'][0]['locationName'] );
sql_i($sql,$sql_arr);
echo 'Success !! ';
}
}else{
echo 'Error !! ';
}
}
break;
// parent= 親子活動
//999找到相同陣列不要新增
//998沒有找到相同陣列繼續新增
case 'parent':
$url = json_decode(file_get_contents( "http://cloud.culture.tw/frontsite/trans/SearchShowAction.do?method=doFindTypeJ&category=4" ),true);
$sql_s = "SELECT title FROM data";
$dt = sql_q($sql_s,array());
$sql = "INSERT INTO data (d_no,title,content,lng,lat,type,stime,etime,note,category,address) VALUES (?,?,?,?,?,?,?,?,?,?,?)";
for ($i=0; $i < count($url); $i++) {
if($url[$i]['descriptionFilterHtml']==''){
$pro='999';
}else{
$pro='998';
}
if($pro!='999'){
if(count($url[$i]['showInfo'])!='1'){
for ($y=0; $y < count($url[$i]['showInfo']); $y++) {
$sql_arr = array();
array_push( $sql_arr,'null' );
array_push( $sql_arr,$url[$i]['title'] );
array_push( $sql_arr,$url[$i]['descriptionFilterHtml'] );
array_push( $sql_arr,$url[$i]['showInfo'][$y]['longitude'] );
示例7: sql_q
sql_q("Update municipality set placement ='{$placement}' where placement ='-1'");
sql_q("Update users set placement='{$placement}' where placement=''");
}
?>
<html>
<head><title>Избор на главна община</title></head>
<body>
<form method="post" name="kingdom" action="">
<table><th>Посочете общинския център:</th>
<tr>
<td>
<input type="hidden" name="place_hidd" id="place_hid" />
<select name="placement" id="placement">
<?php
$naselm = "SELECT * FROM elements WHERE nom_code ='06' ORDER BY cod_cod ASC";
//Petko Mihailov-programist Dobaveno vuv vruzka na kasieri s naseleni mesta
$get_code_name = sql_q($naselm);
while ($row2 = mysql_fetch_array($get_code_name)) {
echo "<option value ='" . $row2['cod_cod'] . "'" . $selected . ">" . $row2['cod_name'] . "</option>";
}
?>
</select>
</td><td><input type="submit" value="Запис" name="save" onclick="window.close(); "/></td>
</tr>
</table>
</form>
</body>
</html>
示例8: COUNT
<!--<input type="image" src="Images/RightsUp.gif" onmouseout="this.src='Images/RightsUp.gif'" onmouseover="this.src='Images/RightsDown.gif'" onclick="alert('Правата все още са в процес на разработка!!!'); return false;">-->
<br><br><br><br>
Покажи:
<br><br>
<?
$sql_active = "SELECT COUNT(status)
FROM users
WHERE status = '1'";
$sql_unactive = "SELECT COUNT(status)
FROM users
WHERE status = '0'";
$sql_all = "SELECT COUNT(status)
FROM users";
$res_active = sql_q($sql_active) or die(mysql_error());
$res_unactive = sql_q($sql_unactive) or die(mysql_error());
$res_all = sql_q($sql_all) or die(mysql_error());
$row_active = mysql_fetch_assoc($res_active);
$row_unactive = mysql_fetch_assoc($res_unactive);
$row_all = mysql_fetch_assoc($res_all);
?>
<input type="radio" name="all" id="active" value="1" <? if ($all==1) echo "checked"?> onclick="fusers.submit();">
<label for="active">
Активни
<font color="red"><?php
echo $row_active['COUNT(status)'];
?>
</font>
</label>
<br>
<input type="radio" name="all" id="unactive" value="0" <?if ($all==0) echo "checked"?> onclick="fusers.submit();">
<label for="unactive">
示例9: header
<?php
header("Content-Type:application/json; ");
require_once('loader.php');
$x = ($_POST['lat_1']+$_POST['lat_2'])/2;
$y = ($_POST['lng_1']+$_POST['lng_2'])/2;
$sql = "SELECT *, ( ? * acos( cos( radians(?) ) * cos( radians( lng ) ) *
cos( radians( lat ) - radians(?) ) +
sin( radians(?) ) * sin( radians( lng ) ) ) ) AS distance
FROM data HAVING distance < 10";
$ans = sql_q( $sql ,array('6371',$y,$x,$y) );
$sum = array('map'=>$ans);
echo json_encode($sum);
示例10: sql_q
?>
, <?php
echo $flag;
?>
)">
<table style="width:100%;">
<?
$result = sql_q("SELECT * FROM attached_files WHERE asoc_id = '".$asoc_id."' AND dell_flag=0 ORDER BY attach_timestamp");
$html_options = "Прикачен файл: <a href='".$url.$row['attach_dir'].$row['attach_filename']."' target='_blank'>".$row['attach_filename']."</a>";
echo "<tr><td style='width:20%;' class='header'>Дата/час:</td>
<td style='width:15%;' class='header'>Прикачил:</td>
<td style='width:55%;' class='header'>Файл:</td>
<td style='width:10%;' class='header'>Размер:</td>
<td style='width:10%;' class='header'> </td>";
while ($row=mysql_fetch_array($result)){
$full_name=mysql_fetch_array(sql_q("SELECT full_name FROM users WHERE id='".$row['uploader_id']."'"));
$filesize_in_KB= (int)(($row['filesize'])/1024);
$filesizepr = $filesize_in_KB;
$text = ' KB';
if($filesize_in_KB > 1024){
$filesizepr = (int) ($filesizepr/1024);
$text = ' MB';
}
echo "<tr><td style='width:20%;' class='content'>";
echo $row['attach_timestamp'];
echo "</td>";
echo "<td style='width:15%;' class='content'>".$full_name[0]."</td>";
echo "<td style='width:55%;' class='content'>";
if ($user_workorhome==1)
{ echo "<a href='".$url2.$row['attach_dir'].$row['attach_filename']."' target='_blank'>".$row['attach_filename']."</a>";
示例11: sql_q
case 6:
case 7:
case 8:
sql_q("DELETE FROM single_payments WHERE invoice_id = '{$invoice_id}'");
sql_q("DELETE FROM townsfolk_less WHERE invoice_id = '{$invoice_id}'");
break;
}
}
}
} else {
if ($_POST['home_x']) {
echo "<script language='JavaScript'> top.main_window.location.href='Index.html'; </script>";
}
}
$query = "SELECT invoice_id, payee_mode, payee_identify, doc_state,\n date_format(doc_date, '%d-%m-%Y'), total_amount, pay_mode\n FROM invoices\n WHERE doc_state IN (1, 4)\n AND number = '0' AND date = '0000-00-00'\n AND doc_date BETWEEN '{$from_date}' AND '{$to_date}' \n AND invoice_id NOT IN (SELECT invoice_id FROM rkk WHERE invoice_id>0)\n ORDER BY invoice_id ASC";
$result = sql_q($query);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Language" content="bg">
<script language="JavaScript" src="JFunctions.js"></script>
</head>
<body background="Images/Stone.jpg">
<form name="fsingle_invoices" method="post">
<input type="hidden" name="from_date" value="<?php
echo $from_date;
?>
">
<input type="hidden" name="to_date" value="<?php
示例12: require_once
<?php
require_once('../loader.php');
$sql = "SELECT * FROM accounts WHERE account=? AND password=?";
$profile = sql_q( $sql, array( $_POST['account'],$_POST['password'] ));
if( count($profile)>0 ){
$_SESSION['account'] = $profile[0]['account'];
$_SESSION['name'] = $profile[0]['name'];
$_SESSION['level'] = $profile[0]['level'];
echo "<script language=javascript>
alert('Login Success!!');
window:location.href='./main.php';
</script>";
}else{
echo "<script language=javascript>
alert('Login Fail!!');
window:location.href='./index.php';
</script>";
}
示例13: Interest_calc
function Interest_calc($year, $month, $contr_id, $date, $flag){
if ($flag==1){
$query=sql_q("select point_interest_percent from municipality");
$row=mysql_fetch_row($query);
$points=$row[0];
$query=sql_q("select * from bnb");
while ($row=mysql_fetch_row($query)){list($key, $val)= $row;$array_interest_rate[$key]=$val;}
$query=sql_q("select month_debt, interest_debt, interest_pay from balances where contr_id=".$contr_id." and year=".$year." and month= ".$month);
$row=mysql_fetch_array($query);
$month_balance=$row['month_debt'];
$interest_debt=round($row['interest_debt'],2);
$interest_pay=$row['interest_pay'];
$pad_date=GetPadDate($year, $month, $contr_id);
$query=sql_q("select count(i.invoice_id) from invoices as i, month_payments as m
where i.invoice_id=m.invoice_id and doc_id=".$contr_id." and m.year=".$year." and m.month=".$month.
" and i.doc_state in (3,7)");
$row=mysql_fetch_row($query);
$count=$row[0];
if ($count!=0){
$query=sql_q("select i.invoice_id, i.doc_date, m.amount from invoices as i, month_payments as m
where i.invoice_id=m.invoice_id and doc_id=".$contr_id." and m.year=".$year." and m.month=".$month." order by doc_date");
$row=mysql_fetch_array($query);
$doc_date= format_date($row['doc_date']);
$date_begin=$pad_date;
if ($row['doc_date']>=format_date($date_begin)){
$intervals[0]=$date_begin.'#'.$doc_date.'#'.$month_balance.'#'.$month_balance.'#0.00';
$date_begin= $doc_date;
if (($month_balance - $row['amount'])<0){$month_balance=0.00;} else {$month_balance=$month_balance - $row['amount'];}
}
else{
$intervals[0]=$doc_date.'#'.$date_begin.'#0.00#'.$month_balance.'#'.$row['amount'];
if (($month_balance - $row['amount'])<0){$month_balance=0.00;} else {$month_balance=$month_balance - $row['amount'];}
}
for ($i=1; $i<=$count; $i++){
if ($i==$count){
$date_end=$date;
$intervals[$i]=$date_begin.'#'.$date_end.'#'.$month_balance;
}
else {
$row=mysql_fetch_array($query);
if ($row['doc_date']>=format_date($date_begin)){
$doc_date= format_date($row['doc_date']);
$intervals[$i]=$date_begin.'#'.$doc_date.'#'.$month_balance.'#'.$month_balance.'#'.$row['amount'];
$intervals_bufer[$i+1]=$intervals[$i];
$date_begin = $doc_date;
if (($month_balance - $row['amount'])<0){$month_balance=0.00;} else {$month_balance=$month_balance - $row['amount'];}
}
else{
$doc_date= format_date($row['doc_date']);
$intervals[$i]=$doc_date.'#'.$date_begin.'#0.00#'.$month_balance.'#'.$row['amount'];
if (($month_balance - $row['amount'])<0){$month_balance=0.00;} else {$month_balance=$month_balance - $row['amount'];}
}
}
}
$interest=array();
for ($i=0;$i<=$count;$i++){
$split=split('[#]',$intervals[$i]);
$split_bufer=split('[#]',$intervals_bufer[$i]);
$difference=$split[3]-$split[4];
$diff_bufer=$split_bufer[3]-$split_bufer[4];
$interest[$i]=GetInterest($split[0],$split[1],$split[2] ,$array_interest_rate, $points,$flag);
if (is_string($interest[$i])){$interest=array();break;}
}
if (!(empty($interest))){
$array[0]= array_sum($interest);
if ($array[0] <= $interest_pay) {$array[0] = $interest_pay;}
}
}
else {$array[0]=GetInterest($pad_date,$date,$month_balance ,$array_interest_rate, $points,$flag);}
$array[1]=$pad_date;
$array[2]=$interest_debt;
$array[3]=$interest_pay;
return $array;
}
else{// Флаг != 1 представя функцията с визуализиращи редове
$query=sql_q("select point_interest_percent from municipality");
$row=mysql_fetch_row($query);
$points=$row[0];
$query=sql_q("select * from bnb");
while ($row=mysql_fetch_row($query)){list($key, $val)= $row;$array_interest_rate[$key]=$val;}
$query=sql_q("select month_debt, interest_debt, interest_pay from balances where contr_id=".$contr_id." and year=".$year." and month= ".$month);
$row=mysql_fetch_array($query);
$month_balance=$row['month_debt'];
$interest_debt=round($row['interest_debt'],2);
$interest_pay=$row['interest_pay'];
$pad_date=GetPadDate($year, $month, $contr_id);
$query=sql_q("select count(i.invoice_id) from invoices as i, month_payments as m
where i.invoice_id=m.invoice_id and doc_id=".$contr_id." and m.year=".$year." and m.month=".$month.
" and i.doc_state in (3,7)");
$row=mysql_fetch_row($query);
$count=$row[0];
//echo ' Платени фактури за месец '.NameOfMonth($month).' '.$year.' год. : <b>'.$count.'</b><br>----------------------------------------------------------------<br>';
if ($count!=0){
$query=sql_q("select i.invoice_id, i.doc_date, m.amount from invoices as i, month_payments as m
where i.invoice_id=m.invoice_id and doc_id=".$contr_id." and m.year=".$year." and m.month=".$month." order by doc_date");
$row=mysql_fetch_array($query);
$doc_date= format_date($row['doc_date']);
$date_begin=$pad_date;
if ($row['doc_date']>=format_date($date_begin)){
$intervals[0]=$date_begin.'#'.$doc_date.'#'.$month_balance.'#'.$month_balance.'#'.$row['amount'];
//.........这里部分代码省略.........
示例14: sql_q
<?php
include "../../inc/conf.php";
if ($_POST['delete_x']) {
$id = $_POST['data'];
sql_q("DELETE FROM mayors WHERE id = '{$id}'");
// sql_q("DELETE FROM group_users WHERE user_id = '$user_id'");
}
//else if ($_POST["home_x"]) {
// echo "<script language='JavaScript'> top.main_window.location.href='.php'; </script>";
// }
$result = sql_q("SELECT ifmayor FROM municipality;");
$row = mysql_fetch_array($result);
$res_ifmayor = sql_q("SELECT * FROM elements WHERE nom_code = '66' and cod_cod='" . $row['ifmayor'] . "'");
$row_ifmayor = mysql_fetch_assoc($res_ifmayor);
$ifmayor = $row_ifmayor['cod_name'];
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Language" content="bg">
<title>Данни - <?php
echo $ifmayor;
?>
</title>
<script language="JavaScript" src="../JFunctions.js"></script>
</head>
<body background="../Images/Stone.jpg" scroll="no">
<form name="fmayors" action="Mayors.php" method="post">
示例15: sql_q
$max = $_POST['max_function_id'] + 1;
for ($i = 1; $i < $max; $i++) {
if ($_POST['function_id' . $i] == 'on') {
sql_q("INSERT INTO permissions (id, module_id, group_id, function_id, read_access) VALUES('NULL', '{$module_id}', '{$group_id}', '{$i}', 'Y')");
}
}
$max = $_POST['min_permission_id'];
$max = $_POST['max_permission_id'] + 1;
for ($i = $min; $i < $max; $i++) {
if ($_POST['permission_id' . $i] == 'on') {
sql_q("DELETE FROM permissions WHERE id = '{$i}'");
}
}
}
$functions_id = array();
$result = sql_q("SELECT f.function_id FROM functions f, permissions p\n WHERE f.module_id = p.module_id AND f.function_id = p.function_id\n AND f.status = '1' AND p.group_id = '{$group_id}' AND f.module_id = '{$module_id}'");
while ($row = mysql_fetch_array($result)) {
array_push($functions_id, $row['function_id']);
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<meta http-equiv="Content-Language" content="bg">
<title>Права</title>
<script language="JavaScript" src="JFunctions.js"></script>
</head>
<body background="Images/Stone.jpg" scroll="yes">
<form name="fgroup_permissions" action="GroupPermissions.php?group_data=<?php