>  기사  >  백엔드 개발  >  用php来phpmyadmin写入数据库的有关问题

用php来phpmyadmin写入数据库的有关问题

WBOY
WBOY원래의
2016-06-13 10:38:00976검색

用php来phpmyadmin写入数据库的问题

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $conn=mysql_connect("localhost","root","123456");mysql_query('set names utf8');mysql_select_db("abc",$conn);$news=mysql_query("select * from eb_news where categoryId='53' order by createDate");$a=mysql_num_rows($news);$i=1;$i2=1;$conn2=mysql_connect("localhost","root","123456");mysql_select_db("tjdx",$conn2);$result=mysql_query("select * from sea_info where categoryid='759' order by dotime");$b=mysql_num_rows($result);echo '<div style="border:solid 2 red;width:200px; float:left;">';while($os=mysql_fetch_array($news)){echo $i;echo '--';echo date('Y-m-d',$os['createDate']);echo '--';echo $os['id'];echo '<br>';$i++;  mysql_query("insert into sea_info (parentid,categoryid,title,content,dotime) values('744','759','$os[title]','$os[content]','$os[createDate]')");     }    echo'';        echo '<div style="border:solid 2 red;width:200px; float:left;">';while($os2=mysql_fetch_array($result)){echo $i2;echo '--';echo date('Y-m-d',$os2['dotime']);echo '<br>';$i2++;    }     echo'</div>';    echo $b;echo '<br>';echo $a;?>

对比的时候就是少了几条数据,怎么会这样

------解决方案--------------------
这俩没转义吧 $os[title] $os[content]
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.