Lissa Explains it All:  Web Design Forums  

Go Back   Lissa Explains it All: Web Design Forums > LEIA Archives > Web Site Help > Advanced Programming

Notices

 
 
Thread Tools Display Modes
  #1  
Old 10-17-2006, 08:51 PM
Joe10 Joe10 is offline
n00bzilla
 
Join Date: Oct 2006
Posts: 20
Joe10 is on a distinguished road
I need another code

ok this time i need a code that will generate random numbers when the page loads

preferrably 8 numbers that always change, so myspace thinks that is a different topic!

This should be easy for someone like you guys!
Sponsored Links
  #2  
Old 10-18-2006, 04:00 AM
ponygrl2 ponygrl2 is offline
Beta Baby
 
Join Date: May 2006
Posts: 165
ponygrl2 is on a distinguished road
You could use the PHP Rand() function to generate the numbers put this before your <html> tag
<?php
echo rand(1,8);
?>
if you want 1-Digit numbers i dunno how to do an 8-Digit number
__________________
~Ponygrl :purplecat
  #3  
Old 10-18-2006, 10:55 PM
Idiotic Creation's Avatar
Idiotic Creation Idiotic Creation is offline
In Color!
 
Join Date: Feb 2006
Location: Economy size cardboard box
Posts: 506
Idiotic Creation is on a distinguished road
You could eather use a while statment with an array to make the numbers, but I'm not quite that good, so you can do this instead.

PHP Code:
<?php
$n1 
rand(1,8);
$n2 rand(1,8);
$n3 rand(1,8);
$n4 rand(1,8);
$n5 rand(1,8);
$n6 rand(1,8);
$n7 rand(1,8);
$n8 rand(1,8);

echo 
"8 digit number: " $n1$n2$n3$n4$n5$n6$n7$n8;
?>
Good Luck,
David
__________________
“Do all the good you can, By all the means you can, In all the ways you can, In all the places you can, At all the times you can, To all the people you can, As long as ever you can.”
-John Wesley
  #4  
Old 10-19-2006, 03:22 PM
Idiotic Creation's Avatar
Idiotic Creation Idiotic Creation is offline
In Color!
 
Join Date: Feb 2006
Location: Economy size cardboard box
Posts: 506
Idiotic Creation is on a distinguished road
Ops

I left it so the numbers could only be 1-8. They should be 0-9.

PHP Code:
<?php
$n1 
rand(0,9);
$n2 rand(0,9);
$n3 rand(0,9);
$n4 rand(0,9);
$n5 rand(0,9);
$n6 rand(0,9);
$n7 rand(0,9);
$n8 rand(0,9);

$randnumber =  $n1 $n2 $n3 $n4 $n5 $n6 $n7 $n8;
echo 
$randnumber;
?>
__________________
“Do all the good you can, By all the means you can, In all the ways you can, In all the places you can, At all the times you can, To all the people you can, As long as ever you can.”
-John Wesley

Last edited by Idiotic Creation; 10-19-2006 at 03:26 PM.
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I know the code for this is on lissa's site, I just can't find it... lynn5127 HTML Help 5 01-07-2006 05:30 PM
Replacing Text code problem bLondcHerryx9 Xanga 4 09-12-2004 01:16 AM
Code help! Refresh page on entry nascarup HTML Help 2 08-27-2004 12:40 AM
configuring javascript code Rinoa Heartilly JavaScript/DHTML 0 07-19-2004 08:30 PM
pop-up code inside iframe inside table.. salomeyasobko Frames 3 08-01-2003 08:54 PM


All times are GMT. The time now is 08:58 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.