Hi
I have the following code stored in FIELD2 in a database (mySQL):
<table width="100%" height="200px">
<tr>
<td><?php echo($display["FIELD1"]); ?></td>
<td> </td>
</tr>
</table>
In my script I have the following code:
<?php
while ($display = mysql_fetch_array($data)) {
$FIELD1=$display["FIELD1"];
$FIELD2=$display["FIELD2"];
echo $FIELD2;
}?>
When I print $FIELD1 individually it displays correctly, but when I print FIELD1 within FIELD2, FIELD2 displays correctly but $FIELD1 does not execute. What am I doing wrong?
Thnx
Trouble displaying variables
Moderator: General Moderators
-
DanielleDee
- Forum Newbie
- Posts: 3
- Joined: Mon Aug 09, 2004 9:28 am
Hi
I have adjusted the code in the database (field name = TEXT) as follows:
Now I get the error:
Parse error: parse error, unexpected '.' in ../test.php(18) : eval()'d code on line 7
test.php(18) is the eval() code line, but there is no '.' in the evaluated code?
Thanks
?>[/quote]
I have adjusted the code in the database (field name = TEXT) as follows:
I've added the following code to the main page:<table width='100%' border='0'><tr><td width='298' height='200' align='center' valign='top' unselectable='ON'><img src='../photos/$IMAGE'></td>
<td width='244' align='left' valign='top'>text</td>
</tr>
</table>
Code: Select all
<?php
eval("\$TEXT = "$TEXT";");
echo $TEXT. "\n";
?>Parse error: parse error, unexpected '.' in ../test.php(18) : eval()'d code on line 7
test.php(18) is the eval() code line, but there is no '.' in the evaluated code?
Thanks
?>[/quote]
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
I don't see a point in trying to set a variable to itself in that manner..
try something like this:
try something like this:
Code: Select all
<table width="100%" height="200px">
<tr>
<td>{S_DATA}</td>
<td>&nbsp;</td>
</tr>
</table>Code: Select all
<?php
while ($display = mysql_fetch_array($data)) {
$FIELD1=$display["FIELD1"];
$FIELD2=$display["FIELD2"];
echo str_replace('{S_DATA}',$FIELD1,$FIELD2);
}?>