php - 查询一个 MySQL 表并将结果插入另一个表
问题描述
这是我的注释代码。
//Query the good_keywords table & pick one result at random
$result4 = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * from `good_keywords` ORDER BY RAND() LIMIT 1,1");
while($rows4=mysqli_fetch_array($result4)){
$tagline = $rows4['keyword'];
}
if (mysqli_num_rows($result4) > 0) {
/*Insert the one result obtained from the earlier query into `tran_term_taxonomy`.`description` provided that `tran_term_taxonomy`.`description` is empty & `tran_term_taxonomy`.`taxonomy` is 'post_tag'*/
$result2 = mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE `tran_term_taxonomy` SET `description` = '{$tagline}' WHERE `tran_term_taxonomy`.`taxonomy` = 'post_tag' AND `tran_term_taxonomy`.`description` = "" LIMIT 1");
echo $tagline;
}
我面临的问题是当我运行此代码时页面甚至没有加载并且没有错误消息。我的代码有什么问题以及如何解决?
谢谢。
解决方案
像这样的东西...
UPDATE tran_term_taxonomy x
CROSS
JOIN good_keywords y
SET x.description = y.keyword
WHERE x.taxonomy = 'post_tag'
AND x.description = ""
ORDER
BY RAND() LIMIT 1,1
推荐阅读
- python - Pandas 不会读取带有“xls”扩展名的 Excel XML 2003 文件
- python - 如何自动将变量传递出函数?如何将变量从内部传递到外部范围?
- delphi - 如何通过 TIdIMAP4 使用非 ASCII 字符搜索电子邮件的 SUBJECT 或 BODY
- javascript - 输出未显示(反应)?
- python - Python按字符串值排序字典
- http - golang http客户端和服务器无法保持可靠连接
- python - 如何从 DataFrame 上的一行中获取数据
- c# - Entity Framework : setting value converter for type generically, including TPH types
- java - Address binding issue - Remote Debugging of Maven Application
- c# - Getting Error 400 When Calling A Web Api Method Using Ajax