Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Databasing
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 11-03-2009, 11:20 PM
  #1
huwey
Champion (Level 13)
 
huwey's Avatar
 
Join Date: Apr 2002
Location: indiana
Posts: 215
iTrader: (0)
huwey is on a distinguished road
adding/pulling data from db

ok i have this random number gen. that i need to post the numbers and date to a db

HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$numbers=array();
while (count($numbers)<6) {
$number=rand(1, 1000);
 if(!in_array($number,$numbers)) {
 array_push($numbers,$number);
 }
}
foreach ($numbers as $number) {
 $list.="$number, ";
}
$old_data=@file_get_contents("numbers.txt"); // get the current data
$list=substr($list, 0, -2);
$date=date('(r)',mktime());
$data="$date\n$list";

$new_data="$data\n\r$old_data"; // add the new data to the old data
$file = "numbers.txt";
$fh = fopen($file, 'w+') or die("can't open file"); // 'w+' deletes old contents and adds new
fwrite($fh, $new_data); // add new contents
fclose($fh);

echo $data;

?>

<?php

$time_delay = 5; //time to delay before redirect in seconds
$location = 'http://infernus.byethost18.com/index1.html'; //location of the page you wish too redirect too

echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"".$time_delay."; URL=".$location."\">\n";

?>

</body>
</html>
then i need to be able to place this info into the following div's:

the most recently added numbers into this div

HTML Code:
      <div id="numbers">
      </div>
and need the 4 previous sets of numbers here

HTML Code:
<div id="past_numbers">
        </div>
<div id="past_numbers">
        </div>
<div id="past_numbers">
        </div>
<div id="past_numbers">
        </div>
having a total of 5 sets of numbers showing

so say the numbers are being generated every week on sunday's

in the numbers div it would have the numbers for nov.1
then in the past_numbers div's have it show oct.25th, 18th, 11th, then 4th.
huwey is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 04:04 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.