Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

if else echo


ghost's Avatar
0 0

Okay, my CMS is going great .. But … I need help with one little thing … Okay, my news system pulls the news out of a database. So the origional code i made was markupprint ("$content"); (content was defined earlyer in the document) Okay, so you might have guessed if $content contained any php, the script would fail and nothing would be displayed…. So .. I added an extra collum to my sql table called ifphp …. if the content had php in it i must set ifphp to 1 and otherwise leave it null ….. So .. I need help making my script to use this .. as i keep getting errors ….

$content;
} else {
	echo $content;
}```

Any ideas???

ghost's Avatar
0 0

Change it back and don't put php in news posts?


ghost's Avatar
0 0

sighs k


ghost's Avatar
0 0

if ( ifphp == 1 ) eval ( $content ); else echo $content;


ghost's Avatar
0 0

missed out an } But now nothing comes up :(


ghost's Avatar
0 0

I got a better idea … can anyone help me mod this script <?php include "config.php"; ?>

&lt;?php
$id = $_GET[&#39;id&#39;];
database_connect();
$query = &quot;SELECT * from content
          WHERE id = $id&quot;;
$error = mysql_error();
if (!$result = mysql_query($query)) {
    print &quot;$error&quot;;
	exit;
	}

while($row = mysql_fetch_object($result)){
  $content = $row-&gt;text;
  print(&quot;$content&quot;);
	}
 
?&gt;

So that I can also link directly to pages and open them in iframe "centerframe" instead


ghost's Avatar
0 0

how about

if ($phpif==1) $id2 = ($text); else $id2 = ("page.php?id=$id\");


ghost's Avatar
0 0

Where does $text come from?

Can you explain exactly what you are trying to do and show the entire source