hello dear php coder im just new at php...and doing some examples..i have 3 page 1-index.htm 2-connect.php 3-search.php when people search "name and surname" i want result print on screen ...i have user tables and there is 2 fields name and surname...please need some help its should be very easy for you...but very dffuclt for me thanks index.html <html> <head><title>Arama Yapma </title> </head><form action="search.php" name="ara" method="get"> <input type="text" name="name" value="name" size="21"> <input type="text" name="surname" value="name" size="21"> <br> <input type="submit" name="ara" value="ara"> <br> </form> </html> Code (markup): connect.php <?php $db = mysql_connect("localhost","xxxxx","xxxxxx"); mysql_select_db("xxxx",$db); ?> Code (markup): search.php <?php include("connect.php"); [COLOR="darkred"]i need php code which it will take information from user tables name and surname fields and will print on screen [/COLOR] ?> Code (markup):
This will display all names sorted by the surname. Look into a search form once you get this working. $people = mysql_query("SELECT [B]given_name[/B], [B]surname[/B] FROM [B]names_table[/B] ORDER BY [B]surname[/B]"); while($person = mysql_fetch_assoc($people)){ echo $person['[B]surname[/B]'].",".$person['[B]given_name[/B]']."<br>"; } Code (markup): You'll need to change the emboldened values to match your field and table names. Good luck.