Convert to String
Posted: Sun Mar 27, 2011 12:47 pm
Is there any way to convert Resource id # to a string ?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
$query = mysql_query("SELECT * FROM table");
echo $query;
// echoes 'Resource id #
?>
Dear social experiment, thanks for your valuable reply. Yes, you are correct. now, Let's check the code below.social_experiment wrote:Resource id # can be a result received from a mysql query. You have to pass the resource id to something like mysql_fetch_array().
Code: Select all
$file = fopen("myfile.txt", "w");
var_dump($file);
Code: Select all
$file = fopen("myfile.txt", "w");
var_dump($file); //resource(3) of type (stream) (output)
echo "<br>";
fclose($file);
var_dump($file); // resource(3) of type (Unknown) (output)