codingbenn Posted November 2, 2012 Share Posted November 2, 2012 (edited) 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? Edited November 2, 2012 by codingbenn Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 2, 2012 Share Posted November 2, 2012 Why are you assuming the database is named playerSearch because of a file? In my local MySql installation each database has it's own folder and each table has several files. Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 2, 2012 Author Share Posted November 2, 2012 Why are you assuming the database is named playerSearch because of a file? In my local MySql installation each database has it's own folder and each table has several files. well I cant find it anywhere so.. Quote Link to comment Share on other sites More sharing options...
jcbones Posted November 2, 2012 Share Posted November 2, 2012 Do you have mysql installed? Should reside at C:\\wamp\bin\mysql Do you have phpmyadmin installed? Should reside at C:\\wamp\www\phpmyadmin Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 2, 2012 Share Posted November 2, 2012 You should log into the database using PhpMyAdmin (or whatever management application you have) to verify what the actual database name is. Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 2, 2012 Author Share Posted November 2, 2012 You should log into the database using PhpMyAdmin (or whatever management application you have) to verify what the actual database name is. cant find it for some reason? i dont get why its not coming up Quote Link to comment Share on other sites More sharing options...
JohnTipperton Posted November 3, 2012 Share Posted November 3, 2012 try to check in phpmyadmin if the database exist. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 3, 2012 Share Posted November 3, 2012 try to check in phpmyadmin if the database exist. That was suggested here: You should log into the database using PhpMyAdmin (or whatever management application you have) to verify what the actual database name is. Quote Link to comment Share on other sites More sharing options...
JohnTipperton Posted November 3, 2012 Share Posted November 3, 2012 cant find it for some reason? i dont get why its not coming up i see what about checking the database name.. Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 3, 2012 Author Share Posted November 3, 2012 i see what about checking the database name.. I have :/ Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 3, 2012 Share Posted November 3, 2012 HOW have you checked it? Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 3, 2012 Author Share Posted November 3, 2012 HOW have you checked it? 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 Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 3, 2012 Share Posted November 3, 2012 Forgive me for sounding like Captain Obvious here, but if you didn't find it in phpMyAdmin, it doesn't likely exist. Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 4, 2012 Author Share Posted November 4, 2012 Forgive me for sounding like Captain Obvious here, but if you didn't find it in phpMyAdmin, it doesn't likely exist. but I created it and saved it in sql browser? I can open it in that? argh Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 4, 2012 Share Posted November 4, 2012 (edited) You mean you created it in Microsoft SQL browser? The one for MSSQL databases? If so, there's your problem. Edited November 4, 2012 by Pikachu2000 Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 4, 2012 Author Share Posted November 4, 2012 You mean you created it in Microsoft SQL browser? The one for MSSQL databases? If so, there's your problem. nope..in my SQL Browser; Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 4, 2012 Share Posted November 4, 2012 Ummmm . . . yeah. Same principle: SQLLite != MySQL. Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 4, 2012 Author Share Posted November 4, 2012 Ummmm . . . yeah. Same principle: SQLLite != MySQL. huh? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 4, 2012 Share Posted November 4, 2012 Your database is a SQLLite database. You can't use MySQL functions to connect to it. They're two completely different RDBMSs. Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 4, 2012 Author Share Posted November 4, 2012 Your database is a SQLLite database. You can't use MySQL functions to connect to it. They're two completely different RDBMSs. oh thanks how do I connect to a SQLLite then? Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 4, 2012 Author Share Posted November 4, 2012 (edited) 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 :/ Edited November 4, 2012 by codingbenn Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 4, 2012 Share Posted November 4, 2012 If it were me, I'd export it, then import it into MySQL. If you prefer to leave it as is, you'd need to use php's sqlite functions: http://php.net/manual/en/book.sqlite.php Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 4, 2012 Author Share Posted November 4, 2012 If it were me, I'd export it, then import it into MySQL. If you prefer to leave it as is, you'd need to use php's sqlite functions: http://php.net/manua...book.sqlite.php 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 Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 4, 2012 Share Posted November 4, 2012 It's already in a database; that's what SQLite is. What you say is now "only taking seconds" should be done in a matter of milliseconds using the correct method of accessing the data. Quote Link to comment Share on other sites More sharing options...
codingbenn Posted November 4, 2012 Author Share Posted November 4, 2012 It's already in a database; that's what SQLite is. What you say is now "only taking seconds" should be done in a matter of milliseconds using the correct method of accessing the data. 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.