spluskhan Posted March 8, 2013 Share Posted March 8, 2013 suppose i have 10 products in my database Example:iphone 2 - iphone 3g - laptop i3 - laptop i7 - nokia n96 etcwhen i enter iphone in my search i see all records stored in database thats my prob!what i want ?suppose if i enter laptop i7 or laptop then i get result for laptop i7 or laptop here is my code.. <?php// Connects to your Databasemysql_connect("host.com", "userr", "pass") or die(mysql_error());mysql_select_db("products") or die(mysql_error()); [/font][/color][color=#000000][font=verdana, geneva, lucida,]$data = mysql_query("SELECT * FROM Products")or die(mysql_error());Print "<table border cellpadding=3>";while($info = mysql_fetch_array( $data )){Print "<tr>";Print "<th>Name:</th> <td>".$info['name'] . "</td> ";Print "<th>new:</th> <td>".$info['new_price'] . "</td> ";Print "<th>old:</th> <td>".$info['old_proce'] . "</td> ";Print "<th>faulty:</th> <td>".$info['Faulty_price'] . " </td></tr>";}Print "</table>";?> if any one have better code then please give me tankxx Link to comment Share on other sites More sharing options...
spluskhan Posted March 8, 2013 Author Share Posted March 8, 2013 any bdy Link to comment Share on other sites More sharing options...
spluskhan Posted March 8, 2013 Author Share Posted March 8, 2013 hello Link to comment Share on other sites More sharing options...
Rollins Posted March 8, 2013 Share Posted March 8, 2013 (edited) the * in "SELECT * FROM Products" actually means SELECT ALL FROM Products.... add a where clause after the DB..... "SELECT * FROM products WHERE productname LIKE "statement" ORDER BY price/best sold/or what ever" http://www.w3schools...l/sql_where.asp GL. Edited March 8, 2013 by Rollins Link to comment Share on other sites More sharing options...
thescientist Posted March 8, 2013 Share Posted March 8, 2013 (edited) relax man, give it some time next time. it's not like theres a hundred people here just waiting to solve your problems. besides, you didn't say what you tried, so one could assume there was some google searching you could have tried in the meantime at least. Edited March 8, 2013 by thescientist Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now