PHP/MySQL Query Problem!
Posted: Thu Nov 29, 2007 6:43 am
hi all
trying to execute a query and display items that have been updated within the past week. am pretty sure the query itself is correct but its throwing the following error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/kumar/public_html/Storm Broadband/datequery1.php on line 10
here is all the code:
not to sure whats going wrong. any ideas? thanks for any help
trying to execute a query and display items that have been updated within the past week. am pretty sure the query itself is correct but its throwing the following error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/kumar/public_html/Storm Broadband/datequery1.php on line 10
here is all the code:
Code: Select all
<?php
include 'dbconnect.php';
$result = mysql_query('SELECT * FROM technicalproblems
WHERE updated > DATE_SUB(NOW(), INTERVAL 1 WEEK)
ORDER BY created DESC');
print "<h1>Items updated within past week</h1>\n";
if (mysql_num_rows($result)) {
print "<TABLE BORDER=\"1\"><TR STYLE=\"font-weight: bold;\"><TD>MemberID</TD><TD>First Name</TD><TD>Surname</TD><TD>Package</TD></TR>";
while($row = mysql_fetch_assoc($result)) {
extract($row);
print "<TR><TD>$updated</TD><TD>$created</TD><TD>$fk_memberid2</TD><TD>$subject</TD></TR>";
}
print "</TABLE>";
}
?>