Jump to content

php not working...


darkfreaks

Recommended Posts

<?php
include("../konnect.php");
$sql = mysql_query("SELECT * FROM ask") or die("MySQL Failure: " . mysql_error());

if (mysql_num_rows($sql) === 0) die("There were no rows returned");

while ($row = mysql_fetch_array($sql))
{
$msg = $row['msg'];
$mes_id = $row['mes_id'];
$up = $row['up'];
$down = $row['down'];
    
 
$echo = <<<ECHO
<div id='main'><div class='box1'><div class='up'><a href='' class='vote' id='" . $mes_id . "' title='Up' name='up'>" . $up . "</a></div><div class='down'><a href='' class='vote' id='" . $mes_id . "' title='Down' name='down'>" . $down . "</a></div></div><div class='box2' >" . $msg . " <br /><br /><div class='fb-comments' data-href='http://naturalnaring.com/engage.php?id=" . $mes_id . "' data-num-posts='2'></div><br /><br />";

ECHO;

echo $echo;
?>

 

can anyone see where i am outputting it wrong? it seems to work fine in dreamweaver locally.

Link to comment
https://forums.phpfreaks.com/topic/279395-php-not-working/
Share on other sites

This works for me (but you are missing a closing</div>)

$echo = <<<ECHO

<div id='main'>
	<div class='box1'>
		<div class='up'>
		<a href='' class='vote' id='$mes_id' title='Up' name='up'>$up</a>
		</div>
		<div class='down'>
		<a href='' class='vote' id='$mes_id' title='Down' name='down'>$down</a>
		</div>
	</div>
	<div class='box2' >$msg<br /><br />
	<div class='fb-comments' data-href='http://naturalnaring.com/engage.php?id=$mes_id' data-num-posts='2'>
	</div><br /><br />


ECHO;

Or if you want to use it the way you had it, just don't use heredoc:

$echo = "<div id='main'>
			<div class='box1'>
				<div class='up'>
				<a href='' class='vote' id='" . $mes_id . "' title='Up' name='up'>" . $up . "</a>
				</div>
				<div class='down'>
				<a href='' class='vote' id='" . $mes_id . "' title='Down' name='down'>" . $down . "</a>
				</div>
			</div>
			<div class='box2' >" . $msg . " <br /><br />
			<div class='fb-comments' data-href='http://naturalnaring.com/engage.php?id=" . $mes_id . "' data-num-posts='2'>
			</div><br /><br />";
Link to comment
https://forums.phpfreaks.com/topic/279395-php-not-working/#findComment-1437109
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.