Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. what array you want to paginate
  2. try to change your function printBlog() that include your file, don't echo contest of file
  3. <?php $a = range('a', 'z'); // create list of data use your array here $per_page = 5; $a = array_chunk($a, $per_page); $total_pages = count($a); if (isset($_GET['page'])) $curent_page = $_GET['page'] + 0; else $curent_page = 1; if ($curent_page < 0) $curent_page = 0; if ($curent_page > $total_pages) $curent_page = $total_pages; $curent_data = $a[$curent_page - 1]; // echo data foreach ($curent_data as $data){ echo $data, "<br />\n"; } // page links if ($curent_page > 1) echo "<a href='?page=",$curent_page-1,"'> PREV </a>\n"; for ($i = 1; $i <= $total_pages; $i++){ if ($i == $curent_page) echo " $i \n"; else echo "<a href='?page=$i' > $i </a>\n"; } if ($curent_page < $total_pages) echo "<a href='?page=",$curent_page+1,"'> NEXT </a>\n";
  4. error is somewhere before can we see 5 lines before ana 5 lies after <?php $post = "Write your post here"; $postedDate = "2008/05/27"; ?>
  5. try <?php function findrecord($session, $id){ foreach($session as $key => $file){ if($file[0] == $id){ return $key; } } } $item = array( array(34, 'curtain', '£2.99'), array(58, 'tent', '£8.99'), array(69, 'ruler', '£1.99') ); $a = findrecord($item, 58); echo $a; ?>
  6. try <?php // setup $id $added = false; foreach ($_SESSION['items'] as $key => $item){ if (in_array($id, $item)){ $_SESSION['items'][$key][5]++; $added = true; } if ($added) break; } if (!$added) // add new session items ?>
  7. try[code[<?php $a = '/search/cars/index.php'; //$a = '/search/trucks/index.php'; $trucks_array = array('truck1', 'Truck2'); $cars_array = array('car1', 'car2'); $a = explode('/', $a); echo ${$a[2].'_array'}[0]; ?>
  8. are you try $post = array_chunk($fileURL, 5); print_r($post);
  9. Where is $username setup?
  10. tryfcode]<?php function DisplayQuizResults() { // Determine That The User Has Come To This Page From // A Proper Quiz Page if( !isset( $_POST[ 'submit' ] ) ) { // Invalid Access die( "Sorry, direct access to this file is not permitted.\n" ); } // Obtain Username if( isset( $_POST[ 'name' ] ) && $_POST[ 'name' ] != "" ) { $name = $_POST[ 'name' ]; } else { die( "You forgot to fill in your name.\n" ); } // Obtain Quiz Answers $q = array(); $total = 0; for( $x = 1; $x<20; $x++ ) { if( isset( $_POST[ 'Q'.$x ] ) ) { $q[$x] = $_POST[ 'Q'.$x ]; $total += $q[$x]; } else { die( "You forgot to fill in answer: ". $x . "\n" ); } } // Display Results echo( "<p>Hello: " . $name . "<br><br><br>\n" ); if( $total < 21) { echo ('im a little teapot'."<br><br><br><br><br>"); } else if($total < 41) { echo ('im a medium teapot'."<br><br><br><br><br>"); } else if($total < 61) { echo ('im a large teapot'."<br><br><br><br><br>"); } else if($total <= 80 ) { echo ('im a fat teapot'."<br><br><br><br><br>"); } else { echo ('im a jenny craig teapot'."<br><br><br><br>"); } } ?> <HTML> <HEAD> <TITLE> Quiz Results </TITLE> </HEAD> <BODY> <? DisplayQuizResults(); ?> </BODY> </HTML>
  11. try <?php $a = 'sasa xxx'; echo $a,"<br />\n"; $a = preg_replace('/[^;]+;/','',$a); echo $a; ?>
  12. change to for ($int_val4 = 0; $int_val4 < $table_num; $int_val4++) { $table_width = $_POST["table_width".$int_val4]; $table_height = $_POST["table_height".$int_val4]; $table_top = $_POST["table_top".$int_val4]; $table_left = $_POST["table_left".$int_val4]; $table_border = $_POST["table_border".$int_val4]; $table_con = $_POST["content".$int_val4]; echo "<div style='position:absolute; left:".$table_left."px; top:".$table_top."px; overflow:auto;'>\n"; }
  13. change line for($a=0;$a<=$size;$a++) to for($a=0;$a<=$size2;$a++)
  14. try <?php while($row = mysql_fetch_array($query)) { $supplier = explode("|",$row['supplier']); $tmp_list_suppliers[] = $supplier[0]; // if(!in_array($list_suppliers,$seen) && !in_array($list_suppliers,$multiple)) // { // array_push($seen,$list_suppliers); // } // else // { // array_push($multiple,$list_suppliers); // unset($seen[$list_suppliers]); } $tmp =array_count_values($tmp_list_suppliers); $seen = array_keys($tmp,1); $multiple = array_unique(array_diff($tmp_list_suppliers, $seen)); ?>
  15. i don't real understud what you doing if you just want to extract last part of string try <?php $a = 'consumer electronics|portable audio|mp3 and mp4 players|ipod'; $b = explode('|',$a); echo $numberz = count($b) - 1; echo ' last element is: ',$b[count($b) - 1]; // or //echo $numberz = preg_match_all('/\|/',$a,$b); ?>
  16. <?php $row['description'] = '<blah blah>one<two></two>two'; echo strip_tags($row['description']); // or //echo preg_replace('/<[^>]*>/',' ',$row['description']); ?>
  17. or <?php $a = "The quick brown fox jumps over the lazy dog. "; $a = str_repeat($a, 50); $a = explode(' ', $a); $a = array_chunk($a, 100); foreach ($a as $c) $out[] = implode(' ', $c); print_r($out); ?>
  18. <?php $text = '[img:160:120:ef49b298be]http://i6.photobucket.com/albums/*****/Mystic_Mark/Photo-0119.jpg[/img:ef49b298be]'; $text = preg_replace('#\[(/?)img:.*?\]#si', '[$1img]', $text); echo $text; ?> return [img=http://i6.photobucket.com/albums/*****/Mystic_Mark/Photo-0119.jpg]
  19. <?php $var="http://www.google.com/search?q=Tallahassee+Websites&rls=com.microsoft:*&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1"; $var = parse_url($var); parse_str($var['query'], $out); echo $out['q']; ?>
  20. $text = preg_replace('#\[(/?)img:.*?\]#si', '[$1img]', $text);
  21. remove } in line 11 and line 14
  22. <?php $var="http://www.google.com/search?hl=en&rls=com.microsoft:*&pwst=1&q=tallahassee+web+designer&start=10&sa=N"; parse_str($var, $out); echo $out['q']; ?>
  23. function News() { mysql_close($conn2); require ('multi_operations/config_inc.php'); $query = "SELECT * FROM multi_news WHERE `status`='1' ORDER BY id DESC"; $result = mysql_query($query) or die(mysql_error()); // $row2 = mysql_fetch_array($result); // if ($row2['status'] == '1') { while($row2 = mysql_fetch_array($result)){ echo ' <table width="100%" cellpadding="3" cellspacing="1" border="0" class="bordercolor"> <tr class="titlebg"> <td align="center" colspan="2" class="largetext"><b>'.$row2['subject'].' - '.$row2['date'].'</b></td> </tr> <tr> <td class="windowbg" valign="top" style="padding: 7px;"> <div style="font-size: 0.85em">'.$row2['message'].'</div> </td> </tr> </table> '; } // } mysql_close($conn); }
  24. try <?php $options = array( 9 => array(12, 18, 20), 12 => array(3, 6), 18 => array(19, 13) ); $total_comb = 1; $keys = array(); $key_count = array(); $out = array(); foreach ($options as $k => $v){ $keys[] = $k; $total_comb *= count($v); $key_count[$k] = count($v); } $keys = array_reverse($keys); for ($x = 0; $x < $total_comb; $x++){ $i = $x; $tmp = array(); foreach ($keys as $k){ $a = $i % $key_count[$k]; $i = (int) ($i / $key_count[$k]); $tmp[] = array('option' => $k,'value' => $options[$k][$a]); } $out[] = array_reverse($tmp); } print_r($out); ?>
  25. change line if (file_exists($imagesFolder.$row['intLodgeNumber'].".jpg")) { to if (file_exists($_SERVER['DOCUMENT_ROOT'].$imagesFolder.$row['intLodgeNumber'].".jpg")) {
×
×
  • 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.