我不断收到此错误:
Warning: mysqli_error() expects exactly 1 parameter, 0 given in /Applications/MAMP/htdocs/dbViewer.php on line 71
无法获取数据:
从这段代码
$sql = "SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('Version') AND TABLE_SCHEMA = 'wp_plugin_db'";
$result = mysqli_query($con,$sql);
if(! $result )
{
die('Could not get data: ' . mysqli_error());
}
$arrayCount = 0;
while ($row=mysqli_fetch_array($result))
{
$tableNames[$arrayCount] = $row[0];
$arrayCount++;
}
foreach ($tableNames as $siteName) {
$siteName = mysqli_real_escape_string($con,$siteName);
$sql="SELECT Plugin_Name, Version, WPVersion FROM `".$siteName."` ORDER BY Plugin_Name";
$result=mysqli_query($con,$sql);
if(! $result )
{
die('Could not get data: ' . mysqli_error());
}
echo "Website Name: $siteName ---- " ;
while($row=mysqli_fetch_array($result,MYSQLI_ASSOC))
{
echo " Plugin Name :{$row['Plugin_Name']} ".
" Version : {$row['Version']} ".
" Wordpress Version : {$row['WPVersion']} ".
" | ";
}
echo "<br>";
}
mysqli_close($con);
错误说line 71
哪个是die('Could not get data: ' . mysqli_error());
真正的错误发生在$sql="SELECT Plugin_Name, WPVersion, Version FROM ".$siteName." ORDER BY Plugin_Name";
我知道这一点,因为当我从选择中取出 WPVersion 并注释掉该元素的回声时,它可以正常工作。请帮助我似乎无法弄清楚,是语法吗?我觉得好傻哈哈。
先感谢您!