Note that there are some explanatory texts on larger screens.

plurals
  1. POMysql Error when trying to spit out database elements
    text
    copied!<p>I keep getting this error :</p> <pre><code>Warning: mysqli_error() expects exactly 1 parameter, 0 given in /Applications/MAMP/htdocs/dbViewer.php on line 71 </code></pre> <p>Could not get data: </p> <p>from this code</p> <pre><code>$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 "&lt;br&gt;"; } mysqli_close($con); </code></pre> <p>The error says <code>line 71</code> which is <code>die('Could not get data: ' . mysqli_error());</code></p> <p>The real error is happening at <code>$sql="SELECT Plugin_Name, WPVersion, Version FROM ".$siteName." ORDER BY Plugin_Name";</code> </p> <p>I know this because when I take out WPVersion from the selec and comment out the echo for that element it works without error. Please help I can't seem to figure this out, Is it syntax? I feel so stupid haha.</p> <p>Thank you in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload