bidvertiser

Wednesday, October 22, 2008

MySQL Function Reference example code

if (!$link)
{
die('Could not connect: ' . mysql_error());
} mysql_select_db('mydb'); /* this should return the correct numbers of deleted records */ mysql_query('DELETE FROM mytable WHERE id < 10');
printf("Records deleted: %d\n", mysql_affected_rows());
/* with a where clause that is never true, it should return 0 */ mysql_query('DELETE FROM mytable WHERE 0');
printf("Records deleted: %d\n", mysql_affected_rows());
?>

No comments: