運行PHP項目顯示空白
問題描述
我主要的問題就是以前用xampp能運行的php項目現在運行不了,能顯示html,部分不需要連接數據庫的php頁面也能顯示,只要是需要連接數據庫的都不行,完全不知道什么原因,求求大佬們救救孩子吧!
下面是連接數據庫的代碼:
<?phperror_reporting(0); //數據庫鏈接文件$host='127.0.0.1';//數據庫服務器$user='root';//數據庫用戶名$password='';//數據庫密碼$database='kaoshi';//數據庫名$conn=@mysqli_connect($localhost,$user,$password) or die('數據庫連接失?。?);@mysql_select_db($database) or die('沒有找到數據庫!');
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 for Mac 創建的dnsmasq容器連不上/不工作的問題2. docker安裝后出現Cannot connect to the Docker daemon.3. css - 定位為absolute的父元素中的子元素 如何設置在父元素的下面?4. javascript - angualr2中emit觸發一個方法然后怎么獲得這個promise的結果5. java - 請問在main方法中寫成對象名.屬性()并賦值,與直接參參數賦值輸錯誤是什么原因?6. mysql里的大表用mycat做水平拆分,是不是要先手動分好,再配置mycat7. java - Spring boot 讀取 放在 jar 包外的,log4j 配置文件,系統有創建日志文件,不寫入日志信息。8. javascript - 圖片鏈接請求一直是pending狀態,導致頁面崩潰,怎么解決?9. python - beautifulsoup獲取網頁內容的問題10. 怎么用css截取字符?
