|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I need to be able to increase a variable with one, each time the specifik site is loadet. i have tried putting it into a database (db) each time logon accurs, and then fetch the db and then add '1' to the number, then save it again. But it dosn't work properly, it keep displaying 1 each time, and not increase it self.
Can enayone give an idear to hov this is done. - Pheifel |
|
#2
|
|||
|
|||
|
Your idea will work. If it isn't the coding is bad somewhere. If you want, paste the code here.
|
|
#3
|
|||
|
|||
|
sure.... here goes
PHP Code:
but here, it doesnt print an increaing number, but keeps printing '1' and it doesnt insert into th db either. Thus never loading an creasing number. |
|
#4
|
|||
|
|||
|
hi. try
$ny = $NYT['id'] + 1; just a try |
|
#5
|
|||
|
|||
|
i have tried that. And it gives the result of the new id as '1'... meaning, that it did not increase.
- Pheifel |
|
#6
|
|||
|
|||
|
i think the statement $ny = $NYT[id] + 1;
is read as $ny = 0 + 1; which always results to 1, since there is nothing in $NYT[id]. use the actual field name 'userid' instead of 'id' try a $ny = $NYT[userid] + 1; or $ny = $NYT['userid'] + 1; |
|
#7
|
|||
|
|||
|
here... i made it work this way
:[PHP] $NAME = mysql_fetch_array(mysql_query("SELECT * FROM USER_uploads WHERE userid = $USERID ORDER BY time DESC LIMIT 1")); $navn = $NAME[id] + 1; |
|
#8
|
|||
|
|||
|
great. i also made a mistake in my solution. supposed to be $nyt instead of $NYT
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Auto incriments |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|