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
please help
HTML Code:
Code: <span id="ctl00"><span>
Deleting Partners on the Customer Master.
Does SAP handle removing the Partner from Open Sales Orders when a Partner is deleted in the Custome
PHP4 to PHP5 Conversion
Hi Everyone,
I am working on a site that is built up on PHP4 and each page is being started f
Is there something wrong?
Hi all,
Just a quick question... can someone look at this code and see if something is wrong?
Linux socket programming
Where can I find a good introduction to socket programming?
CODE NOT WORKING
Code: [Select]<?php
//include shared codes
include '../lib/common.php';
include
Nested (echoed) php running wrong script
Got a problem with a php website I'm creating.
In a nutshell, the first page is entirely html
mysql_real_escape_string making variable equal nothing
i post a form and i post the variable:
Code: $var = $_POST[variable];then i echo $var its what i
SQL query not working well
Hi,
I made a small table with 5 rows and want to make them an sql consult using rownum
Help with usergroups? prolly really quick
So were coding our own forums for a game system we made an we have the users level setup but now I n