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' ";
Did you know?Explore Trending and Topic pages for more stories like this.
$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

IDOC error
Hi, When i send IDOC from ECC system to MII there is no problem ECC side, i says message sent succe

random generation
hi

i need help with generating this

numbers from 1-12

i want to generate in ran

Creating a custom API
I'm creating a site, and I need to create a basic API. Unfortunately I have no idea where to start.

! = ''
In the following 'IF' statement if v_ompcat = PU for example then Oracle equates that 'IF' statement

Allowing ' and "
Hello everyone,

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

Else statement screws up all css
Does anyone know what goes wrong in the process with this php code?
This code seems to be causing

PHP Form to Variable.
Hi! I have written a HTML-form code in DreamWeaver CS3 (in a PHP doc) and I really need it to work s

printing links
Hi every1

i am connecting to a table in sql and the looping through with a while ($ var = my

scandir clients directory
hi,
how can i scandir the clients directory? i need a script that when i click a button it will u

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

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