Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. SELECT city, COUNT(*) AS num FROM table_name WHERE food='cookies' GROUP BY city HAVING num>4 ORDER BY num DESC
  2. remove all session_register()
  3. change Elemental Token to Elemental+Token
  4. $row = mysql_fetch_assoc($GetPhotos); $Type = $row['ImageType']; $Search = "~image/~"; // chenge this line $Replacement = ""; $EncodedImage = $row['Image']; $Decoded = base64_decode($EncodedImage); $CompiledImage = imagecreatefromstring($Decoded); header('Content-Type:' . ' $Type'); $FileFormat = preg_replace($Search, $Replacement, $Type);// <--------- Line 43 echo "image " . $Type; // and tis line
  5. yes but in this case you didn't need GROUP BY part
  6. $query = $db->execute("update `players` set `energy`=?, `awake`=?, `strength`=?, `total`=? where `id`=?", array($player->energy - $_POST['energy_def'], ($player->awake - $awakeloss3) < 0 ? 0 : $player->awake - $awakeloss3, $player->defense + $statgain3, $player->total + $statgain3, $player->id ));
  7. try preg_match('~<b>\d+</b> - <b>\d+</b> of about <b>(\d+)</b>~', $test, $out); print_r($out); not tested
  8. for question1 you can use SELECT question1, count(*) num FROM result GROUP BY question1 and so on
  9. <?php error_reporting(E_ALL); $list[] = array('1', 'test'); $list[] = array('5', 'test2'); $rows = count($list); //create array of reserved seats for ($j = 0; $j < $rows; $j++) { $tmp[] = $list[$j][0]; } /** Create seats */ for ($i = 1; $i <= 80; $i++) { $class = (in_array($i;$tmp)) ? 'reserved' : 'available'; echo "<div class='$class'>$i</div>"; } ?>
  10. 3 is number of result rows that query return you have 3 diferent value in alertstatus field in database try <?php $alertcount = 'SELECT COUNT(*) AS count, alertstatus FROM resumes WHERE alertstatus IS NOT NULL GROUP BY alertstatus'; $alertresult = mysql_query ($alertcount) or die (mysql_error()); $alertrows = mysql_num_rows ($alertresult); while($alertrow = mysql_fetch_row ($alertresult)){ echo 'value: "', $alertrow['alertstatus'], '" is in database ', $alertrow['count'], " times.<br />\n"; } ?> (not tested)
  11. sasa

    iterate

    find next link after last page next link point to current page
  12. try <?php do { $ImageArray = $_FILES['formImage'.$I]; $CurrentImageArray = array("Size" => $ImageArray['size']); echo $CurrentImageArray['Size']; echo "<br/>"; echo $ImageArray['size']; $I= $I + 1; } while ($I<6); ?>
  13. <?php function move_dot($number, $places) { $pices = split('\.', $number); if(count($pices) == 1) $pices[1]=''; if ($places > 0){ if (strlen($pices[1]) > $places){ $pices[0] .= substr($pices[1],0, $places); $pices[1] = substr($pices[1], $places); $pices[0] = $pices[0] + 0; return $pices[0].'.'.$pices[1]; } else { return $pices[0].$pices[1].str_repeat('0', $places - strlen($pices[1])); } } if ($places == 0) return $number; if (strlen($pices[0]) + $places > 0){ $pices[1] = substr($pices[0], $places).$pices[1]; $pices[0] = substr($pices[0], 0, strlen($pices[0]) + $places); return $pices[0].'.'.$pices[1]; } return '0.'.str_repeat('0', -$places - strlen($pices[0])).$pices[0].$pices[1]; } echo move_dot(0.1234, 2); ?>
  14. <?php $query = "Select * from tbl_dhads order by id"; $result = mysql_query($query); //$a=array(0); $comma = ''; while ($data = mysql_fetch_array($result)){ ?> ' <?php echo $comma. $data["dh_img"]; $comma = ', ' ?>': { caption: '<?php echo $data["dh_img_name"]; ?>' } <?php } ?>
  15. <?php $Username = $_GET['username']; $rowsPerPage = 50; $pageNum = 1; if(isset($_GET['page'])) { $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; $sql = ''; if($Username){ //Need Help Here, so that the Username selected displays at the top of the Table, and the rest below this Username displaying up to 50 people per page // $sql="SELECT * FROM $tbl_name ORDER BY TOTAL DESC, Username ASC LIMIT $offset, $rowsPerPage WHERE Username='$Username' UNION "; } $sql .= "SELECT * FROM $tbl_name ORDER BY TOTAL DESC, Username ASC LIMIT $offset, $rowsPerPage"; $result=mysql_query($sql); ?>
  16. or $comma = ''; while(blah blah){ $echo $comma.$row['column']; $comma = ', '; }
  17. <?php $test = array('A','B','C'); for ($i=0;$i<count($test);$i++){ ${"wc_cookie_" . ($i+1)} = $test[$i]; } echo $wc_cookie_2; ?>
  18. try <?php $test = array(2,3,4); $var1 = 2; $var2 = 2; $var3 = 3; if (count(array_diff(array($var1,$var2,$var3),$test)) == 0){ echo 'OK'; } else { echo 'NOT'; } ?>
  19. ORDER BY t.topicname = 'Forum Rules And Guidelines' DESC, tm.last_msg_date DESC
  20. change for($n=0;$n<mysql_numrows($resultrnk2);$n++) to for($nn=0;$nn<mysql_numrows($resultrnk2);$nn++)//change variable name
  21. <?php $header_data = array ( 0 => '" KW "', 1 => '" KVAR "', 2 => '" "', 3 => '" "' ); $used = 0; for ($x = 0; $x < 4; $x++){ $header_data[$x] = trim($header_data[$x], ' "'); if($header_data[$x] != ""){ $used++; } } print_r($header_data); echo $used; ?>
  22. change for ($n = 1; $n >= ($thingamount / $perpage); $n++) { $thingpages = "[{$n}]"; } tochange for ($n = 1; $n <= ($thingamount / $perpage); $n++) { $thingpages .= "[{$n}]";// or $thingpages[] = "[{$n}]"; }
  23. UPDATE attn_track a, tea_tbl b SET fullname = CONCAT_WS(', ',b.LastName,b.Firstname) WHERE a.proc = 'processing' AND a.TeacherSelect = b.fabrik_internal_id
×
×
  • 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.