日期:2014-05-17 浏览次数:20640 次
<?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); ?>
$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(); }