php database connection example
php connect to mysql database, oracle database
- <?php
- @$dbcnnct = mysql_connect("localhost", "username", "password");
- if(!$dbcnnct)
- {
- echo "could not connect";
- }
- @$db=mysql_select_db("project");
- if(!$db)
- {
- echo "could not select";
- }
- $sql = mysql_query("SELECT * FROM country ");
- if(!$sql)
- echo "error==".mysql_error($sql);
- while($row = mysql_fetch_array($sql))
- {
- echo ("$row[table column name]");
- }
- @$dbcls = mysql_close($dbcnnct);
- ?>
Comments
Post a Comment