All pastes #298424 Raw Edit

Stuff

public text v1 · immutable
#298424 ·published 2006-12-31 22:46 UTC
rendered paste body
<?php
require('../connect.php');
$min = date("i");

$sql[time] = "SELECT `time` FROM `shops` WHERE `id` =1";
$res[time] = mysql_query($sql[time]);
$rowtime = mysql_fetch_assoc($res[time]);

if($min == $rowtime[time]){
//will have array of items
//insert into time using BLAH
//also update time, if $min > 10 new time will eqaul rand(11,20), if $min > 20, rand(21,30), etc....


}else {
//die();
}

  $sql = "SELECT * FROM `list_items` WHERE `type` ='Food'";
  $res = mysql_query($sql) or die(mysql_error());
  $array = array();
  $arra2 = array();
  $arra3 = array();
  $arra4 = array();
  $total = mysql_num_rows($res);
  while ($row = mysql_fetch_assoc($res)) {
    $array[] = $row['ID'];
    $arra2[] = $row['itemname'];
    $arra3[] = $row['url'];
    $arra4[] = $row['price'];

  }
foreach($array as $val AND $arra2 as $val2 AND $arra3 as $val3 AND $arra4 as $val4) {
  $array = "$val,";
  $arra2 = "$val2,";
  $arra3 = "$val3,";
  $arra4 = "$val4,";
  echo "$array<br>";
  echo "$arra2<br>";
  echo "$arra3<br>";
  echo "$arra4<br>";

}
  $num = rand(1,$total);
  //for ($i = 0;$i <= $num; $i++)
    //if (mysql_query("INSERT INTO `shopstock` (`itemid`,`item_name`,`url`,`price`) VALUES ('$array[$i]','$arra2[$i]','$arra3[$i]','$arra4[$i]');")) {
   //   echo $array[$i]." inserted";
    //}
  //}

?>