Jump to content

php not working...


Go to solution Solved by 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.

Edited by darkfreaks
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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.