PHPMySQLref - Calling MySQL from PHP...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Calling MySQL from PHP mysql_connect( hostname, username, password); Returns a MySQL DB link if successful, false otherwise. E.g. $link = mysql_connect(‘localhost’, ‘dpwmson’, ‘mypassword’); mysql_select_db( dbname , link ); Selects DB dbname for use given connection link . E.g. mysql_select_db(‘moviesdb’, $link); mysql_query( sqlquery , dblink ); Issues sqlquery to MySQL DB given by dblink. For INSERT, UPDATE, DELETE, returns true if successful, false if not For SELECT, returns resource if successful, false if not. E.g. $result = mysql_query(“SELECT * FROM Movies”, $link); mysql_fetch_array( resource, arg ); Returns array containing next tuple from relation given by
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2008 for the course INFO 2300 taught by Professor Williamson during the Spring '08 term at Cornell University (Engineering School).

Ask a homework question - tutors are online