This topic is locked

Using search with 'where week(date) = blabla'

1/23/2006 9:03:27 AM
PHPRunner General questions
OCTheEagle author

Hi,
I've got a table which follows this query:

'SELECT number, price, year(date) as year, week(date) as week FROM supplies ORDER BY year, week, number, price'
The database consists of the columns: Number, price, date.
When I use the search function on the columns 'year' or 'week' I get an error saying 'Unknown column 'voortgang.week' in 'where clause'
This offcours is a true because the program is using 'WHERE week = 42' instead of 'WHERE week(date) = 42'.
Is there a workaround for this?

Sergey Kornilov admin 1/23/2006

Hi,
yes, you can modify GetFullFieldName function in include\dbcommon.php file.

Locate this line there:

if("supplies"==$table && $field=="week") return "`supplies`.`week`";



and replace it with:

if("supplies"==$table && $field=="week") return "week(date)";


Then do the same with year column.

OCTheEagle author 1/24/2006

Hi,

yes, you can modify GetFullFieldName function in include\dbcommon.php file.

Locate this line there:
and replace it with:
Then do the same with year column.


Thanks!, much appreciated <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=7673&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />