運(yùn)行PHP項(xiàng)目顯示空白
問題描述
我主要的問題就是以前用xampp能運(yùn)行的php項(xiàng)目現(xiàn)在運(yùn)行不了,能顯示html,部分不需要連接數(shù)據(jù)庫的php頁面也能顯示,只要是需要連接數(shù)據(jù)庫的都不行,完全不知道什么原因,求求大佬們救救孩子吧!
下面是連接數(shù)據(jù)庫的代碼:
<?phperror_reporting(0); //數(shù)據(jù)庫鏈接文件$host='127.0.0.1';//數(shù)據(jù)庫服務(wù)器$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="">請(qǐng)選擇</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; // 輸出串長(zhǎng)度 $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都在用~
相關(guān)文章:
1. css - 新手做響應(yīng)式布局, 斷點(diǎn)過后右側(cè)出現(xiàn)空白,求幫助,謝謝。2. python - 啟動(dòng)Eric6時(shí)報(bào)錯(cuò):’qscintilla_zh_CN’ could not be loaded3. javascript - vue 怎么渲染自定義組件4. javascript - 關(guān)于<a>元素與<input>元素的JS事件運(yùn)行問題5. mysql - 查詢字段做了索引為什么不起效,還有查詢一個(gè)月的時(shí)候數(shù)據(jù)都是全部出來的,如果分拆3次的話就沒問題,為什么呢。6. mysql - 記得以前在哪里看過一個(gè)估算時(shí)間的網(wǎng)站7. 大家好,我想請(qǐng)問一下怎么做搜索欄能夠搜索到自己網(wǎng)站的內(nèi)容。8. ID主鍵不是自增的嗎 為什么還要加null9. MySQL中的enum類型有什么優(yōu)點(diǎn)?10. python - 安裝pyspider時(shí)出錯(cuò):No space left on device:
