I have a strange problem with what I think is life span of variable value or php.ini setting or mysql setting or something.
The following code goes into a script that provides multiple pages for the user to browse through. If I hard code the 'where' clause values into the sql statement everything works fine - page after pages of the correct database data. However, I want to make the SQL query dynamic by allowing the user to choose town, county and postcode. The first script works fine (hardcoded where values). The second script (dynamic values) only shows results on the first web page.
"SELECT * FROM customers
where cust_new = 'Y'
and cust_town = 'testTown'
and cust_county = 'testCounty'
and cust_postcode = 'testPostcode'
ORDER BY cust_reg_date ASC
LIMIT $page, $limit" // these are numeric variables set up for pages
"SELECT * FROM customers
where cust_new = 'Y'
and cust_town = '".$town."'
and cust_county = '".$county."'
and cust_postcode = '".$postcode."'
ORDER BY cust_reg_date ASC
LIMIT $page, $limit" // these are numeric variables set up for pages
Anybody got any ideas on what's causing this problem ?