Monday, April 16, 2007

Newer connection string

This connection string worked for me:

/* Connect to a MySQL server */
$link = mysqli_connect(
'sql4.phpnet.us', /* The host to connect to */
'pn_461233', /* The user to connect as */
'student1', /* The password to use */
'pn_461233_test'); /* The default database to query */

if (!$link) {
printf("Can't connect to MySQL Server. Errorcode: %s\n", mysqli_connect_error());
exit;
}

/* Send a query to the server */
if ($result = mysqli_query($link, 'SELECT * FROM table1')) {

print("Very large cities are:\n");

/* Fetch the results of the query */
while( $row = mysqli_fetch_assoc($result) ){
printf("%s (%s)\n", $row['name']);
}

/* Destroy the result set and free the memory used for it */
mysqli_free_result($result);
}

/* Close the connection */
mysqli_close($link);

No more mysql_...we are in 2007 now!

3 comments:

kalpesh said...

The objective has been fulfilled, for such effort; the subject who is responsible for the creation truly deserves the deserving grade.

LoneAsp said...

DONE

Pantzer_legion said...

Done

Sorry Mr.Freer for being a little late...................had to think a little bit about it

:D

doranakal.blogspot.com

I'm Jorge Bartra