This is a discussion on "Adding 1 to Column Value" within the PHP Forum section. This forum, and the thread "Adding 1 to Column Value are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Adding 1 to Column Value
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
||||
|
Adding 1 to Column Value
Each row in my table 'content' stores a different post, and the end colum is called 'views'. When a post is viewed, I want to add 1 to the column 'Views', so I can display a list of the top viewed posts in the side bar. This is my current code:
I bets it's some stupid mistake. I'm willing to bet it's this line:
Thanks, Jack
__________________
Resources Administrator
Grilling Gurus - Interviews with the Best Web Designers and Developers in the Industry Got a Question for Ryan Carson and his Web Design/Development team Carsonified? Jack Franklin - My Blog (It's a Pen in My Mouth BTW)
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
|
|
|
||||
|
Re: Adding 1 to Column Value
Ok. I was uploading it to the wrong place! DUH! But there is still a problem:
__________________
Resources Administrator
Grilling Gurus - Interviews with the Best Web Designers and Developers in the Industry Got a Question for Ryan Carson and his Web Design/Development team Carsonified? Jack Franklin - My Blog (It's a Pen in My Mouth BTW)
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
|
||||
|
Re: Adding 1 to Column Value
i'm now guessing it might be the table structure? If it helps, here it is:
![]() Also, if you look at any post on my site, you'll see the text: 01Y above the title. This says the views before, views after, and then if the sql UPDATE has worked. So, it's saying it has?
__________________
Resources Administrator
Grilling Gurus - Interviews with the Best Web Designers and Developers in the Industry Got a Question for Ryan Carson and his Web Design/Development team Carsonified? Jack Franklin - My Blog (It's a Pen in My Mouth BTW)
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
|
||||
|
Re: Adding 1 to Column Value
Umm... You're really overcomplicating the matter
You don't need to fetch anything from the database at all. You have the views with a default value of 0 so all you need to do is.
That will update it without having to bring PHP into the story at all
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
||||
|
Re: Adding 1 to Column Value
Bloomin hell, why the hell did I do all of that when I needed just one line. Thanks Rakuli. I'll try it right away
I LOVE YOU RAKULI! Thanks a lot, I cannot belive I spent a good hour bashing my head on the desk when I only needed one bloomin line.
__________________
Resources Administrator
Grilling Gurus - Interviews with the Best Web Designers and Developers in the Industry Got a Question for Ryan Carson and his Web Design/Development team Carsonified? Jack Franklin - My Blog (It's a Pen in My Mouth BTW)
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding a column to a table | Jack Franklin | Databases | 2 | Feb 3rd, 2008 08:17 |
| SQL Syntax for adding multiple rows together from 1 column | jfergy | Databases | 3 | Jan 17th, 2006 04:12 |
| rename column name | simonneaves | Databases | 2 | Nov 11th, 2005 00:08 |
| ..copy data from column A in Table A to column B in Table B? | gecastill | Databases | 10 | Jun 23rd, 2005 18:27 |