how do i limit my search result to be echod
Posted: Fri Jul 23, 2010 10:34 am
Hello Friends,
I am developing a website where vacancies can be posted. Enployers will have to fill a form which include number of I weeks the vacancies would be available. I have a table in my database where the entries will be kept. I have converted the number of weeks the vacancies will be available to days and have added it to the date which the vacancy is posted to get the date the vacancy will expire. On my home page where the visitors can view the avalable vacancies, I tried subtract today's (everyday) date from the expiry date and echo the result of vacancies which are still available. i used the code below but it didn't work
The end date is also in this format date("d M y"). But am receiving this error
regards
adsegzy
I am developing a website where vacancies can be posted. Enployers will have to fill a form which include number of I weeks the vacancies would be available. I have a table in my database where the entries will be kept. I have converted the number of weeks the vacancies will be available to days and have added it to the date which the vacancy is posted to get the date the vacancy will expire. On my home page where the visitors can view the avalable vacancies, I tried subtract today's (everyday) date from the expiry date and echo the result of vacancies which are still available. i used the code below but it didn't work
Code: Select all
<?
$table_name=vacancies;
$column_name=end_date;
$date=date("d M y", time());
$getvac=mysql_query("SELECT * FROM $table_name WHERE $column_name - $date > 0 ORDER BY id DESC");
if(mysql_num_row($getvac)==0)
echo "NO VACANCY IS AVAILABLE.";
else
{$result=mysql_fetch_array($getvac);
...}
?>
Pls what can i do or what are the other ways out because i want to echo only those vacancies whose end_date is greater than zero.Warning: mysql_num_rows(): supplied argument is not a valid Mysql result resource
regards
adsegzy