Jump to content


Photo

php not working...


Best Answer darkfreaks, 20 June 2013 - 04:01 PM

still ain't working i am thinking could it do with the fact that some of the javascript seems to be commented out?

 

 

Go to the full post


  • Please log in to reply
5 replies to this topic

#1 darkfreaks

darkfreaks

    Advanced Member

  • Members
  • PipPipPip
  • 4,951 posts
  • LocationAustin,Texas

Posted 20 June 2013 - 02:18 PM

<?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, 20 June 2013 - 02:20 PM.


#2 AbraCadaver

AbraCadaver

    Cracka Memba

  • Gurus
  • 1,889 posts
  • LocationThe Republic of Texas

Posted 20 June 2013 - 02:22 PM

http://www.catb.org/...-questions.html


mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.

#3 AbraCadaver

AbraCadaver

    Cracka Memba

  • Gurus
  • 1,889 posts
  • LocationThe Republic of Texas

Posted 20 June 2013 - 02:28 PM

In heredoc syntax you don't need to break in and out of the double quotes and you don't concatenate with the dot.  Just put the HTML in there with the variables.


mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.

#4 darkfreaks

darkfreaks

    Advanced Member

  • Members
  • PipPipPip
  • 4,951 posts
  • LocationAustin,Texas

Posted 20 June 2013 - 02:36 PM

i took the doublequotes and dots out it still is blank.



#5 AbraCadaver

AbraCadaver

    Cracka Memba

  • Gurus
  • 1,889 posts
  • LocationThe Republic of Texas

Posted 20 June 2013 - 02:41 PM

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 />";

mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.

#6 darkfreaks

darkfreaks

    Advanced Member

  • Members
  • PipPipPip
  • 4,951 posts
  • LocationAustin,Texas

Posted 20 June 2013 - 04:01 PM   Best Answer

still ain't working i am thinking could it do with the fact that some of the javascript seems to be commented out?

 

 


Edited by darkfreaks, 20 June 2013 - 04:03 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com