PDA

View Full Version : News output problem


Mark_W
06-11-2007, 10:59 PM
I have two documents, both of them have the same PHP running inside them. The only real difference between the two documents is one is running on tables and the other has been recreated using DIVs.
The table document is running perfectly, the news content which is in the database displays exactly how it should on the page.
The DIV document however wont display the news content, but decides to display the following error.


Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Playawayuk\index.php on line 73
The following is the PHP at the top of the page.

<?php
require_once("connections/connection.php");

///////////////////////////////////
$user = $_POST['user'];
$pass = $_POST['pass'];
$submit = $_POST['submit'];
///////////////////////////////////

///////////////////////////////////////////////
$query = sprintf("SELECT * FROM newscontent LIMIT 5");
$result = @mysql_query($query);
$row = @mysql_fetch_array($result);
//////////////////////////////////////////////

?>The following is the PHP code used for the news content box.

<?php do { ?>
<div id="content">
<div id="contop"><?php echo $row['news_name']; ?></div>
<?php echo $row['news_brief']; ?></div>
<?php }while ($row = mysql_fetch_array($result)); ?>Line 73 is the final row of the above PHP.

This has been confusing me all day and most of last night. I cannot understand why it wont work when it is perfectly the same as the other document.

Mark

davidj
06-12-2007, 05:42 AM
its a warning

@mysql_fetch_array($result));

stick an @ in front