Posted: Wed May 03, 2006 5:27 pm Post subject: searching a mysql database
i'm trying to search a database and really have no clue where to start. i can connect to the database via php, that's about it. can anyone give me some sample code of a search or a tutorial? anything is welcomed...
Hello tbrenner,<br /><br />after connecting a database server(from php), you have to connect to a specific database to start a search.<br /><br />this looks sg like:<br /> $link = mysql_connect("localhost", "yourlogin", "yourpw")<br /> or die("Could not connect");<br /> mysql_select_db("your_db_name") or die("Could not select database");<br /><br />you can start searching after this.<br /><br />Searching looks sg like<br /><br />SELECT "xyz" FROM your_table WHERE "zbd"<br /><br />or from php<br />mysql_query("SELECT &bkfls;"xyz&bkfls;" FROM your_table WHERE &bkfls;"zbd&bkfls;"");<br /><br />search criterias "xyz" and "zbd" can of course vary in a quite wide range. The most straightforward is this:<br /><br />SELECT * FROM yourtable;<br /><br />which gives you every record of your table.<br /><br />Check out the MySql documentation, as that is a quite nice tutorial as well:<br />http://dev.mysql.com/doc/refman/5.0/en/tutorial.html<br /><br />regards<br />zsl _________________ Click Fraud Blog
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
Host your free forums with Invision Plus.net forum web hosting with your own subdomain.
alexisBlue v1.2 // Theme Created By: Andrew Charron // Icons in Part By: Travis Carden