note 30381 added to function.mysql-fetch-row

From: Date: Sun, 16 Mar 2003 05:01:28 +0000
Subject: note 30381 added to function.mysql-fetch-row
Groups: php.notes 
Request: Send a blank email to php-notes+get-45379@lists.php.net to get a copy of this message
function set_variables_after_query($selection) { // set variables in the caller's environment from a database query // by James Thornton, http://jamesthornton.com $row = mysql_fetch_row($selection); foreach($row as $i => $value) { $column = mysql_field_name($selection,$i); $GLOBALS["$column"] = $value; } } // Example: $selection = mysql_query($sql) or die(mysql_error()); set_variables_after_query($selection); -- http://www.php.net/manual/en/function.mysql-fetch-row.php http://master.php.net/manage/user-notes.php?action=edit+30381 http://master.php.net/manage/user-notes.php?action=delete+30381 http://master.php.net/manage/user-notes.php?action=reject+30381

« previous php.notes (#45379) next »