
- You are not logged in. | Login
January 19, 2007 11:01 am
- napkdd1
- Member


Statistic and deleting, MySQL and PHP
I’ve made an edition on ID and so on…
But I cannot do deletion from the data base. Does someone know how to do it? Don’t write a script – just give a tip! And after that: we make field stat_today and stat_all in the table quest. And when a user enters a page 1 is added to stat_today and stat_all and when 24 hours are over stat_today is nulled… Is it possible somehow?
January 19, 2007 11:10 am
- phppat
- Member


Re: Statistic and deleting, MySQL and PHP
I understood what you need but I cannot answer until I know your precise needs. If nulling in 24 hours is everything you need – hang it on crown, it will delete….
PHP monster
January 19, 2007 11:16 am
- PHPprof
- Member


Re: Statistic and deleting, MySQL and PHP
DELETE FROM `name of a table ` WHERE `id`='meaning ' LIMIT
I'll come to win... wait...
January 19, 2007 11:17 am
- napkdd1
- Member


Re: Statistic and deleting, MySQL and PHP
I’ve written:
if($action == del){
$query = "DELETE FROM quest WHERE id='$id'";
}
In the input line I write:
red.php?id=1&action=delIt doesn’t work
What can I do to have following by the page entrance?
quest.php?id=1
In the string where id=1 into fields stat_all/today 1 was added?
January 19, 2007 11:23 am
- PHPprof
- Member


Re: Statistic and deleting, MySQL and PHP
It’s natural that it doesn’t work. You’ve conferred string DELETE FROM quest WHERE id='$id' to variable $query
if($action == del)
{
$query =mysql_query("DELETE FROM `quest` WHERE `id`='".$id."' limit 1");
}Don’t forget to rewrite all the signs like ` " '. They all differ from each other and without them something can be out of order or function wrong.
P.S. Read some book about MySQL
P.P.S. And what exactly are you interested in? How to make a field or how to clean the base?
I'll come to win... wait...
January 19, 2007 11:27 am
- napkdd1
- Member


Re: Statistic and deleting, MySQL and PHP
I’m interested in what I should put on the page to enable adding numbers in it (+1).... by entrance. And how to do so that field stat_today would be blanked at midnight.
Thanks for help with deleting.
January 19, 2007 11:32 am
- R@mzess
- Member


Re: Statistic and deleting, MySQL and PHP
One more field is needed - last_visit. Then you’ll be able to delete ‘today’ and to add ‘total’.
January 19, 2007 11:33 am
- mdwb
- Member


Re: Statistic and deleting, MySQL and PHP
‘today’ may be accomplished as request; there’s no need to save it in the base.
Don't be afraid of life, it is yours!
January 19, 2007 11:37 am
- R@mzess
- Member


Re: Statistic and deleting, MySQL and PHP
Really, what for? Isn’t it easier to save the date of event and select a quantity within necessary interval? But it’s a question of architecture.
January 19, 2007 11:43 am
- napkdd1
- Member


Re: Statistic and deleting, MySQL and PHP
I said the first that was easier from my point of view. And I have no idea how to do that what you’ve suggested 
January 19, 2007 11:45 am
- R@mzess
- Member


Re: Statistic and deleting, MySQL and PHP
What can be easier?
We record timestamp of each addressing into a table and then select:
select count(id) from table where id=$id -> we get stat_total
select count(id) from table where (action_timespamt between $start and $end) and id=$id -> we get stat_today for any period of time (between $start and $end)


