Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. if $char is 'mlfrau' and in your word list is word 'mlfrX', is it good result or not?
  2. condition if (count($b[0]) == count(array_unique($b[0])) and count($b[0]) > 0) means 1st part just unique characters and 2nd part one or more character mach just word 'print' mach both if you want to mach word 'the' remove 2nd conditon (and count($b[0]) > 0)
  3. something like this SELECT COUNT(views) + 1 AS rank FROM table WHERE vews>(SELECT views FROM table WHERE userid=2)
  4. try $a = 'sasa'; echo '$a'; echo "<br />\n"; echo "$a"; and you can see
  5. $page=$_GET['page']; include ("folder/$page.php");
  6. are you have cookies enabled in your browser
  7. try <?php if($result && mysql_num_rows($result) > 0) { $i = 0; $max_columns = 3; while($row = mysql_fetch_array($result)) { $id = $row['id']; $title = $row['title']; // open row if counter is zero if($i == 0) echo "<tr>"; // make sure we have a valid product if($title != "" && $title != null) echo "<td><a href='article.php/$id/$title>$title</a></td>"; else { echo "<td><a href=../../'article.php/'$id'/'$title'>$title[/url]</td>"; } // increment counter - if counter = max columns, reset counter and close row if(++$i == $max_columns) { echo "</tr>"; $i=0; } // end if } // end while } // end if results // clean up table - makes your code valid! if($i > 0) { for($j=$i; $j<=$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table> ?>
  8. add echo 'Displaying ',$page*$Limit-$Limit+1,' to ',($page*$Limit)<$NumberOfResults?($page*$Limit):$NumberOfResults, ' (of ',$NumberOfResults,' products)'; to cyrixware's code
  9. try <?php $char = 'mlfrau'; $word_list = 'frr,print,mam,the'; $a = explode(',',$word_list); foreach ($a as $word){ preg_match_all("/[$char]/", $word, $b); if (count($b[0]) == count(array_unique($b[0])) and count($b[0]) > 0) echo $word,"\n"; } ?>
  10. no use ORDER BY column_name ASC or DESC
  11. try <?php $a = '<img src="http://images.bestbuy.com:80/BestBuy_US/en_US/images/global/header/logo.gif" alt="Best Buy Logo" />'; preg_match('/src="([^"]+)"/',$a, $b); print_r($b); ?>
  12. try <?php $pics = array ( array("name" => "wes", "number" => 14), array("name" => "jared", "number" => 97), array("name" => "amber", "number" => 2) ); function my_comp($a,$b){ if($a['number']<$b['number']) return -1; if($a['number']>$b['number']) return 1; return 0; } usort($pics,'my_comp'); print_r($pics); ?>
  13. part of code that you don't want to repeat move outside of your while loop
  14. try <?php for ($x=0;$x<9;$x++) { $i++; $myArray['element_'.$i] = array ("x$i", "y$i", "z$i"); } print_r($myArray); ?>
  15. try <?php session_start(); if (isset($_SESSION['q']) and count($_SESSION['q']) > 0) $q = $_SESSION['q']; else $q = range(1, 28); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Quiz</title> </head> <body> <?php $answer = $_POST['answer']; $correct = $_POST['correct']; $question = $_POST['question']; $questions = 28; //number of questions $nq = array_rand($q,1); $nextq = $q[$nq]; //rand(1,$questions); unset($q[$nq]); $_SESSION['q'] = $q; $nextqn = $question + 1; //$newarray = array_splice($arr, array_search($nextq, $arr), 1); if($answer == $correct) echo "<font color=green>CORRECT</font><br><form action=bq" . $nextq . ".php method=post> <input type=hidden name=question value=" . $nextqn . "> <input type=submit name=Next value='Next Question'></form>"; else echo "INCORRECT<br><a href=index.php>Try again ...</a>"; ?> </body> </html>
  16. try <?php if (!$start) { $start = 0; } $start2 = $start + 50; $start3 = $start - 50; $query = mysql_query("SELECT COUNT(*) FROM usershops_items2 WHERE owner = '$find_owner[id]' AND price > '0' AND game = '$game'"); $total_rows = mysql_result($query,0,0); $query = mysql_query("SELECT * FROM usershops_items2 WHERE owner = '$find_owner[id]' AND price > '0' AND game = '$game' ORDER BY `usershops_items2`.`price` ASC LIMIT $start,50"); if ($total_rows > ($start + 50)) { $nextThree = "<a href=usershop.php?game=1&user=$_GET[user]&start=$start2>Next</a>"; } else { $nextThree = " Next "; } if (($start - 50) >= 0) { $previousThree = "<a href=usershop.php?game=1&user=$_GET[user]&start=$start3>Previous</a>"; } else { $previousThree = "Previous"; } ?>
  17. try <?php $array[0] = "asmllstr"; #8 Characters $array[1] = "amediumstri"; #11 Characters $array[2] = "abiggerstring"; #13 Characters $array[3] = "thisisclearlybiggest"; #20 Characters $array[4] = "smaller"; #7 Characters $max_len = -1; foreach ($array as $s){ $x = strlen($s); if ($x > $max_len){ $max_len = $x; } } foreach ($array as $k => $v) $array[$k] = str_pad($v, $max_len); ?>
  18. you dont set $query used in line 120
  19. no way that this code show any result
×
×
  • 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.