| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Question about ALTER MySQL Command | |
|---|---|
| Tweet Topic Started: Mar 15 2005, 01:02 PM (380 Views) | |
| Dennis | Mar 15 2005, 01:02 PM Post #1 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Well, I'm setting up a script that will redirect you to an external link, and I want it to increment a hit. Kind of like a TopSites type of thing. At the moment, I've got a few questions: 1. Can I send a header() function after a MySQL Query, and if not, what can I use in it's place? 2. What is the command for altering a row? More specifically, adding +1 to the value of total hits. 3. Is there a way to record a person's IP address, and would I have to store it in a seperate Table? 4. What is the easiest way to redirect to another page with PHP? Thanks! |
![]() |
|
| Ben | Mar 15 2005, 03:21 PM Post #2 |
|
Quantum-locked when observed.
![]()
|
I'm not quite sure on this one, I think the answer is yes. But if it doesn't work, try putting the header before the query and seeing if it still executes.
Use UPDATE:
Yes, a person's IP address is stored in the $_SERVER["REMOTE_ADDR"] variable. So just use a MySQL insert command like so:
Once again, the only way I know how to do it would be with a header() statement. :/ |
![]() |
|
| Gornakle | Mar 15 2005, 03:50 PM Post #3 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
As long as nothing was outputted to the screen (echo/print etc), you can use header(). You could also use output buffering to store all output temporarily, then use header(), and then flush the output to the screen.
Just a note.. but a faster way would be the following. Saves a query. ![]()
|
![]() |
|
| Dennis | Mar 15 2005, 04:13 PM Post #4 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Cool! Thanks guys. |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Technology Chat · Next Topic » |
| Track Topic · E-mail Topic |
2:37 PM Jul 11
|



![]](../../../../0/1/0/p601690/pipright.png)





2:37 PM Jul 11