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. you must use diferent names for your input-file
  4. something like this SELECT COUNT(views) + 1 AS rank FROM table WHERE vews>(SELECT views FROM table WHERE userid=2)
  5. try $a = 'sasa'; echo '$a'; echo "<br />\n"; echo "$a"; and you can see
  6. yes just add another query
  7. $page=$_GET['page']; include ("folder/$page.php");
  8. are you have cookies enabled in your browser
  9. 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> ?>
  10. what is wrong
  11. echo "00023409" + 0;
  12. add echo 'Displaying ',$page*$Limit-$Limit+1,' to ',($page*$Limit)<$NumberOfResults?($page*$Limit):$NumberOfResults, ' (of ',$NumberOfResults,' products)'; to cyrixware's code
  13. 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"; } ?>
  14. no use ORDER BY column_name ASC or DESC
  15. 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); ?>
  16. try to echo $num
  17. 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); ?>
  18. part of code that you don't want to repeat move outside of your while loop
  19. try <?php for ($x=0;$x<9;$x++) { $i++; $myArray['element_'.$i] = array ("x$i", "y$i", "z$i"); } print_r($myArray); ?>
  20. 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>
  21. 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"; } ?>
  22. 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); ?>
  23. you dont set $query used in line 120
  24. 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.