Crowds
08-21-2006, 01:14 AM
I have an error displaying as
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /homepages/18/d152801671/htdocs/Crowds_Design/CDblog/Admin/inc/clist.php on line 16
Line 16 is where I have a while loop.
<?php
error_reporting (E_ALL);
require '../Connections/CDblog.php';
// Connect to the database
mysql_connect($hostname_CDblog,$username_CDblog,$password_CDblog) or die(mysql_error());
mysql_select_db($database_CDblog) or die(mysql_error());
$area = '4';
echo "this is the area selected $area";
$query="SELECT id, name, email, url, message, title_art".
"FROM CDblg_comments".
"WHERE title_art = '$area'" or die(mysql_error());
$sql = "SELECT * FROM CDblg_comments ORDER BY id DESC LIMIT 150" or die(mysql_error());
$result = mysql_query($sql);
while ($record = mysql_fetch_object($result)) {
?>
<a href="?q=edit&id=<? echo "$record->id"; ?>">update</a> | <a href="" onClick="return confirm('remove (<? echo "$record->id"; ?>)?')">delete</a>
<b><? echo "$record->id"; ?></b></font><p></p>
<?
}
?>
And my sql table for CDblog_comments is
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(30) NOT NULL,
email VARCHAR(50) NOT NULL,
url VARCHAR(50) NULL,
message TEXT NOT NULL,
entry_date DATE NOT NULL,
ip VARCHAR (30) NOT NULL,
title_art VARCHAR (100) NOT NULL default '',
PRIMARY KEY(id)
I have used something very similar for another table and it works just fine...
Can anyone spot where I am going wrong ?
Crowds
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /homepages/18/d152801671/htdocs/Crowds_Design/CDblog/Admin/inc/clist.php on line 16
Line 16 is where I have a while loop.
<?php
error_reporting (E_ALL);
require '../Connections/CDblog.php';
// Connect to the database
mysql_connect($hostname_CDblog,$username_CDblog,$password_CDblog) or die(mysql_error());
mysql_select_db($database_CDblog) or die(mysql_error());
$area = '4';
echo "this is the area selected $area";
$query="SELECT id, name, email, url, message, title_art".
"FROM CDblg_comments".
"WHERE title_art = '$area'" or die(mysql_error());
$sql = "SELECT * FROM CDblg_comments ORDER BY id DESC LIMIT 150" or die(mysql_error());
$result = mysql_query($sql);
while ($record = mysql_fetch_object($result)) {
?>
<a href="?q=edit&id=<? echo "$record->id"; ?>">update</a> | <a href="" onClick="return confirm('remove (<? echo "$record->id"; ?>)?')">delete</a>
<b><? echo "$record->id"; ?></b></font><p></p>
<?
}
?>
And my sql table for CDblog_comments is
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(30) NOT NULL,
email VARCHAR(50) NOT NULL,
url VARCHAR(50) NULL,
message TEXT NOT NULL,
entry_date DATE NOT NULL,
ip VARCHAR (30) NOT NULL,
title_art VARCHAR (100) NOT NULL default '',
PRIMARY KEY(id)
I have used something very similar for another table and it works just fine...
Can anyone spot where I am going wrong ?
Crowds