my sql select id and then update problem.
Posted on
16th Feb 2014 07:03 pm by
admin
I need to select some auto incremented ids out of a database and then use those id in a where statement which updates the database at the id's location the below code works up to the update statements where it just dies without coughing up an error or anything......can you spot whats wrong and help me fix it?
Code: $current = Array();
$currsel = mysql_query("select id from page0.page0 where refnum ='$newnum' AND username!='admin'")
or die(mysql_error());
while($currrow = mysql_fetch_array($currsel)){
array_push($current,$currrow['id']);
}
print_r($current);
$current1 = Array();
$currsel1 = mysql_query("select id from page0.page0 where refnum ='$oldnum' AND username!='admin'")
or die(mysql_error());
while($currrow1 = mysql_fetch_array($currsel1)){
array_push($current1,$currrow1['id']);
}
print_r($current1);
$upref1= mysql_query("update page0.page0 SET refnum='$newnum' where id='$current[0]' OR id='$current[1]'OR id='$current[2]'OR'id=$current[3]'")
or die(mysql_error());
$upref11= mysql_query("update page0.page0 SET refnum='$oldnum' where id='$current1[0]'OR id='$current1[1]'OR id='$current1[2]'OR id='$current1[3]'")
or die(mysql_error());
No comments posted yet
Your Answer:
Login to answer
286
35
Other forums
Php navigation
I have four buttons on a php page.
If i click a button it will redirect to different php pages.
Buggy registration system
Hey, I just started scripting in PHP, and I ran into a few problems.
Code: <?php
includ
ECC6 - Single sign-on
We are in the process of upgrading to ECC 6 which will support single sign on with user passwords al
sql problems
I am having a small problem with my sql statement. it is inserting into 4 of the fields.
fie
Inter Company -- Resources Related Billing (Services Industry)
Hello,
My company has a scenario where:
Company A bills Company C for INTER (cross
Please help understand this code
I noticed the index page on my site was modified this morning and found this code inserted at the bo
Probably Easy, Need help with Check Boxes in PHP Code
hello,
Thanks for looking this over and helping me out. My problem is I have a online store l
Help with Password Encoding/Decoding?
Trying to design a "change password" tool. On my signup code I'm using base64_encode, now
Php script to read msword file
hi,
I need to read a msword file and i want to print the contents in that word file.
i
add text and number image
hi guys ..
ok see i want the user to add their name and pick a number then click get it and i