Thank you Feherke, it's a doddle when you spot it. I've been toying with the pattern that long I don't even think I was looking at the string.
Wood for trees!
Cheers
H
Hi,
I have the following code:
if (!ereg('^[a-z_]$', '$sec')) {
// failed url validation
echo "You are not allowed to access this page in that way";
} else {
$sec is a variable passed in the URL that I want to make sure is only lowercase letters or underscore, the above code fails...
I'm not totally sure what you mean here, but the best you can do is reset the auto_increment value to one greater than the highest value (otherwise mySQL would try and overwrite the value when it found it in an existing record).
Use phpMyAdmin, enter your tables structure and choose Operations...
It's OK, I got it working. I was trying to use DATE_SUB earlier and I stupidly broke the query by using bad syntax, so I was trying to use straightforward arithmetic to test the string.
The syntax I am now using is as follows;
SELECT * FROM news
WHERE sec='$sec'
AND unix_timestamp(published)...
Hello,
I'm not an expert in mySQL, hence being here!
I've a database 'news' that has several sections 'sec', I store records as 'published' and have a counter 'read_count' which is increased by 1 each time it is viewed.
I want to be able to list the top 6 stories as most read, but want also...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.