Sunday, November 9, 2008

PHP Tutorial: some basic example for SQL and PHP

//$link = mysql_connect(“localhost”, “root”, “123”)
or die(“Could not connect: “ . mysql_error());
// for connecting with MySQL NB: you shoul use your own password and username
//mysql_select_db(‘moviesite’, $link)
or die ( mysql_error());
//for selecting the schema in database here the selected schema is moviesite
//$peoplesql = “SELECT * FROM people”;
// select the table in schema
//$result = mysql_query($peoplesql)

or die(“Invalid query: “ . mysql_error());
// to query

No comments: