This isn't necessarily specific to PHP, but I am trying to figure out a way to pseudo-randomly generate a number based on the month. To clarify a little, I want the number returned to stay the same for the entire month, and then change to another "random" number for the next month. There would also need to be a ceiling on how big the number could be. I can't think of a way to write this, is there anyone able to help?
2 1506 Atli 5,058
Recognized Expert Expert
Hi.
You can use the mt_rand function to generate a random number. You can even specify the lowest and highest limits.
As to using a single random number for the entire month. You will obviously have to store this number somewhere, where it can be read by your code. I would probably use a Database, like MySQL.
You would simply have to have a field for your random number, and a date field for the month it represents. If there is not a field for the current month, you use the function to generate a new number and add it for the current month.
pbmods 5,821
Recognized Expert Expert Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andrew Thompson |
last post by:
I would like to create a menu that uses the 'active'
pseudo-class to highlight the current page, but I
cannot get it to work.
The URL http://www.lensescapes.com/tst/nav/1.jsp
shows the attempts so far, there are links to 3 pages,
but (in IE6 and Mozilla?on XP) do not render the
link of the current page as yellow on blue.
What am I doing wrong, or is my understanding wrong?
|
by: Stephen Poley |
last post by:
The issue of the focus pseudo-class came up a few weeks ago, and I
finally got around to trying it out (better late than never ...)
The recommended order given for the pseudo-classes is link, visited,
focus, hover, active. However:
- Mozilla doesn't seem to do anything with the active rule;
- IE gets things wrong as usual: it uses the active rule for focus; it
ignores the focus rule;
- Opera ignores both focus and active rules and...
|
by: Kerberos |
last post by:
As you might know, IE doesn't support the :hover pseudo-class on every tag
(just the "a" tag AFAIK)
Is there a simple JavaScript that would solve the problem?
I have images that have a light blue outline, and when I pass the mouse
over, the outline turns to red.
#featured img {
display: block;
border: 1px solid #DCDFE8;
padding: 1px;
|
by: Steven T. Hatton |
last post by:
ISO/IEC 14882:2003:
"5.2.4 Pseudo destructor call
The use of a pseudo-destructor-name after a dot . or arrow -> operator
represents the destructor for the non-class type named by
type-name. The result shall only be used as the operand for the
function call operator (), and the result of such a call has type
void. The only effect is the evaluation of the postfix- expression
before the dot or arrow.
|
by: Fungii |
last post by:
Hello,
I have a stylesheet that sets p:first-letter to a certain
size and colour. I was playing around with Javascript to change
paragraph stylesheets using an array like this:
var paras = document.all.tags("P");
Although I can change the paragraph colours using this
array, the first letter of all the paragraphs remain the same
| |
by: rudderstick |
last post by:
Hi there all,
I have an interesting problem....
I work for a company that develops software for the building industry
and would like to distribute one of our software products via the
web.
here is the problem
|
by: pochartrand |
last post by:
Hello,
Is there a way to manipulate or at least read the pseudo-class of an
element ?
I know the style attribute can be accessed and gives the CSS properties
for a particular element. However, I can't seem to access the "hover"
properties.
example :
|
by: yawnmoth |
last post by:
I've seen a few webpages that use the javascript pseudo-protocol with
event handlers. eg.
<input onkeyup="javascript: ..." />
Correct me if I'm wrong, but isn't onkeyup always supposed to be
javascript, anyway? As such, isn't usint hte javascript
pseudo-protocol redundant?
....or was it required on some archaic browser like Netscape 4.0 or
|
by: Kevin Frey |
last post by:
WebControl contains properties such as ControlStyle and Style for
controlling the style of a web-control.
In particular the Style property is a CssStyleCollection that simply
comprises key-value pairs.
However, I have been reading this:
http://www.w3.org/TR/2000/WD-css-style-attr-20001025
|
by: bytehunter |
last post by:
Hello,
I hope this is the best place to ask my question. I was wondering if there was such a thing as a pseudo terminal in Windows.
For those unfamiliar, in Linux/Unix one can create a pseudo terminal which to an application looks and acts like a regular com port (tty device in Linux-ease). The purpose of such a thing is to allow an application which communicates via a com port to remain the same (except for changing its com port...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |