<?php
$sitename = "csgodrugs.net";
$link = mysql_connect(" mysql.hostinger.ro", "u550413281_cosmi", "***********"); //DB!! //IP,NICK,PW!!!
$db_selected = mysql_select_db('csgon', $link); //NAME OF DATABASE
mysql_query("SET NAMES utf8");
function fetchinfo($rowname,$tablename,$finder,$findervalue) {
if($finder == "1") $result = mysql_query("SELECT $rowname FROM $tablename");
else $result = mysql_query("SELECT $rowname FROM $tablename WHERE `$finder`='$findervalue'");
$row = mysql_fetch_assoc($result);
return $row[$rowname];
}
?>
答案 0 :(得分:0)
试试这个:
function fetchinfo($rowname,$tablename,$finder,$findervalue) {
if($finder == "1") $result = mysql_query("SELECT '$rowname' FROM '$tablename'");
else $result = mysql_query("SELECT '$rowname' FROM '$tablename' WHERE '$finder'='$findervalue'");
$row = mysql_fetch_assoc($result);
return $row[$rowname];
}
在select语句中定位变量时,只需整理您应该使用的位置&#39;&#39;
您还应该使用MySQL i 函数而不是MySQL函数,因为MySQL函数在PHP 5.5中已经过折旧,并在PHP 7.0中被删除。