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
Pulling out some result data from MYSQL
Hey Guys,
I've built a PHP page that has a for just imagine something like registration form
batch file not building to webapps folder
Hello. I just started running Vista :P and can't seem to get my projects deployed. I found out how
how make 2 column in table with data tybe long row
hi every one
I want make in my table 2 column with data tybe long raw
how thi
PHP & Java
Hello,
can PHP code be used inside java code?
Code: [Select]<SCRIPT LANGUAGE=&q
upload image name with extension using php
hi frds..
<input id="file1" type="file" name="file[]" &a
big pagination problem in php
<?php
$connect = mysql_connect("localhost", "root", "")
getting a website's source code as a variable? How?
Hey guys, is there any way for me to get the source code of a website as a variable for me to work w
ME54/ME54N Conditional check for Release of PR
Hi Gurus,
My requirement is to put a check on the release of the PR with respect to the c
upgrade from 4.7 to ECC 6.0
Hi all,
we are going to do an upgrade from R/3 4.7 to ECC 6.0. I need to know if i can find som
in php, link returns to the line
When I add a link in a php page, the link word returns to the line (as a
would do)
Examp