Im trying to get a select line to work so i can call from the database information after a date (supplied by the user) and before another date (also supplied by the user)
The date type in the database is varchar and the user selects the six varibles
$fromdate
$frommonth
$fromyear
$todate
$tomonth
$toyear
The problem is whatever i try it comes up with this.
Warning: Supplied argument is not a valid MySQL result resource in C:\Inetpub\wwwroot\John\newsa.php on line 136
and this is the entire coding
//connect to database and select info
$sql="SELECT * FROM news WHERE date <= £toyear'-'$tomonth'-'$todate AND date >= £fromyear'-'$frommonth'-'$fromdate;"
$result=mysql_query($sql,$db);
$num = mysql_num_rows($result); <----- line 136
$cur = 1;
while ($num >= $cur) {
$row = mysql_fetch_array($result);
$id = $row["id"];
$name = $row["name"];
$title = $row["title"];
$news = $row["news"];
$date = $row["date"];
$time = $row["time"];
//PHP scripts to convert from MySQL date format (2000-09-15) to a format like mm/dd/yyyy.
$string = "$date";
$stringArray = explode("-", $string);
$date = mktime(0,0,0,$stringArray[1],$stringArray[2],$stringArray[0]);
$convertedDate = date("d/m/Y", $date);
$cur++;
};
can anyone please help me out