Is there a way in PHP to fetch a string from MySQL? Something equivalent to a mysql_fetch_string($result) function?


But doesn’t that return an array? I need a string because I need to do a domxml_open_mem(string) where string is $result.

Nevermind, what I was looking for was mysql_result($result, 0);

Yes, it returns an array. I don’t know of any built in function that do what you want. But, can’t you simply use mysql_fetch_array() or mysql_fetch_row() and then make the string yourself? Like:

$string = '';
$i = 0; // init counter
while ($row = mysql_fetch_array($result)) {
     $string .= $row[$i];

echo $string; // Here it is the string

I don’t know if that will work for you.


I found what I needed. I didn’t need to fetch at all, I just had to say

mysql_result($result, 0);

Thanks anyway.