我正在使用多个查询并且工作正常,我面临的唯一问题是订单不起作用。我试过像
这样的代码$query = "SELECT id, name, reg_number, class, section FROM register where id IS NOT NULL ORDER BY `id` DESC";
它在phpmyadmin中正常工作并给我一个合适的结果。但它不适用于我想要使用它的地方。
$query = "SELECT id, name, reg_number, class, section FROM register where id IS NOT NULL ";
if ( $name !="" ){
$query .= " AND `name` LIKE '".$name."%'"; // id is greater then
}
if ( $status !="" ){
$query .= " AND `status` LIKE '".$status."%'"; // id is greater then
}
if ( $id_from !="" ){
$query .= " AND id >= $id_from "; // id is greater then
}
if ( $id_to !="" ){
$query .= " AND id <= $id_to "; // id is shorter then
}
if ( $class !="" ){
$query .= " AND class IN($class)"; // Selecting class
}
if ( $section !="" ){
$query .= " AND section IN($section)"; // selecting section
}
$result = mysql_query($query);
我想在此查询中使用order by,但order by无法使用此功能。
$query = "SELECT id, name, reg_number, class, section FROM register where id IS NOT NULL ORDER BY `id` DESC";
还使用了
$query = "SELECT id, name, reg_number, class, section FROM register where id IS NOT NULL ORDER BY id DESC";
我不知道我的代码有什么问题。
答案 0 :(得分:3)
完成geocoder = new google.maps.Geocoder();
window.getCoordinates = function (address, callback) {
var coordinates;
geocoder.geocode({ address: address}, function (results, status) {
coords_obj_lat = results[0].geometry.location.lat();
coords_obj_lng = results[0].geometry.location.lng();
coordinates = [coords_obj_lat,coords_obj_lng];
callback(coordinates);
})
}
后,只需添加ORDER BY
:
WHERE