hello every ,can any explain what is "Resource id #7" means
i have fired a query-
$query="select * from custdetail order by createdON desc limit $offset,$record_per_page ";
$data=mysql_query($query);
echo $data;
this echo prints Resource id #7 wat does this means how is it useful.......
Resource id #7 problem in mysql
Moderator: General Moderators
Re: Resource id #7 problem in mysql
That's because $data is literally just the Resource ID from the Query - You have to get it into a usable array first before you can use it. I.e,majidali wrote:hello every ,can any explain what is "Resource id #7" means
i have fired a query-
$query="select * from custdetail order by createdON desc limit $offset,$record_per_page ";
$data=mysql_query($query);
echo $data;
this echo prints Resource id #7 wat does this means how is it useful.......
Code: Select all
$query="select * from custdetail order by createdON desc limit $offset,$record_per_page ";
$data=mysql_query($query);
while($row = mysql_fetch_array( $data)) {
echo $row['field_name'];
}
Re: Resource id #7 problem in mysql
thanx for that but i want to know wat does Resource id #7 ......Turv wrote:That's because $data is literally just the Resource ID from the Query - You have to get it into a usable array first before you can use it. I.e,majidali wrote:hello every ,can any explain what is "Resource id #7" means
i have fired a query-
$query="select * from custdetail order by createdON desc limit $offset,$record_per_page ";
$data=mysql_query($query);
echo $data;
this echo prints Resource id #7 wat does this means how is it useful.......
Code: Select all
$query="select * from custdetail order by createdON desc limit $offset,$record_per_page "; $data=mysql_query($query); while($row = mysql_fetch_array( $data)) { echo $row['field_name']; }
Re: Resource id #7 problem in mysql
When you perform a query, mysql_query() returns the Resource ID for that Query, NOT the raw data from the database. You then use that resource id ($data) to extract the data from that Query.majidali wrote:thanx for that but i want to know wat does Resource id #7 ......Turv wrote:That's because $data is literally just the Resource ID from the Query - You have to get it into a usable array first before you can use it. I.e,majidali wrote:hello every ,can any explain what is "Resource id #7" means
i have fired a query-
$query="select * from custdetail order by createdON desc limit $offset,$record_per_page ";
$data=mysql_query($query);
echo $data;
this echo prints Resource id #7 wat does this means how is it useful.......
Code: Select all
$query="select * from custdetail order by createdON desc limit $offset,$record_per_page "; $data=mysql_query($query); while($row = mysql_fetch_array( $data)) { echo $row['field_name']; }