運行PHP項目顯示空白
問題描述
我主要的問題就是以前用xampp能運行的php項目現(xiàn)在運行不了,能顯示html,部分不需要連接數(shù)據(jù)庫的php頁面也能顯示,只要是需要連接數(shù)據(jù)庫的都不行,完全不知道什么原因,求求大佬們救救孩子吧!
下面是連接數(shù)據(jù)庫的代碼:
<?phperror_reporting(0); //數(shù)據(jù)庫鏈接文件$host='127.0.0.1';//數(shù)據(jù)庫服務器$user='root';//數(shù)據(jù)庫用戶名$password='';//數(shù)據(jù)庫密碼$database='kaoshi';//數(shù)據(jù)庫名$conn=@mysqli_connect($localhost,$user,$password) or die('數(shù)據(jù)庫連接失敗!');@mysql_select_db($database) or die('沒有找到數(shù)據(jù)庫!');
mysql_query("set names 'gb2312'");function getoption($ntable,$nzd){ $sql="select ".$nzd." from ".$ntable." order by id desc"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { for ($fi=0;$fi<$rowscount;$fi++) { ?> <option value="<?php echo mysql_result($query,$fi,0);?>"><?php echo mysql_result($query,$fi,0);?></option> <?php } }}function getoption2($ntable,$nzd){ ?> <option value="">請選擇</option> <?php $sql="select ".$nzd." from ".$ntable." order by id desc"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { for ($fi=0;$fi<$rowscount;$fi++) { ?> <option value="<?php echo mysql_result($query,$fi,0);?>" <?php if($_GET[$nzd]==mysql_result($query,$fi,0)) { echo "selected"; } ?>><?php echo mysql_result($query,$fi,0);?></option> <?php } }}function getitem($ntable,$nzd,$tjzd,$ntj){ if($_GET[$tjzd]!="") { $sql="select ".$nzd." from ".$ntable." where ".$tjzd."='".$ntj."'"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { echo "value='".mysql_result($query,0,0)."'"; } }}function makefilename2(){ $i=1; $str = "0123456789"; // 輸出字符集 $n = 4; // 輸出串長度 $len = strlen($str)-1; for($i=0 ; $i<$n; $i++){ $s .= $str[rand(0,$len)]; } $timestamp=time(); return $timestamp.$s; } function readzd($ntable,$nzd,$tjzd,$ntj){ $sql="select ".$nzd." from ".$ntable." where ".$tjzd."='".$ntj."'"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { echo mysql_result($query,0,0); }}function readzd2($ntable,$nzd,$tjzd,$ntj){ $sql="select ".$nzd." from ".$ntable." where ".$tjzd."='".$ntj."'"; $query=mysql_query($sql); $rowscount=mysql_num_rows($query); if($rowscount>0) { return mysql_result($query,0,0); }}?>
問題解答
回答1:下載phpstudy吧, 國人phper都在用~
相關文章:
1. 關docker hub上有些鏡像的tag被標記““This image has vulnerabilities””2. 前端 - ng-view不能加載進模板3. docker容器呢SSH為什么連不通呢?4. android clickablespan獲取選中內(nèi)容5. debian - docker依賴的aufs-tools源碼哪里可以找到啊?6. docker綁定了nginx端口 外部訪問不到7. nignx - docker內(nèi)nginx 80端口被占用8. docker網(wǎng)絡端口映射,沒有方便點的操作方法么?9. angular.js - angular內(nèi)容過長展開收起效果10. docker images顯示的鏡像過多,狗眼被亮瞎了,怎么辦?
