RE: [PHP] Parsing database variables
| From: | Jake McHenry | Date: | Fri, 30 Mar 2007 21:06:50 +0000 |
| Subject: | RE: [PHP] Parsing database variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251802@lists.php.net to get a copy of this message | ||
thought about that, I would need to do one ereg for each variable then
correct? as of right now, there are 0 variables in the first field, and 17
in the second... so it would be 17 ereg replaces... then if i add or change
anything, possibly more...
This will work, but was hoping for an easier way...
Jake
_____
From: Daniel Brown [mailto:parasane@gmail.com]
Sent: Friday, March 30, 2007 5:02 PM
To: Jake McHenry
Subject: Re: [PHP] Parsing database variables
Jake, could you use ereg_replace() to do that?
<?
//....
while($row = mysql_fetch_array($result)) {
$html = ereg_replace("$"."name",$name,$row['column_name'];
}
I split the first field of the ereg_replace() input so that it wouldn't
be read by the function as a variable.
On 3/30/07, Jake McHenry <HYPERLINK
"mailto:linux@nittanytravel.com"linux@nittanytravel.com>
wrote:
Sorry.. Typos... But that's not the point... I looked the function... Dunno
how I missed it.... Thanks... Do you know if eval() has any size limitations
to it? The database fields are about a page each....
Thanks,
Jake
> -----Original Message-----
> From: Jay Blanchard [mailto: HYPERLINK
"mailto:jblanchard@pocket.com"jblanchard@pocket.com]
> Sent: Friday, March 30, 2007 4:50 PM
> To: Jake McHenry; HYPERLINK
"mailto:php-general@lists.php.net"php-general@lists.php.net
> Subject: RE: [PHP] Parsing database variables
>
> [snip]
> I have a database table with this in it:
>
>
> <p>$name<p>
> Period Ending Date: $ppe<p>
> Etc.......
>
>
> And in my script, these variables exist and have values. Is
> there a way
> for
> me to get the output from mysql_query to use the current script
> variables in
> place of the same variable name within the database output?
> [/snip]
>
> a. Bad HTML, always use a closing tag like </p>
> b. Check HYPERLINK
> "http://www.php.net/eval"http://www.php.net/eval
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.23/740 - Release
> Date: 3/30/2007 1:15 PM
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 3/30/2007
1:15 PM
--
PHP General Mailing List (HYPERLINK
"http://www.php.net/"http://www.php.net/)
To unsubscribe, visit: HYPERLINK
"http://www.php.net/unsub.php"http://www.php.net/unsub.php
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 3/30/2007
1:15 PM
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.23/740 - Release Date: 3/30/2007
1:15 PM