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();
Did you know?Explore Trending and Topic pages for more stories like this.
$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
Standard DES encryption script?
Can anybody point me to a tutorial or a short script that shows how to encrypt some text with salt i
Help on code output
My CODE:
Code: [Select] echo "<phone>".$line["phone"].&qu
Socket Server
In my following socket server, I am trying to listen to a connection through port 12345 in my web br
Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website
Array disappearing in foreach loop
Okay, I have this problem where an array will become undefined in a foreach loop.
Here is the
Validating time
Hi Guys
what do you think of the following approach to validate a 24hour time:
http://
Strange HTML Tag?
I recently noticed some odd HTML appear in some of the websites I host. Not all of them are run on a
problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo
this code is strange !
Hi i got this code from the web.. It checks for live and dead socks
It is working perfectly on my
How to Detect it is public_html or httpdocs?
How to check whether it is cPanel or Plesk?
If it found public_html perform <?php incl