Jump to content

[SOLVED] wont display results or else statement


runnerjp

Recommended Posts

i really cant figure out what im doing wrong here

in my db i have a time set as:04-15-2009...

 

my sql output is:SELECT * FROM events WHERE date=04-15-2009

 

but when i look on the page i get nothing

<?php
include 'settings.php'; 
$yes=$_GET['month'];

$sql = "SELECT * FROM events WHERE date=$yes";

$postsresult = mysql_query($sql);
// IF mysql_query() RETURNS FALSE, THERE IS DIAGNOSTIC INFORMATION AVAILBALE
$num = mysql_num_rows($postsresult);

while($row = mysql_fetch_assoc($postsresult)) {
if($num < 1)
    { 
echo $row['event'];}
else
{ echo 'no events';}
}
?>

Try this, it will echo out your $yes and a row (if the row exists)

 

<?php
include 'settings.php'; 
$yes=$_GET['month'];

$sql = "SELECT * FROM events WHERE date='$yes'";
$postsresult = mysql_query($sql);
$row = mysql_fetch_array($postsresult);
echo $yes;
echo '<br>';
echo $row['event'];
?>

i put it in quotes and still nothin...

 

<?php
include 'settings.php'; 
$yes=$_GET['month'];

$sql = "SELECT * FROM events WHERE date='$yes'";
$postsresult = mysql_query($sql);


// IF mysql_query() RETURNS FALSE, THERE IS DIAGNOSTIC INFORMATION AVAILBALE
if (!postsresult)
{
   $errmsg = mysql_errno() . ' ' . mysql_error();
   echo "<br/>QUERY FAIL: ";
   echo "<br/>$sql <br/>";
   die($errmsg);
}
$row = mysql_fetch_array($postsresult);
echo $yes;
echo '<br>';
echo $row['event'];
?>

 

the output said nothin of errors :S

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.