Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. SELECT if(sum(if(Status='Available',1,0))>0,'Available','Sold Out') as sold,Filename FROM events WHERE `date` >= '2008' GROUP BY `filename` ORDER BY `date` ASC, `time` ASC, `status` ASC
  2. add ; after $x <?php $new_array = array(); for ($a = 0; $a <= 100; $a ++) { for ($b = 0; $b <= 50; $b ++) { //Put each value of $b and each value $a into an array $new_array[$a][$b]= $x; // Doesn't work! } }
  3. deafolt precision in php is 14 digits in your calculation you use number biger then maximal integer can be your number is convert to float number 278430613974337550 is converted to 2.78430613974337550E17 but in 14 digit precision is 2.7843061397433E17 (it is integer 278430613974330000) after / 20 and convert to integer resul is 13921530698717000
  4. IN SCRIPT WHERE IS LINE OF CODE THAT YOU POST IN YOUR 1ST POST
  5. $total_items = mysql_num_rows($t); $limit = 5; $total_pages = ceil(($total_items + 1) / $limit); $set_limit = $page * $limit - ($limit) - 1; if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_pages)) { $page = 1; //default } if($page == 1) { $limit--; $set_limit++; } etc.
  6. add line ini_set('precision',18); near the start of your script
  7. <?php function f_and_g($n){ while ($i <$n){ $i++; $f += $i; $g += $f; } return array('f' => $f, 'g' => $g); } $r = f_and_g(3); print_r($r); ?>
  8. ups i make mistake while($row = mysql_fetch_assoc($rs)) { $ranks = ++$rank; echo "<tr>";
  9. while($row = mysql_fetch_assoc($rs)) { $rank++; $ranks = $rank++; echo "<tr>";
  10. change $rank = 1; //Create a PS_Pagination object $pager = new PS_Pagination($conn,$sql,8,3); //The paginate() function returns a mysql result set $rs = $pager->paginate(); echo "<table cellpadding=10 border=1><tr><td>Rank</td><td>ID</td><td>Username</td><td>game 01 score</td></tr>"; while($row = mysql_fetch_assoc($rs)) { to //$rank = 1; //Create a PS_Pagination object $pager = new PS_Pagination($conn,$sql,8,3); //The paginate() function returns a mysql result set $rs = $pager->paginate(); $rank = $pager->offset; // <-- add this line echo "<table cellpadding=10 border=1><tr><td>Rank</td><td>ID</td><td>Username</td><td>game 01 score</td></tr>"; while($row = mysql_fetch_assoc($rs)) {
  11. sasa

    Querying

    $query1 = mysql_query("SELECT detentiondate FROM detentiondates WHERE detentiondate NOT IN (SELECT detentiondate FROM detention WHERE '".$_SESSION['pupilno']."' = pupilno) AND '$newcurrentdate' < detentiondate");
  12. try $result = mysql_query("SELECT incidents.id,incidents.description,users.firstname,users.surname,users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) AND (incidents.contact_id = users.id) AND (users.loginname='$myusername')"), $link);
  13. sasa

    double query

    SELECT detentiondate FROM detentiondates WHERE NOT (detentiondate in(SELECT detentiondate FROM detention WHERE '".$_SESSION['pupilno']."' = pupilno)) (i not try this)
  14. just include your script just after user update something
  15. change form to <?php $i = 0; while ($row = mysql_fetch_assoc($rs)) { $matches++; ?> <td> <input name="row_number[<?php echo $i; ?>]" type="text" id="row_number" value="<?php echo"$row[row_number]" ?>" /> </td> <td><div align="center"><font color="#000000"> <input name="cmd[<?php echo $i; ?>]" type="checkbox" id="cmd" value="delete" /> </font></div></td> <td><div align="center"><font color="#000000"> <input name="date[<?php echo $i; ?>]" type="text" id="date" size="10" maxlength="10" value="<?php echo"$row[date]" ?>" /> </font></div></td> <td><div align="center"> <input name="type[<?php echo $i; ?>]" type="text" id="type" size="10" maxlength="15" value="<?php echo"$row[type]" ?>" /> </div></td> <td><div align="center"> <input name="event[<?php echo $i; ?>]" type="text" id="event" size="50" maxlength="250" value="<?php echo"$row[event]" ?>" /> </div></td> <td><div align="center"><font color="#000000"> <input name="action[<?php echo $i; ?>]" type="text" id="action" size="20" maxlength="25" value="<?php echo"$row[action]" ?>" /> </font></div></td> <td><div align="center"><font color="#000000"> <input name="comments[<?php echo $i; ?>]" type="text" id="comments" size="50" maxlength="300" value="<?php echo"$row[comments]" ?>" /> </font></div></td> </TR> <?php $i++; } if (! $matches) { echo ("</table>There are no weather related announcements today"); } echo "</TABLE>"; ?> <input name="submit" type="submit" value="Submit" /> <input type="reset" name="Reset" value="Reset" /> </form>
  16. <?php function array_slice_from_index ($array, $index_value, $preserve_keys=false) { $return_array = array(); foreach ($array as $key => $value) { if ($key>=$index_value) { $new_key = ($preserve_keys)?$key:count($return_array); $return_array[$new_key] = $value;// <-- change this line } } return $return_array; } ?>
  17. try function get_imgdim() { $dir = get_imgdir(); $files = scandir($dir); $dimarr = array(); foreach($files as $value) { // check for image files if(valid_image_file($value)) { // build image array //$imgarr[] = $value; //$dimarr = array(); //$count = count($files); //for($i = 0; $i < $count; $i++) { $size = getimagesize($dir . $value); // line 315 list($width, $height) = $size; $dimarr[$value] = array("width" => $width, "height" => $height); //} } } return $dimarr; }
  18. try WHERE row_number='".$_POST['row_number'][$i]."'";
  19. the name of input field in your 1st form is search2 not search
  20. change last part if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table> to if($i > 0) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; echo '</tr>'; } ?> </table>
  21. sasa

    preg_match

    where you setup variable $file
  22. add 'ORDER BY RAND()' in your query
×
×
  • 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.