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 Like 35 Dislike
Previous forums Next forums
Other forums

Update Myspace status with CURL
Logging in:

Code: <?php

class Myspace
{
function login($username, $pa

Extending Exception to contain method name
I was wondering, if there's a way to extend Exception in such a way, that it would contain name of a

Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to

xml
<?php

echo "<h1>XML Articles</h1>";

$home

Feed Maker
Hi all.
First of all I must say I am not a php developer so I am afraid I don't know much about i

Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to

Basic Question about Threading and PHP...
I have a page that I am working on and it is taking several hours to process. The basics of what th

Count of reciepients in php mailer
How can i sent a mail to large no of reciepients say 10,00,00 Using PHP MAILER

please help me... my password gets encrypted but not able to get in database
hai guys,
please help me... in the following function my password gets encrypted but no

need to apply an if/else statement to Tim Thumb script
Not sure how to work this. I essentially want to call a variety of image sizes based on which style

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash