Rand() help needed


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

Hi all,

Can someone explain and give me a quick example of how I would go about this?

I have 100 values in a database with colum headings of t_val and t_name. If I wanted to update all 100 of these with a rand number how would I do this?

Would I do something like this?
Code: [Select]t_val1 = rand(1,10);

What I want to do is have different variances in the rand as well. So ten would be rand(1,10) and the next ten would be rand(5,20) for example?

Many Thanks

No comments posted yet

Your Answer:

Login to answer
150 Like 44 Dislike
Previous forums Next forums
Other forums

php file erros / need help please
Hello

Someone decoded a zend file for me.. after uploaded it on ftp i get some errors, i trye

Problem writing URL into database
How would I write this into the database?

<?php echo "http://".$_SERVER['SER

Multiple Options for a Single Page
For this example I want to use the Handlers option which is under Fed Admin and all the related codi

RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mai

Escape Latin Characters
I need to escape latin characters in an xml doc. Example: "é" is escaped to "é". I thoug

php redirecting
i wont open a new thread but i have a question about redirecting....
i wonder why my code doesnt

Using real time in php
I'm very average at PHP and im looking to introduce time to something on my site.
Its a sports si

PHP login form help (Done Most of It)
Hi i am having a problem, when i try logging in it is always saying "Invalid Login" im not

Losing 'page' data
I have this code that allows me to update my database. But after updating, I lose the $_GET['page']

Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel inste

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