Posted by Oli Filth on 09/30/79 11:37
ByteCoder said the following on 16/01/2006 10:40:
> Is it possible to change the value in a resultset?
No.
<...SNIP CODE...>
> I want to do this because I don't want the writer of a web page to have
> to bother about stripslashes() and the like. In that scenario the writer
> of the web page would execute a function to get the contents of a table.
> I would then get the result, do a stripslashes on the columns that need
> it, reset the pointer to the first row and then return the result.
Put the processed results into a temporary array, and then return that
array. e.g.:
<?php
$processedResults = array();
while($row = mysql_fetch_array($result))
{
/* process row here */
$row['username'] = stripslashes($row['username']);
$processedResults[] = $row;
}
/* $processedResults now holds all processed rows */
?>
Incidentally, why are you storing stuff in your databases in a way that
requires stripslashes() to be called? Just store the raw text, don't
apply addslashes() or whatever to it.
--
Oli
[Back to original message]
|