本文整理汇总了PHP中mysql::query_assoc方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::query_assoc方法的具体用法?PHP mysql::query_assoc怎么用?PHP mysql::query_assoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::query_assoc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_insert_query
function generate_insert_query($query)
{
preg_match("/FROM (.*?) /i", $query, $matches);
$table = $matches[1];
preg_match("/WHERE (.*) LIMIT/i", $query, $matches);
$where = $matches[1];
$query2 = "SELECT * FROM " . $table . " WHERE " . $where;
$row = mysql::query_assoc($query2);
foreach ($row as $key => $value) {
$values[] = "{$key}=\"{$value}\"";
}
$values2 = implode(", ", $values);
$insert = "INSERT INTO " . $table . " VALUES (" . $values2 . ")";
$insert2 = addslashes($insert);
$query3 = "INSERT INTO undo set query=\"{$insert2}\"";
// mysql::query_no_result($query3);
echo "insert query: <br>{$insert}";
exit;
}
示例2: json_encode
<?php
require 'mysql.php';
//Se instancia la clase en la variable $main
$main = new mysql();
$poll = $_POST["poll"];
$consult = "SELECT contenido FROM encuestas WHERE poll = '{$poll}'";
$res = $main->query_assoc($consult);
echo json_encode($res);
示例3: json_encode
<?php
require 'mysql.php';
$main = new mysql();
$consult = "SELECT DISTINCT C.poll FROM encuestas C";
echo json_encode($main->query_assoc($consult));
示例4: json_encode
<?php
require '../mysql.php';
$main = new mysql();
$con = "SELECT COUNT(*) FROM colonias";
$count = $main->query_assoc($con);
$Npags = $count[0]["COUNT(*)"] / 10;
$Npags = round($Npags);
$Npags = $Npags + 1;
$Npags = array('Npags' => $Npags);
$num = $_POST["num"];
if ($num != 0) {
$num--;
}
$num = $num * 10;
$consult = "SELECT * FROM colonias LIMIT {$num}, 10";
$res = $main->query_assoc($consult);
array_push($res, $Npags);
echo json_encode($res);
//echo json_encode($count);