Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I make a script retrieve specific data from a MYSQL database?
    primarykey
    data
    text
    <p>I made a simple search to retrieve customer data from a database. So far I've only been able to make it successful display the current table data on the webpage but I can't get the search function to retrieve specific data. I'm having 0 database access issues. </p> <p>I've been searching on goggle for hours and trying many different combinations but I can't find any decent tutorials on making a mysqli search.</p> <p><a href="http://www.teetimelawncare.com/search.php" rel="nofollow">Link to my current php page</a> </p> <p>Cust_no is primary key(varchar), prog_id(integer), balance(varchar)</p> <pre><code> **Table structure** Query Output: &gt; SELECT prog_id, cust_no, balance FROM `tee`.`teecust` + ------------ + ------------ + ------------ + | prog_id | cust_no | balance | + ------------ + ------------ + ------------ + | 220852 | 1184631 | 0 | | 220853 | 1184693 | 0 | | 225726 | 1186292 | 0 | | 220854 | 1233446 | 0 | | 220856 | 1233672 | 0 &lt;!DOCTYPE html&gt; &lt;head&gt; &lt;title&gt;Search the Database&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="search.php" method="get" enctype="application/x-www-form-urlencoded" target="_self" id="search"&gt; Search: &lt;input type="text" name="term" /&gt;&lt;br /&gt; &lt;input type="submit" name="submit" value="Submit" /&gt; &lt;/form&gt; &lt;?php $host="****"; $port="3306"; $socket=""; $user="u*****"; $password="*****"; $dbname="tee"; $mysqli = new mysqli($host, $user, $password, $dbname); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $query = "SELECT cust_no FROM teecust LIMIT 20,5"; if ($result = $mysqli-&gt;query($query)) { /* fetch associative array */ while ($row = $result-&gt;fetch_row()) { printf ("Customer Number:%s Billing ID:%s Balance due:%s\n", $row["cust_no"], $row["prog_id"], $row["balance"]); } /* free result set */ $result-&gt;close(); } /* close connection */ $mysqli-&gt;close(); ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    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