Maison >développement back-end >tutoriel php > php mysql 多表查询 查询不出结果?该怎么处理
php mysql 多表查询 查询不出结果?
我的代码如下:
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?php /*connect database*/ $link=mysql_connect("192.168.XX.XX:3306","root","root") or die("Could not connect"); print "Connected successfully"; mysql_select_db("jiradb") or die ("Could not select database"); mysql_query("set names 'utf8'"); /*execte SQL query*/ $query="SELECT b.pname,a.pkey,a.summary,a.assignee FROM jiraissue a, issuetype b,project c WHERE a.project=c.ID and b.ID=a.issuetype and c.pname='TEST';"; $result=mysql_query($query,$link) or die("Query failed"); /*print result in html*/ MySQL_num_rows($result); while($row=mysql_fetch_array($result)) {echo $row[0]; } /*release resource */ mysql_free_result($result); /*close link*/ mysql_close($link); ?>
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->$query="select * from jiraissue";
$result=mysql_query($query,$link) or die("Query failed"); echo "1 ".mysql_error(); /*print result in html*/ MySQL_num_rows($result); echo "2 ".mysql_error(); while($row=mysql_fetch_array($result)) {echo $row[0]; echo "3 ".mysql_error(); } <div class="clear"> </div>