doumeinuoye81969 2017-03-09 17:48
浏览 7

SQL:获取所有链接,价格和合作? - 包含价格

I have a WordPress site and use Advanced Custom Fields. Now I want to get all values from a specified post (post_id). But my problem is that the plugin saves the values in "repeaters". So, if I have 3 prices for one post, I also have 3 different links to the product and 3 different shops.

My problem is that I do not know, if I make a SQL query, how many fields I have. I just know that the fields are called like this:

  • product_shops_0_price
  • product_shops_1_price
  • product_shops_2_price
  • and so so... with link, shops and everything else.

My question now is, what is the best way to get all values with a SQL query? - I do know the post ID. So all postmetas I get returned by where post_id = '$pid' belongs to this post. But how do I get all prices, links and shops if I do not know how many there are?

EDIT: I do not have a problem to code my script. So, yet there is no code written. And that because I do not know how to select values with a SQL query. Here you can see a example of the postmetas from one post. This is just a snippet of 134 entries for this post.

My problem is, I do not know how I can register variable how many price, link and shop entries I have per post. Because some posts just contains 2 links, shops and prices, and some other posts contains 5 prices, links and shops.

enter image description here

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用
    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?