![]() |
|
Welcome to the Computer Webmaster Gaming Console Graphics Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| |||||||
| PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 | ||
| Can anyone help me ? I'm just fractionally past being a newbie <-- what's that then? A n.bie mebbe. I'm streamlining a website with 70 different clients on it, putting all details into a mysql $db, and just loading 1 php page depending on the client chosen, and grabbing that client's details to view. Easy so far. What I'd like to do though is record at the same time incremental hits to that specific client. So it must mean recording displays of that specific row - or would it be instances of the passed variable back at the page? Ie, $name=client. And then adding a count to a field in that row, I assume. But how? I don't have any code because I'm not sure how to begin. If anyone can help, or at least show me where to begin, i"d be grateful. Thanks | |||
| | #2 | ||
| george say... > Can anyone help me ? > > I'm just fractionally past being a newbie <-- what's that then? A > n.bie mebbe. I'm streamlining a website with 70 different clients on > it, putting all details into a mysql $db, and just loading 1 php page > depending on the client chosen, and grabbing that client's details to > view. Easy so far. > > What I'd like to do though is record at the same time incremental hits > to that specific client. So it must mean recording displays of that > specific row - or would it be instances of the passed variable back at > the page? > Ie, $name=client. > > And then adding a count to a field in that row, I assume. > But how? create a table where you have a client field which is a primary key, and a count field which is an int field. Query might be something like this: <? // if $name=client $result = mysql_query("SELECT * FROM counts WHERE client='" . $name . $'"); if (mysql_num_rows($result) == 0) { // client has never visited, so create a row in the table $result2 = mysql_query("INSERT INTO counts (client,count) VALUES ('" . $name . "',1)"); } else { // client has been before, so update count $result2 = mysql_query("UPDATE counts SET count=count+1 WHERE client='" . $name . "'"); } ?> I think this is the sort of thing you're after. Obviously you don't necessarily need a seperate table for this, the 'count' field could be in the client table but you get the idea. -- Nathan. XBL Gamertag: Cowfield http://www.cowfields.com Bow to the Cow! | |||
| Featured Websites | ||||
|
![]() |
| Tags: count, different, page, php, using, variables, visitors |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Use count and group by? | Brian Bendtsen | Database | 1 | 06-26-2007 12:09 AM |
| I can count | scoopex | Console Subjects | 2 | 06-11-2007 1:01 AM |
| problem with select count(*) | Ben | Database | 2 | 05-31-2007 8:49 PM |
| SELECT COUNT(*) problem | JB | Database | 3 | 05-31-2007 8:42 PM |
| php count down clock | Stickster | PHP | 9 | 05-22-2006 7:58 PM |
| Featured Websites | ||||
|