feych_stuff and a function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

feych_stuff and a function

Post by m2babaey »

Hi
1.what is the difference between mysql_fetch_array, mysql_fetch_assoc and mysql_fetch_row?
2. I know what mysql connect is but what is the next line doing in the code below:
function db_connect($host,$user,$pass) //create connection

Code: Select all

{
	$r = mysql_connect($host,$user,$pass);
	if(preg_match('/^5\./',mysql_get_server_info($r)))db_query('SET SESSION sql_mode=0');
	return $r;
}
UrButtFullOfArr0ws
Forum Commoner
Posts: 64
Joined: Wed Feb 21, 2007 11:42 am
Location: Up a tree >.>"

Post by UrButtFullOfArr0ws »

http://www.php.net/mysql_fetch_assoc
http://www.php.net/mysql_fetch_array
http://www.php.net/mysql_fetch_row
Not to be rude or anything but next time try to check php.net and Google before posting :?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

if(preg_match('/^5\./',mysql_get_server_info($r)))db_query('SET SESSION sql_mode=0');
If the script has connected to a mysl 5.x server it (re)sets the sql mode. see http://dev.mysql.com/doc/refman/5.0/en/ ... modes.html
Post Reply