开发者

Change the result of mysql_query

开发者 https://www.devze.com 2023-01-12 03:18 出处:网络
Can I modify the result that I have received from mysql_query than reset the pointer with mysql_data_seek($result, 0) and process the output like from normal query

Can I modify the result that I have received from mysql_query than reset the pointer with mysql_data_seek($result, 0) and process the output like from normal query

Dummy example:

$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
   $row[$fieldName] = $this->someFunction($row['id']);
}
mysql_data_seek($result, 0);

In current example it doesn't works. T开发者_如何转开发he changing that I made to $row doesn't save. Is it possible to realise such idea, about changing $result?


You need to make a whapper around $result to make such things. But i advice you to change your minnd about why do you need it. There should be better way


It would be possible if you'd used e.g. PDO. But with the "old" mysql extension? No, not the way you most likely want it to work.

0

精彩评论

暂无评论...
验证码 换一张
取 消