Page 1 of 1

A MySQL counter

Posted: Sat Feb 07, 2004 8:56 pm
by HaVoC
It's a very simple counter.

їphp]
$query2 = "UPDATE counter SET number = ' .$number. ' + 1 WHERE id = 1";
ї/php]

It doesn't seem to want to add number + 1, any ideas. Also i'm trying to incorporate images into the script. How can I make the script define different numbers in the script and display them image?

?>

Posted: Sat Feb 07, 2004 10:53 pm
by markl999
$query2 = "UPDATE counter SET number = number + 1 WHERE id = 1";
How can I make the script define different numbers in the script and display them image?
Not too sure what you mean. Do you mean display a random image based on 'some number' ?

Posted: Sun Feb 08, 2004 8:45 am
by HaVoC
More like this. Say the number was 189.
It would display the image 1.jpg, 8.jpg, and 9.jpg

Posted: Sun Feb 08, 2004 5:05 pm
by DuFF
Example:

Code: Select all

<?php
$number = "187";
echo $number[0];  //echos "1"
echo $number[1];  //echos "8"
echo $number[2];  //echos "7"
echo $number[0] . ".jpg";  //echos "1.jpg"
?>
That help?

Posted: Thu Feb 26, 2004 3:48 pm
by HaVoC
How would I make it so. Incase it goes to 4 numbers it does the arraying automatically. Or would it be so hard that just adding some code would do it?