/    Sign up×
Community /Pin to ProfileBookmark

how to retrived records in grid from mysql db to php form

hi all
i want to fetch data from mysql database table in grid in php with checkboxes.
when user select checkbox only selected data should be copied to other table and unselected data should be deleted from table.
ex. I have 2 tables request and users
and in my form i have 2 button approve and disapprove
in form all records from request table will be shown in grid with checkbox
when user select some checkboxes only selected data will be transfer to users table and unselected daata will be deleted from request table.
i am learning php .. guys please help

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@Codex_NGSep 04.2015 — PHP only executes off the server, what you need is combination of html, css, ajax, javascript, php & sql commands.

If your using check boxes you need to use ajax which send a request to a php script on the server this php script will send a query to the database, returning the results to the ajax request while using javascript to create the tables in html & css, although with out a working database this request is rather vague.
Copy linkTweet thisAlerts:
@ginerjmSep 04.2015 — As Codex says - your question presents some rather advanced programming techniques. From what I gather you want to display two tables on the screen and using a checkbox, move a set of data from what table to the other table. Correct?

To do that in real-time without a refresh of the page you do need to do some new technologies. OTOH - if you can live with the refresh and a call to the server to achieve your end result, simply make each row of your table #1 a form by itself and use a button rather than a checkbox. A click on a button will trigger a call to your server script where you can take the data from that form and put it into the set of data in your table #2, removing it from the table #1 data. Then your script simply re-builds the page and sends it back. Of course this means using a session var to keep track of the data in table #2 and another to eliminate those records from table #1.

I am imagining that you would have a set of record keys that comprise the total set of data. To start all the records belong to one html table. As you go thru the selection process to move things you would have to split that set of keys into the #1 keys and the #2 keys. I would use two session vars to hold these during the process. Then you could use those two sets (arrays?) of keys to query your db twice - once to re-build the table #1 output and once for the #2 output.

I am also changing your design from having the ability to do multiple selections at a time. If you want to do that, then you would have to use checkboxes all in one form where each box held the value of that record's key. Then you could still build the two session vars I mentioned, adding the key to the #2 var and removing it from the #1 var. Then do the re-build.

Sounds complicated but at this point in your development this will be a bit easier.
×

Success!

Help @mayur_123 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...