Jump to content


Photo

ARRRRRGGGGHHHH!!! PHP SQL and Includes


  • Please log in to reply
1 reply to this topic

#1 empireempire

empireempire
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 23 May 2006 - 07:12 AM

The problem: Included html file (navigation) is appearing within the <div> of another block for no apparent reason. however it stops when i delete the SQL call to the db, and more specifically the echo ing of rows (see ***)


PHP:

<body bgcolor="#666666">
<div id="pagecontainer"></div>
<div id="news">
<?php
// connect to server, database, table.
include ("http://www.empireemp...db_connect.inc");
$sql = mysql_query("SELECT * FROM sitenews");

while ($row = mysql_fetch_row($sql)) {
echo "$row[0] $row[1] $row[2]" ; <------------ PROBLEM HERE??? **** WORKS WHEN DELETED
} ?>
</div>
<div id="buttons">
<?php include ("http://www.empireemp...mebuttons.html"); ?>
</div>

<div id="footer"><? include ("http://www.empireemp...es/footer.html"); ?>
</div>

</body>
</html>


#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 23 May 2006 - 08:17 PM

That's not a MySQL problem, that's a PHP problem... I assume that you can do variable interpolation, but maybe not with array references? Try doing a proper concatenation step.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users