eldan88 Posted April 19, 2012 Share Posted April 19, 2012 Hi, I am a little confused on the difference the mysql_fetch_array and mysql_query? Whats the difference between those two? Thanks Link to comment https://forums.phpfreaks.com/topic/261243-difference-between-mysql_fetch_array-and-mysql_query/ Share on other sites More sharing options...
silkfire Posted April 19, 2012 Share Posted April 19, 2012 You use mysql_query to perform the query itself. This function returns a resource that you iterate upon to extract the contents of the result of the query with various fetch functions, including the on you mentioned. Link to comment https://forums.phpfreaks.com/topic/261243-difference-between-mysql_fetch_array-and-mysql_query/#findComment-1338718 Share on other sites More sharing options...
smerny Posted April 19, 2012 Share Posted April 19, 2012 mysql_query sends a query to the database and returns the results. mysql_fetch_array is used on the results from the mysql_query to fetch a row from the results in the form of an array simple example that would print a list of all first/last names in the users table $result = mysql_query("SELECT firstName, lastName FROM users"); while($row = mysql_fetch_array($result)){ echo $row['firstName'] ." ". $row['lastName'] ."<br/>"; } Link to comment https://forums.phpfreaks.com/topic/261243-difference-between-mysql_fetch_array-and-mysql_query/#findComment-1338720 Share on other sites More sharing options...
eldan88 Posted April 21, 2012 Author Share Posted April 21, 2012 Oh Okay I got it now! Thank you guys! Link to comment https://forums.phpfreaks.com/topic/261243-difference-between-mysql_fetch_array-and-mysql_query/#findComment-1339356 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.