Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP unkown column in WHERE clause ect
    primarykey
    data
    text
    <p>Hello I would like to ask for the help off the people who use stackoverflow. I seem to be running into errors and usually everything works for me but I am tired and I cannot seem to work out where I am going wrong. </p> <p>I am receiving these errors: </p> <pre><code>Notice: Unknown column 'test' in 'where clause'SELECT * FROM settings WHERE player = `test` in C:\xampp\htdocs\ranking\search.php on line 18 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\ranking\search.php on line 26 Unknown column 'test' in 'where clause' </code></pre> <p>Here is the php code I am using on localhost.</p> <pre><code>&lt;?php //database infomation $dbhost = "localhost"; $dbname = "databasesname"; $dbuser = "root"; $dbpass = ""; //Connect to database mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); if(isset($_POST['search'])) { $searchinfo = $_POST['searchinfo']; $type = $_POST['group1']; if($type == "class"){ } else { $query = "SELECT * FROM settings WHERE player = `$searchinfo`"; $result = mysql_query($query) or trigger_error(mysql_error().$query); echo "&lt;table&gt;&lt;tr&gt;&lt;th&gt;Username&lt;/th&gt;"; echo "&lt;th&gt; &lt;/th&gt;"; echo "&lt;th&gt;Created&lt;/th&gt;"; echo "&lt;th&gt;Infastructure&lt;/th&gt;"; echo "&lt;th&gt;Statename&lt;/th&gt;"; echo "&lt;th&gt;Money&lt;/th&gt;&lt;/tr&gt;"; while ($row = mysql_fetch_array($result) or die($result."&lt;br/&gt;&lt;br/&gt;".mysql_error())) { echo '&lt;tr&gt;&lt;td&gt;' . $row['player'] . '&lt;/td&gt;&lt;td&gt;' . $row['data_type'] . '&lt;/td&gt;&lt;td&gt;' . $row['data'] . '&lt;/td&gt;&lt;td&gt; '; } } } ?&gt; &lt;html&gt; &lt;head&gt; &lt;rel href="includes/style.css" type="text/css"&gt; &lt;title&gt; Ranking System for Herocraft | Search &lt;/title&gt; &lt;/head&gt; &lt;center&gt; &lt;div id="searchbar"&gt; &lt;form method="POST" action="&lt;?=$_SERVER['PHP_SELF']?&gt;"&gt; &lt;input type="radio" name="group1" value="username"&gt;Username &lt;input type="radio" name="group1" value="class"&gt;Class &lt;input name="searchinfo" id="searchinfo" size="30" value="Enter your search" maxlength="30" /&gt; &lt;input type="submit" name="search" value="search" /&gt;&lt;br /&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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