php sql语法出问题了

2024-12-02 06:54:52
推荐回答(4个)
回答1:

$sqlstr1 = "insert into wiki.wiki_doc (authorid) values('".$creatorid."') where title='".$newtitle."' and content = '". $newcontent."'" ;

php 字符串与变量连接要用 .号
如果是写sql语句的话,
如果变量为字符旁肆串,则需要用单引号引茄神住 即: $sql = "select * from aa where id='".$id."'"颤启亏;
数字则不需要 。即: $sql = "select * from aa where id=".$id;

回答2:

楼上都绝拿是错的
正轿桐确的并帆搭:$sqlstr1="insert into wiki.wiki_doc (authorid) values($creatorid) where title=$newtitle and content=$newcontent";

回答3:

$sqlstr1="让老液insert into wiki.wiki_doc (authorid) values ('$creatorid'含闹) where title=“."'$newtitle '"."'and content='"."'$newcontent'坦物";

回答4:

$sqlstr1="链雹带棚芦insert into wiki.wiki_doc (authorid) values('$creatorid')where title='.$newtitle'肆扰 and content='.$newcontent'";