|
||||||||||||
|
If you have any doubts with your PHP code please discuss it in the PHP Forum Connecting to MysQL Database : $dbh=mysql_connect ("server name ", "username", mysql_select_db ("databasename"); The following code is more clear : $user_name = "username"; if ($db_found) { // do somehing } else{
Display the contents of the table : $result = mysql_query( "SELECT * FROM tablename " ) $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<table width=500 border=1>\n"; while ($get_info = mysql_fetch_row($result)){ foreach ($get_info as $field) print "</tr>\n"; } Insert values into the table : $sql = "INSERT INTO tablename(field1, field2 ) VALUES('value1','value2')" ; $results = mysql_query ( $sql); Functions in PHP : Example : <?php function databaseConnection($dbName) ?> Include the above file in the page you want to call this function using include("functions.php"); Call the function using
Copyright © 2008 www.worth2read.org. All rights Reserved. Use of this Site is subject to our Privacy Statement |
| ||||||||||
| PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide |
||||||||||||
| Programming PHP |
||||||||||||
| Beginning PHP and MySQL: From Novice to Professional, Third Edition (Beginning from Novice to Professional) |
||||||||||||
| Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems |
||||||||||||
| PHP and MySQL Web Development (3rd Edition) (Developer's Library) |
||||||||||||
| PHP & MySQL For Dummies 3rd edition (For Dummies (Computer/Tech)) |
||||||||||||
| PHP Solutions: Dynamic Web Design Made Easy (Solutions) |
||||||||||||
| Build Your Own Website The Right Way Using HTML & CSS |
||||||||||||
| Learning Web Design: A Beginner's Guide to (X)HTML, StyleSheets, and Web Graphics |
||||||||||||
| Sams Teach Yourself HTML and CSS in 24 Hours (7th Edition) (Sams Teach Yourself) |
||||||||||||