mysql没没有order by_“ORDER BY FIELD”MySQL似乎没有工作

博客内容涉及一个关于MySQL查询的问题,作者在尝试根据特定顺序('People-WeddingPhoto','People-Kids',...)对数据表中'type'字段进行排序,但结果出现错误,顺序不正确。代码中使用了FIELD函数来指定排序顺序,然而仍然遇到了随机排序的错误。
摘要由CSDN通过智能技术生成

长话短说,我的字段顺序似乎不适合我的MySQL调用。我无法在存储中找到模式...

$ theorder正确设置为

, 'People-Wedding Photo', 'People-Kids', 'People-Male/Female', 'Architecture-Exterior', 'Architecture-Interior', 'Animal-Birds', 'Backgrounds'这是我的代码。正如你所看到的,我正在循环,做我的格式转换....但我仍然得到一个错误的顺序...一个随机命令....

有什么我失踪?

$under_link_query = mysql_query("SELECT DISTINCT(type), type FROM ".$prefix."ProFolio_work WHERE type != 'Backgrounds' ORDER BY FIELD(type" . $theorder .")");

while($u_row = mysql_fetch_assoc($under_link_query)){

$type = html_entity_decode($u_row['type']);

$typeForm = preg_replace('/[^a-z0-9]/i', '_', $type);

?>

echo ucfirst($type); ?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值