Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. try <?php include 'config.php'; $month=date('F'); $month_arr = array('April', 'May', 'June', 'July', 'August'); $district_arr = array( 'Air District' => 60, 'Fire District' => 100, 'Water District' => 70, 'Ice District' => 30, 'Dragon Valley District' => 70, 'Light District' => 80, 'Poison District' => 90, 'Earth District' => 70 ); if(in_array($month, $month_arr)){ //summer! foreach ($district_arr as $district => $value){ $random = rand(0, 30) * (rand(0,1) * 2 - 1); // or use just $random = rand(-30, 30); $result = $value + $random; print("update clubs set temperature='$result' where district='$district'"); // change print to mysql_query() } } ?> sorry i update code
  2. goto http://hr.php.net/manual/en/function.stat.php and look user note
  3. corecting this line <style type="text/css">td img {display: block;}</style>
  4. if you try to use typo criteria only if $typo !='' $query="SELECT * FROM business_info WHERE make='$make' AND (type='$type' OR ''='$type') AND Categories like '%$Categories%'"
  5. try <?php function size_of_arr($a){ $b = 0; if (is_array($a)) { foreach ($a as $c) $b += size_of_arr($c); return $b; } return 1; } $a = array(1,array(2,3),4,array(5,array(6,7,,9),10); echo '<pre>'; print_r($a); echo "</pre><hr />\n"; echo 'Size is: ', size_of_arr($a); ?>
  6. OK remove echo and print from code
  7. more debug <?php mysql_select_db($database_concierge, $concierge); $query_calendar = "SELECT * FROM calendar"; $calendar = mysql_query($query_calendar, $concierge) or die(mysql_error()); $days = array();$c = 0; while ($row_calendar = mysql_fetch_assoc($calendar)) { $c++; $d = $row_calendar['dia']; $l = '/weblog/archive/2004/Jan/'.$d; echo "Racord no $c --> dia = $d --> long = $l \n <pre>"; $days[$d][] = $l; print_r($days); echo "\n </pre><hr /> \n"; } ?>
  8. let do same debug 1st try <?php mysql_select_db($database_concierge, $concierge); $query_calendar = "SELECT * FROM calendar"; $calendar = mysql_query($query_calendar, $concierge) or die(mysql_error()); // $row_calendar = mysql_fetch_assoc($calendar); echo 'Total rows is: '; echo $totalRows_calendar = mysql_num_rows($calendar); ?> if output some number greater then 0 try <?php mysql_select_db($database_concierge, $concierge); $query_calendar = "SELECT * FROM calendar"; $calendar = mysql_query($query_calendar, $concierge) or die(mysql_error()); //$row_calendar = mysql_fetch_assoc($calendar); $totalRows_calendar = mysql_num_rows($calendar); $days = array(); while ($row_calendar = mysql_fetch_assoc($calendar)) { $days[$row_calendar['dia']] = '/weblog/archive/2004/Jan/'.$row_calendar['dia']; } echo "<pre>\n"; print_r($days); echo "</pre>"; ?> what is output?
  9. try $days = array(); while ($row_calendar = mysql_fetch_assoc($calendar)) { $days[$row_calendar['dia']][] = '/weblog/archive/2004/Jan/'.$row_calendar['dia']; }
  10. try <?php $a=12345; $a -= $a % 1000; echo $a; ?>
  11. try <?php mysql_connect('localhost','root',''); $a ='a\b'; echo mysql_real_escape_string($a); echo "\n<hr />\n"; echo $a; ?>
  12. look http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html
  13. try SELECT DISTINCT vendors.id AS id, vendors.name AS name, SUBSTRING_INDEX(vendors.name, ' ', -1) AS lastname, SUBSTRING_INDEX(vendors.name, ' ', 1) AS firstname_a, if(SUBSTRING_INDEX(SUBSTRING_INDEX(vendors.name, ' ', 2), ' ',-1)=SUBSTRING_INDEX(vendors.name, ' ', -1),'',SUBSTRING_INDEX(SUBSTRING_INDEX(vendors.name, ' ', 2), ' ',-1)) AS middle_a from vendors
  14. use session varible to pass value
  15. <form action="" method="POST">
  16. i chek if is not set $_POST['cbUnit'] and if not exist (nothing is posted) i set $_POST['cbUnit'] to empty array you can change this code in diferen way like this if (isset($_POST['cbUnit'])) { foreach($_POST['cbUnit'] as $index => $checkedUnit) { echo (($unitName == $checkedUnit) ? (' checked="yes"') : ('')); } }
  17. are you look something like this <input type="text" onblur="this.value='sasa'" value="On lost focus I set my value">
  18. try <?php $cbUnitName = array('Talon', 'Star', 'Cater', 'Landrum'); foreach($cbUnitName as $key => $unitName) { echo "<input type='checkbox' name='cbUnit[]' value='" . $unitName . "'"; echo "unit name: " . $unitName . "\n"; # added to see if $unitName is being set if (!isset($_POST['cbUnit'])) $_POST['cbUnit'] = array(); foreach($_POST['cbUnit'] as $index => $checkedUnit) { echo (($unitName == $checkedUnit) ? (' checked="yes"') : ('')); } echo ">" . $unitName . "\n"; } ?>
  19. try $sep=''; foreach ($page['references_amenities'] as $z) foreach ($APPLIANCES as $y) { if($y == $z['Short']) { echo $sep,$z['Long'], ', ';} $sep=', ';
  20. SELECT TABLE_1.ID, TABLE_2.Long FROM TABLE_2, TABLE_1 WHERE FIND_IN_SET(Short,(SELECT SERVICES FROM TABLE_1)) ORDER BY ID
  21. i forget to copy rest of code. sorry <? if (isset($_POST['updatestatus'])) { $item= $_POST['item']; $num = $_POST['num']; echo "You clik on form No $num.<br />\n"; echo "Item_$num value is $item. <br />\n"; $query = "query stuff'"; $result = mysql_query($query); } ?> <form action="webpage.php" enctype="multipart/form-data" method="post"> <input type="hidden" name="item" value="1" /> <input type="hidden" name="num" value="1" /> <input type="submit" name="updatestatus" value="Update Status for Item 1" /> </form> <form action="webpage.php" enctype="multipart/form-data" method="post"> <input type="hidden" name="item" value="1" /> <input type="hidden" name="num" value="2" /> <input type="submit" name="updatestatus" value="Update Status for Item 2" /> </form> <form action="webpage.php" enctype="multipart/form-data" method="post"> <input type="hidden" name="item" value="1" /> <input type="hidden" name="num" value="3" /> <input type="submit" name="updatestatus" value="Update Status for Item 3" /> </form> <form action="webpage.php" enctype="multipart/form-data" method="post"> <input type="hidden" name="item" value="1" /> <input type="hidden" name="num" value="4" /> <input type="submit" name="updatestatus" value="Update Status for Item 4" /> </form>
  22. try <input type="hidden" name="num" value="1" />
  23. where you setup variable $count?
  24. $cust = array_slice($cust, 0, count($cust), false); print_r($cust);
  25. try <?php birthdday(date('d/m/Y'), "21/04/1988"); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.