![]() |
|
[PHP] Database Lookup PHP Script - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [PHP] Database Lookup PHP Script (/showthread.php?tid=5748709) |
Database Lookup PHP Script - Gonz0 - Nov 6, 2017 Hello, I am currently making a database lookup tool that will let a user search for a term (username, name, etc.) and the engine will search mutliple text files for that specific term. Right now I am having an issue, I want the script to read all the files in the location given but it will only read one .txt file in that location. I want it to read multiple. if someone could help that would be awesome! here is my PHP script for analysis: Code <?phpRE: Database Lookup PHP Script - V3t3r4n - Nov 6, 2017 That's because if you want to look more than one, you need to wrap it on a loop. Try this: PHP Code RE: Database Lookup PHP Script - Gonz0 - Nov 6, 2017 it works but it gives this error message when giving the results: No matches found<br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /storage/ssd4/176/496176/public_html/search/script.php:21) in <b>/storage/ssd4/176/496176/public_html/search/script.php</b> on line <b>8</b><br /> Found matches: gonz0123 RE: Database Lookup PHP Script - V3t3r4n - Nov 6, 2017 Move the $query = $_GET['query']; header('Content-Type: text/plain'); To outside of the foreach (on top of it, after the glob). RE: Database Lookup PHP Script - Gonz0 - Nov 6, 2017 how would i go about displaying the name of the text file in the "found matches" portion? I want it to say "found matches in (name of file.txt):" RE: Database Lookup PHP Script - V3t3r4n - Nov 6, 2017 (Nov 6, 2017 08:14 AM)Gonz0 Wrote: how would i go about displaying the name of the text file in the "found matches" portion? Just print your filename out? PHP Code RE: Database Lookup PHP Script - Gonz0 - Nov 6, 2017 thank you so much for your help! RE: Database Lookup PHP Script - V3t3r4n - Nov 6, 2017 (Nov 6, 2017 08:18 AM)Gonz0 Wrote: thank you so much for your help! No problem :) You should read up on PHP at W3Schools, for starters (https://www.w3schools.com/php/) And then move on up from there to the PHP Documentation itself (http://php.net/docs.php) StackOverflow and Google are also very useful when you can't figure out how to complete certain tasks. Best of Luck! ✌ |