sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
SELECT city, COUNT(*) AS num FROM table_name WHERE food='cookies' GROUP BY city HAVING num>4 ORDER BY num DESC
-
remove all session_register()
-
change Elemental Token to Elemental+Token
-
[SOLVED] preg_replace not working for me, what am I doing wrong???????
sasa replied to TGWSE_GY's topic in PHP Coding Help
$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 -
yes but in this case you didn't need GROUP BY part
-
$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 ));
-
try preg_match('~<b>\d+</b> - <b>\d+</b> of about <b>(\d+)</b>~', $test, $out); print_r($out); not tested
-
for question1 you can use SELECT question1, count(*) num FROM result GROUP BY question1 and so on
-
<?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>"; } ?>
-
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)
-
find next link after last page next link point to current page
-
[SOLVED] Storing server variable name in a string variable.......
sasa replied to TGWSE_GY's topic in PHP Coding Help
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); ?> -
<?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); ?>
-
[SOLVED] need help query data separte with comma.
sasa replied to salman1's topic in PHP Coding Help
<?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 } ?> -
<?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); ?>
-
[SOLVED] need help query data separte with comma.
sasa replied to salman1's topic in PHP Coding Help
or $comma = ''; while(blah blah){ $echo $comma.$row['column']; $comma = ', '; } -
Retrieve Array From Cookie And Assign To Variables
sasa replied to Brent Crouch's topic in PHP Coding Help
<?php $test = array('A','B','C'); for ($i=0;$i<count($test);$i++){ ${"wc_cookie_" . ($i+1)} = $test[$i]; } echo $wc_cookie_2; ?> -
[SOLVED] ordering a fetch array with specific row at the top
sasa replied to AdRock's topic in PHP Coding Help
ORDER BY t.topicname = 'Forum Rules And Guidelines' DESC, tm.last_msg_date DESC -
change for($n=0;$n<mysql_numrows($resultrnk2);$n++) to for($nn=0;$nn<mysql_numrows($resultrnk2);$nn++)//change variable name
-
<?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; ?>
-
change for ($n = 1; $n >= ($thingamount / $perpage); $n++) { $thingpages = "[{$n}]"; } tochange for ($n = 1; $n <= ($thingamount / $perpage); $n++) { $thingpages .= "[{$n}]";// or $thingpages[] = "[{$n}]"; }
-
look array_multisort() function
-
[SOLVED] Update using the value of a CONCAT statement.
sasa replied to hilltopper06's topic in PHP Coding Help
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