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
Search function
I am looking for some guidance from the experts.
I am trying to create a search function. It
Searching keywords from array
Hello everyone, Im just wondering if someone could help me with another issue im having. Im still le
Help pulling in 'id' with "read more" link
I'm trying to create snippets of my articles in the cms I'm creating, and then have them redirect to
Different actions for different parts of a string
<?php
function dosomething($string, $else = '') {
if (empty($else))
$string
strptime() equivalent for php4 ?!
Greetings!
this is my first post, thank you in advance for your replies.
Well, the ti
help with image upload code
Hello,
right now this code I have resizes images and then places them into the uploads folder
insert PHP code into function
Hi,
I'm having problems when trying following:
I have:
Code: [Select]createBar("Do
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
tag inside php... hi
Code: <?php echo "<td width="$columnWidth%" align=&Convert .fdf to .pdf I currently have a web form that uploads the form data to an .fdf file and emails it.
However
|