Jump to content

codingbenn

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by codingbenn

  1. Say if I had a sentence like; Adam, Floop, 89, 78 and break this up into various strings? This will be a search result so it WILL change. so like change it to; $first $last $num1 $num2 thanks
  2. well I have a mysql with 3 columns which are called ID, firstName, lastName. I want to search for a name and it then return the ID? thanks little bit of the database; ID firstName lastName 100033 Stijn Stijnen 1001 Gábor Király 100143 Frederik Boi 100264 Tomasz Szewczuk 100325 Steeve Joseph-Reinette 100326 Kamel Chafni 100329 Abdoulaye Faye 100330 José Saez 100387 Richard Spong 100391 Laurent Delorge 100470 Michael Ingham 100521 David Noble 100557 Brian Barry-Murphy 100559 Paul McKenna 100578 Richard Cresswell
  3. how would i achieve something like this?
  4. im not using the database file anymore..just using a formatted text file
  5. how is it wrong if its working how I want it?
  6. ive decided to have the layout different now so this technique is all fine.
  7. Im just saying atm this is easier for me..
  8. my way is still alot simpler..is their anyway I could space out the information my way?
  9. yes but as being very new to PHP myself working out how to connect to a database and then search it and then filter it and then display it is difficult
  10. My code above is alot simpler and shorter than using a database..is there no way to filter it using my code? its just spacing I need to do really I want it to end up like this RESULT 1; Player Name; OVRL: 90 PAC: 90 - DRIB: 90 SHOT: 90 - DEF: 90 PASS: 90 - HEAD: 90 RESULT 2; Player Name; OVRL: 90 PAC: 90 - DRIB: 90 SHOT: 90 - DEF: 90 PASS: 90 - HEAD: 90 RESULT 3; Player Name; OVRL: 90 PAC: 90 - DRIB: 90 SHOT: 90 - DEF: 90 PASS: 90 - HEAD: 90
  11. This is working a treat atm and is only taking seconds to find players; <form method="post"> Enter Player Name: <input type="text" name="playername"> <input type="submit" value="Find ID!"> </form> <br><br><br><center> <?php $search = $_POST["playername"]; $lines = file('h:/cleanedfutplayers.txt'); // Store true when the text is found $found = false; foreach($lines as $line) { if(strpos($line, $search) !== false) { $found = true; echo $line, "<br>"; } } // If the text was not found, show a message if(!$found) { echo "<i>No match found"; } ?> But im getting the end result like this; I wish it would be this easy to seach a JSON file because you can filter that really easily :/
  12. oh thanks how do I connect to a SQLLite then?
  13. nope..in my SQL Browser;
  14. but I created it and saved it in sql browser? I can open it in that? argh
  15. tried finding it on the phpMyAdmin and searched all the files and folders where it could be and just tried the database name and the table name :/ and both together
  16. cant find it for some reason? i dont get why its not coming up
  17. well I cant find it anywhere so..
  18. Im trying to connect to it with this code; <?php mysql_connect("localhost", "root", "root") or die("Error connecting to database: ".mysql_error()); mysql_select_db("playerSearch") or die(mysql_error()); ?> but i get this error; Unknown database 'playersearch' any help?
  19. turned out I could just add in the text file into the sql and it would filter it
  20. I sorted it actually
  21. But how do I put all this data into a database?
  22. So basically I have a HUGE text file; download here or the code is like this; FirstName: Wayne, LastName: Brown, CommonName:None, Height: 185, DateOfBirth: Year: 1977, Month: 1, Day: 14, PreferredFoot: Right, ClubId: 1951, LeagueId: 61, NationId: 14, Rating: 54, Attribute1: 56, Attribute2: 53, Attribute3: 47, Attribute4: 61, Attribute5: 36, Attribute6: 49, Rare: 0, ItemType: PlayerGk but this is repeated like 11,480 times(to be exact) but with different information e.g names ect. I have the search working ATM like this; <?php $search = 'Wayne'; $lines = file('cleanedfutplayers.txt'); $found = false; foreach($lines as $line) { if(strpos($line, $search) !== false) { $found = true; echo $line; } } if(!$found) { echo "<i>No match found"; } ?> And atm I get a return of this; BUT i want to filter it out. I want it to just take the values such as getting the value of first name would just get Wayne and the same for the rest of the fields. and i also need some <br> 's in there and some spacing. So how would I go about filtering this? Also how would I add a search box and a button that would give and set the value of the; $search = ''; so for example i THINK the code will be something like this; echo "First Name: ", ['FirstName']; but it isnt because ive tested and it doesnt work? so PLEASE help me!
  23. this is working a treat at the moment; <?php $search = 'Rooney'; $lines = file('allfutplayers.txt'); // Store true when the text is found $found = false; foreach($lines as $line) { if(strpos($line, $search) !== false) { $found = true; echo $line; } } // If the text was not found, show a message if(!$found) { echo "<i>No match found"; } ?> but this displays ALL of the data for all the rooney's like this; so how do i filter is out now? Also how do I add a searchbox for users to search in? and link it to the php? ive tried adding <input type="text" id="$search"> but it doesnt work.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.