what is a mysql resource exactly

General discussions related to php

Moderators: macek, egami, gesf

dazzyweb
New php-forum User
New php-forum User
Posts: 2
Joined: Thu May 30, 2013 2:31 am

what is a mysql resource exactly

Postby dazzyweb » Tue Jun 04, 2013 11:14 am

What exactly is a mysql Resource?

What is meant by a mysql resource

This is a quote from tizag

'When you perform a SELECT query on the database it will return a MySQL Resource that holds everything from your MySQL table, "example". We want to use this Resource in our PHP code, so we need to store it in a variable, $result.'

'$result = mysql_query("SELECT * FROM example")'

'$row = mysql_fetch_array( $result );'

Does exactly is the difference between $result and $row

Are they both holding a MySQL resource

I am a little confused

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: what is a mysql resource exactly

Postby johnj » Wed Jun 05, 2013 6:39 am


johnmacd
New php-forum User
New php-forum User
Posts: 19
Joined: Wed Jun 12, 2013 9:30 pm
Contact:

Re: what is a mysql resource exactly

Postby johnmacd » Sun Jun 23, 2013 9:08 pm

The value that mysql_query returns and stores into $result, it is a MySQL Resource.
Additional PHP functions are required to extract the data from this Resource.
The mysql_fetch_array function takes a MySQL query resource as an argument ($result) and returns the first row of data returned by the mysql_query.


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 3 guests