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
Update Database
Hi All,
I have a problem with this:
Code: [Select]<?php
session_start();
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
form variables from database help.
Hi all,
I would like to have a form that gives you options based on the results of an mysql q
Embed Video Problem
Hey, thanks for looking!
File to be embedded:
Code: <playlist version="1&q
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
what is wrong with this
Code: [Select]<?php
if ($_SERVER['HTTP_REFERER'])
{
PHP Code reffering to database, doing something wrong.. pls help
Well i am quite new with PHP
and for school we have to make a PHP script which reffers to a Data
iterating through an array and escape each value independently.
I have a set up where the variable being escaped is an array and it needs to be iterated and escaped
Pls help with PHP
Pls can anyone direct me on how to create a user account for a customer. For example i want know if
array empty
Hiya peeps,
Ok here is the codes.
order.php
Code:
Bit manipulation program with binary operations
My homework is to create a program to scan in and add binary numbers and print them like so