Topic: insert + delete different records one process? (Read 756 times)
Cyberpunk Wannabe
Gender:
Posts: 35
234 credits Members referred : 0
If at first you dont suceed, try try again
« on: Apr 01, 2008, 07:59:40 PM »
Hello friends, its been a while. Hopefully somebody will be nice to me here, ive asked this question in two others forums, one with no responce and the other responce was almost insulting.
Im using php and dreamweaver, what i would like to do is make a psuedo update page.
I copy everything from one record expect one feild to another record, so the user see's this as a sort of edit page, its easy to do, just make a update record with the wizard, take out the update code and put a insert record behavior in. What i would like to do is when the user inserts the new copyed record, have the original one delete, if possible in one process.
Is this possible? any tips would be greatfully recieved x
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6309
38674 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: Apr 01, 2008, 10:27:48 PM »
just use "replace" and not "update" to do that job, anyway that will be your first hand coding job in DW (btw. great code editor)
Cyberpunk Wannabe
Gender:
Posts: 35
234 credits Members referred : 0
If at first you dont suceed, try try again
« Reply #2 on: Apr 01, 2008, 10:44:03 PM »
Yes, but..
I cant get the replace to work on the file upload, and to make it worse it's an dw extension and the case is rather, the update behavior does not work, and there is absolutely no support on the developers forum.
I have done quite a bit of hand coding, i started just makin sites in notebook yeeeears ago and then concentrated on photoshop, but more recently ive made my own cms system with some cool database joins, so im not a total noob , but yes, i did pay for a extension to upload the files for me.
« Last Edit: Apr 01, 2008, 10:45:44 PM by jaffa »
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6309
38674 credits Members referred : 374
It's time to use PHP5!
« Reply #3 on: Apr 01, 2008, 10:55:11 PM »
haha you're only a few steps away to stop working with DW extensions
try
Code:
if (!empty($_POST['your_rec_id'])) { // validat first that all fields are filled mysql_query("DFELETE FROM tabel WHERE id =".(int)$_POST['your_rec_id']); // place here the insert statement, maybe you should reuse the old rec id }
btw. I don't understand why you can't update a record together with a file upload?
Cyberpunk Wannabe
Gender:
Posts: 35
234 credits Members referred : 0
If at first you dont suceed, try try again
« Reply #6 on: Apr 04, 2008, 02:38:07 AM »
Call to undefined function: getsqlvaluestring() in line 118 ($query_rs_copy = sprintf("SELECT * FROM rooms WHERE idroom = %s", GetSQLValueString($colname_rs_copy, "int"))
Cyberpunk Wannabe
Gender:
Posts: 35
234 credits Members referred : 0
If at first you dont suceed, try try again
« Reply #11 on: Apr 08, 2008, 01:27:52 PM »
When i go to this 'edit' page, the page just skips to the finish page that appiers at the end of the process, so i dont actually get to upload a new file.
Cyberpunk Wannabe
Gender:
Posts: 35
234 credits Members referred : 0
If at first you dont suceed, try try again
« Reply #12 on: Apr 11, 2008, 11:08:33 PM »
Now i get this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
there is no " on line 1, what gives?
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 8037
41179 credits Members referred : 3
Cyberpunk Wannabe
Gender:
Posts: 35
234 credits Members referred : 0
If at first you dont suceed, try try again
« Reply #14 on: Apr 16, 2008, 08:02:33 PM »
OK forget the last problem, i've had a week playing Call to Duty 4 online so i came back and done this page from scratch.
Alas still no joy but i have this error on the last line of the script with olafs suggestion last time : Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /admin/newroomimg.php on line 165
That line being: <?php mysql_free_result($rs_copydel);?>
Sorry for draggin this up again, It seems a simple thing to do, but im obvislouy blindly fumbling around with code here..
//Suggestion start if (!empty($_POST['idroom'])) { // validat first that all fields are filled mysql_query("DELETE FROM rooms WHERE idroom =".(int)$_POST['idroom']); // place here the insert statement, maybe you should reuse the old rec id