gpt4 book ai didi

php - 这行不通?有什么建议么?

转载 作者:行者123 更新时间:2023-11-29 09:02:33 25 4
gpt4 key购买 nike

我正在编写这个脚本来对音乐进行评分,没有错误,并且我收到“已插入数据”,我知道我还没有转义数据,但是有没有该脚本中的问题可能会阻止其将插入的数据放入数据库?

 <?
include($_SERVER['DOCUMENT_ROOT'].'/assets/global/scripts/connect.php');
$songname = $_GET['songname'];
$artist = $_GET['artist'];
$ratenum = 1;
$chkquery = "SELECT * FROM hotmuze_music WHERE songname='$songname'";
$plusOneQuery = "SELECT * FROM hotmuze_music WHERE songname='$songname'";
$updateQuery = "UPDATE hotmuze_music SET rating='$rating2' WHERE songname='$songname'";
$checkdata = mysql_query($chkquery);
$checkrows = mysql_num_rows($checkdata);
if($checkrows==0)
{
$insquery = "INSERT INTO hotmuze_music (id, songname, artist, sex, genre, rating, promoted) VALUES('', '$songname', '$artist', '', '$genre' '$ratenum')";
$insdata = mysql_query($insquery);
}


if($checkrows!=0)
{
$plusData = mysql_query($plusOneQuery);
}

if(mysql_num_rows($plusData)!=0)
{
$result = mysql_fetch_assoc($plusData);
$rating = $result['ratng'];
$rating2 = $rating+1;
mysql_query($updateQuery);
echo "Data Inserted";
}
?>

谢谢! :)

最佳答案

您错过了逗号,以及升级字段的值,请尝试:

$insquery = "INSERT INTO hotmuze_music (id, songname, artist, sex, genre, rating, promoted) VALUES('', '$songname', '$artist', '', '$genre', '$ratenum', '$promoted')";

关于php - 这行不通?有什么建议么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8177587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com