Take info from one coloum and move to another


Posted on 16th Feb 2014 07:03 pm by admin

Hi all,

I have this:
Code: [Select]$array = "SELECT stock_id FROM stocks WHERE stock_id BETWEEN '1' and '5' ";
$res = mysql_query($array);
$count = 0;
while ($row = mysql_fetch_assoc($res)){
if (is_int($count / 10) || $count == 0){
$rand_low = rand(1,5);
$rand_high = rand(1,5);
}
$num = rand($rand_low,$rand_high);
$update = "UPDATE stocks SET t_val=$num WHERE stock_id='" . $row['stock_id'] ."'";
if (mysql_query($update)){
echo "Updated record(s)<br />n";
}
}
Which simply updates a coloum called t_val with a random value between 1 and 5. I have another coloum in the table called y_val. What I would like to do is take the value of t_val before it is updated with the new rand and save it to the y_val coloum. How would I do this?

Many thanks

No comments posted yet

Your Answer:

Login to answer
104 Like 39 Dislike
Previous forums Next forums
Other forums

IP question
ive got 2 ip addresses both global from same user how would i detect if they are local to each other

ORA-01017: invalid username/password; logon denied
Dear All,

I am facing problem in taken backup from db13 it comes up with the following l

help with contest script
I would like to code a contest script to my site but i don't know how. Could someone just give me pu

script is pulling more then they have....
I have this script for my game where they can change there race. This will cost them 2,500 points. H

Insert to MySQL inside foreach
Hey.
I am parsing some html, and putting inside an html db.
I need to create a randomized inte

please hep to get values from a table row
can anyone tel me how I can select and get data from one row by pressing an Edit button in that row

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

Allowing ' and "
Hello everyone,

I am creating a form where users submit information to go into a database. I

Backflush
I am looking for a report in SAP that would give me a list of all parts that are populated with a ba

php form help
Hey,

I use a control file to set my meta tags and titles

Here's an example
Code: &a

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