PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I don't have a clue as to why this does not work in php, but it does, when I copy and paste the select statement directly into the mysql command line. I get a blank screen when I run this on php; I connect to the db successfully. Can anyone tell me why it would not show?
<?php
include ('connect_db.php');
function selectfrom()
{
$rs7 = mysql_query ("SELECT item1, COUNT(item1) from products where Date > DATE_ADD(CURDATE(), INTERVAL -25 DAY group by item1)");
while($row7 = mysql_fetch_array($rs7))
{
echo $row7['item1']." ".$row7['COUNT(item1)']."<br>";
}
}
selectfrom();
?>
Last edited by Weirdan on Fri Jun 26, 2009 12:03 pm, edited 2 times in total.
Reason:added [code] tags
Im not in a position to test your code at the moment, but are you sure it is error free? Sometimes if error reporting is disabled completely you will get a blank page if an error occurs. Try turning on error reporting. In your code include ('connect_db.php') needs to be include ('connect_db.php'); you just missed a semi colon, that also could be your problem.
Thanks for the reply juma929, I left that semicolon off during the copy paste, it is there on the actual code. It does connect to database just fine. I will take you advice and add error coding. Thx again.