简体   繁体   English

如何自动从数据库中获取最新的元ID

[英]how do i get the latest meta id from database automatically

i was trying to convert text into image with php. 我试图用PHP将文本转换为图像。 Now i've finished it but the script is still getting the image data manually here is the query code : 现在我已经完成了,但脚本仍在手动获取图像数据,这是查询代码:

    $host = "localhost";
$user = "root";
$pass = "root";
$db   = "rc";

$connect=mysql_connect($host,$user,$pass) or die ("failed to connect") ;
$connect_db= mysql_select_db($db,$connect);

$grab = mysql_query('SELECT * FROM wp_woocommerce_order_itemmeta WHERE meta_id="4980"');
$d = mysql_fetch_array($grab);
$meta = $d["meta_value"];

in this script i use ('SELECT * FROM wp_woocommerce_order_itemmeta WHERE meta_id="4980"') which manually get the meta_id from database and if i want to convert another text to image i should change the meta_id="4980" to another meta_id my question is how do i get the latest meta_id automatically from database ? 在这个脚本中,我使用('SELECT * FROM wp_woocommerce_order_itemmeta WHERE meta_id="4980"')从数据库手动获取meta_id,如果我想将另一个文本转换为图像我应该将meta_id="4980"更改为另一个meta_id我的问题我如何从数据库中自动获取最新的meta_id any help will be very appreciated 任何帮助将非常感激

使用查询

SELECT * FROM wp_woocommerce_order_itemmeta order by meta_id desc limit 1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM