Copy link to clipboard
Copied
Hi everyone!
Im making a site with PHP, and wonder if i can achieve this:
First: Let's say that the db has 30 records in a table, and i want to change a particular data in all the records. How can i do this?
Second: In the same way, how can i delete all the records of that table?
For example:
table 'example'
cols id, title, content, description
If i want to "reset"(change it's value to none, for example) the 'description' value in all the records of that table, how can i do that?
And second: how can i truncate the whole table? (TRUNCATE = dump all the data inside the table, right?)
All of this from php, not from phpmyadmin lol!
Thanks in advance
Cheers!
Like I said in the previous reply: use the UPDATE and DELETE MySQL commands. Look 'em up for examples. There's plenty of examples out there that will do what you want. Basic examples are:
UPDATE table_name SET column_name=something, column_name_2=sometingelse
or
DELETE FROM table_name where field = something.
Copy link to clipboard
Copied
You don't need php to do this, it's technically MySQL that does this.
use UPDATE,and DELETE functions in mysql. Look 'em up for examples. If you want to dump a table then use DUMP.
Copy link to clipboard
Copied
Thanks for the reply IPHP
I know this actions are maded by mysql. But the site has an administrator section, and i wish to add that functionality IN the administrator page. For example, if i want to update a single record, i can do it trough the update form, build it with the prebuilded scripts in DW. But if i want to update ALL the records, what are the tweaks i need to make in that script to achieve this goal?
Like a link: when the user clic that link, the page linked take this action:
1º: Turn all the values from column 'description' in db 'example' to ' '
2º: After that, go to (some page)
Same mode to truncate the data in the table, not the table itself
Cheers!
Copy link to clipboard
Copied
Like I said in the previous reply: use the UPDATE and DELETE MySQL commands. Look 'em up for examples. There's plenty of examples out there that will do what you want. Basic examples are:
UPDATE table_name SET column_name=something, column_name_2=sometingelse
or
DELETE FROM table_name where field = something.
Copy link to clipboard
Copied
So sorry IPHP, didn't understand you in the first reply
Thanks a lot!
I'm gonna look for this and see what happens
Cheers, and thanks again!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more