i am writing a program and i need to increment a table row. How would i increment a table row on the click of a button?

Recommended Answers

All 7 Replies

It depends on what you mean by increment the table row. If you are referring to incrementing it for insert then simply create the field as an auto-increment in MySQL and the database will auto-increment the field for you.

If you are simply trying to get to the next record in the table then post the current record_ID into a new field and add one to it. Then select the record where the record_id equals the new variable.

ok, lets say there are 2 rows. one that username. the username is john.
the next one is number. the number is 1. I want onclick 1 is added to the number. so after one click the row would be 2. after another the row would be 3

Are you sure you shouldn't be using javascript for this, instead of PHP?

yes. i need to increment a database row

Member Avatar

The database row should be incremented automatically. If you set autoincrement to your primary key.

Is that what you're getting at? *confused.ardav*

if you want to increment row dinamically the best way is to use Javascript

ok. but how would i do that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.