You are here: Re: Change value in result « PHP Programming Language « IT news, forums, messages
Re: Change value in result

Posted by Oli Filth on 09/28/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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация