php, read database, write database, how to read db, how to write db, update database, insert db php: read, write database
(Website Helper) php: read, write database Number of Visitors: Site Map

php: how to read database and write db?



Website Design
Website Promotion
Graphic Design
Programming
Free Software
Computer Tips
Discount Stores
This site provides users with the information about php, read database, write database, how to read db, how to write db, update database, insert db, and more.

If you think that this site is helpful, please recommend your friends to visit our site.



How to read database and write db in php?

The following is the code to read database and write db in php:

1. How to write database in php?


< ?php /* Connecting, selecting database */ $link = mysql_connect("localhost", "bobsmith", "JM5t") or _ die("Could not connect"); /*print "Connected successfully";*/ mysql_select_db("bobsmith") or die("Could not select database"); mysql_query("insert into employees values _ ('Bob','Smith','55 Peter street','Manager')"); /* Free resultset */ //mysql_free_result($result); /* Closing connection */ mysql_close($link); print("Done!"); ? >
2. How to read database in php?


< ?php $db = mysql_connect("localhost", "root"); mysql_select_db("bobsmith",$db); $result = mysql_query("SELECT * FROM employees",$db); printf("First Name: %s< br>\n", mysql_result($result,0,"first")); printf("Last Name: %s< br>\n", mysql_result($result,0,"last")); printf("Address: %s< br>\n", mysql_result($result,0,"address")); printf("Position: %s< br>\n", mysql_result($result,0,"position")); ? >
(Website Helper) php: read, write database (c) EduSoftMax - www.edusoftmax.com