Jump to content
Sign in to follow this  
spluskhan

Help Me Gyz

Recommended Posts

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

Share this post


Link to post
Share on other sites

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 by Rollins

Share this post


Link to post
Share on other sites

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 by thescientist

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...