sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
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
-
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! } }
-
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
-
IN SCRIPT WHERE IS LINE OF CODE THAT YOU POST IN YOUR 1ST POST
-
$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.
-
add line ini_set('precision',18); near the start of your script
-
Multiple result pagination paginates, but shows only one result?
sasa replied to jaxdevil's topic in PHP Coding Help
wher you setup variable $searcht -
<?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); ?>
-
ups i make mistake while($row = mysql_fetch_assoc($rs)) { $ranks = ++$rank; echo "<tr>";
-
while($row = mysql_fetch_assoc($rs)) { $rank++; $ranks = $rank++; echo "<tr>";
-
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)) {
-
$query1 = mysql_query("SELECT detentiondate FROM detentiondates WHERE detentiondate NOT IN (SELECT detentiondate FROM detention WHERE '".$_SESSION['pupilno']."' = pupilno) AND '$newcurrentdate' < detentiondate");
-
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);
-
SELECT detentiondate FROM detentiondates WHERE NOT (detentiondate in(SELECT detentiondate FROM detention WHERE '".$_SESSION['pupilno']."' = pupilno)) (i not try this)
-
just include your script just after user update something
-
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>
-
<?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; } ?>
-
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; }
-
try WHERE row_number='".$_POST['row_number'][$i]."'";
-
[SOLVED] Two forms on one page.. any tips or tricks?
sasa replied to JTapp's topic in PHP Coding Help
the name of input field in your 1st form is search2 not search -
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>
-
are you use mysql or mysqli
-
look usort() function
-
add 'ORDER BY RAND()' in your query