Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. use SELECT * FROM TABLES WHERE id>=$id AND ... LIMIT 2 in 1st featch you have curent data, and in 2nd is next id
  2. try <?php $a = '<table width="385" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><h1>Company Name</h1> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <th width="30%"><strong>Contact:</strong></th> <td width="70%"><strong>Persons Name </strong> </td> </tr> <tr> <th><strong>Tel:</strong></th> <td><strong>000 000 000</strong></td> </tr> <tr> <td> </td> <td><span class="small">Information Here</span>.</td> </tr> <tr> <th><strong>E-mail:</strong></th> <td><strong><a href="info@website.com">info@website.com</a></strong></td> </tr> <tr> <th><strong>Web site:</strong></th> <td><strong><a href="http://www.website.com" target="_blank" id="451" onClick="return trackclick(this.id);" title="Visit Site">www.website.com</a></strong></td> </tr> </table>'; preg_match_all('/E-mail[^"]+"([^@]+@[^"]+)"/',$a,$b); print_r($b); ?>
  3. create table with all posible periods in one day (is it table uren?) and RIGHT JOIN it
  4. / - start and end of pattern, you can use some comand out of that ^ - start of string
  5. sasa

    Math Test

    look http://www.w3.org/Math/
  6. try while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $foodcat = $row['foodcat']; if($numx != $thisx){ $xr[$foodcat] = $foodcat; }else{ $xr['seafood'] = 'seafood'; } $thisx = $thisx + 1; } $array = $xr;
  7. session is on the server you can't change with javascrip use get method
  8. your script doesn't right find prime numbers try number 15 change to <?php // variable n is equal to the id of number on PrimeNumber.html $PrimeNum = $_GET['number']; // Checks to see if the number entered is between 1-1000 // Make sure it also checks to see if the number is less then 0 if ( $PrimeNum <= 0 || $PrimeNum >= 1000) { echo "<p>The number must between 1 and 999. Please try again.</p>"; echo "<p><a href='PrimeNumber.html'>Go Back.</a></p>" ; die(); // Make it so the script stops here and doesn't continue running } //is number 1 prime? // Calculates to check and see if a number is prime. If it is not prime it displays an error message. for($i = 2; $i <= sqrt($PrimeNum); $i = $i + 1){ if ($PrimeNum % $i == 0){ echo "<p>The number you entered was not a prime number.</p>" ; echo "<p><a href='PrimeNumber.html'>Go Back.</a></p>" ; die(); //Like before, we know its not a prime number so there is no reason to continue processing } } echo "<p>The number you entered is prime!</p>"; echo "<p><a href='PrimeNumber.html'>Go Back.</a></p>" ; ?>
  9. change $out = explode(',', $row); to $out = explode(',', $row['put_name_of_database_field_with_dogs_ID_here']);
  10. try <?php $a = file_get_contents('http://www.pricerunner.co.uk/cl/1/Mobile-Phones?search=Nokia&other_hits=42%3Anokia%7C199%3Anokia%7C28%3Anokia%7C94%3Anokia%7Cx%3B%3B15%3B&q=nokia&ref=redirect'); preg_match_all('/title="Compare prices - ([^"]+)"[^Ł]+Best price Ł([0-9\.]+)/s', $a, $b); $c = array_combine($b[1],$b[2]); print_r($c); ?>
  11. in line 171 you start <<<< EOPAGE close it in line 244
  12. try ORDER BY priority+0
  13. try <?php function generate($a){ if (!is_array($a)) return false; $a = array_values($a); if (count($a)%2) $a[]=''; $rounds = count($a) -1; $first = array_shift($a); $cur =0; while ($cur < $rounds){ $out[$cur][]=array($first, $a[$rounds-1]); for ($i = 0; $i < ($rounds-1) / 2; $i++){ $out[$cur][] = array($a[$i],$a[$rounds-$i-2]); } $x = array_shift($a); $a[] = $x; $cur++; } return $out; } $test = array(1,2,3,4,5,6,7); $x = generate($test); //print_r($x); foreach ($x as $r => $v){ echo 'round ', $r+1,"<br />\n"; $y = ''; foreach ($v as $p) if ($p[0] and $p[1]) echo $p[0],' v ',$p[1],"<br />\n"; else $y = $p[0].$p[1]; if ($y) echo $y, ' - free'; echo "<hr />\n"; } ?>
  14. look coments <html> <head> <title>Price calculator</title> </head> <body> <?php $width = $_POST["width"]; $width16 = $_POST["width16"]; // add 16 to variable name $height = $_POST["height"]; $height16 = $_POST["height16"]; $price = "0.25"; //$totalheight = $_POST["totalheight"]; remove this line //$totalwidth = $_POST["totalwidth"]; //$total = $_POST["total"]; ?> <p><img src="Phil/images/b_spiderman.gif" height="100"></p> <form method="post"> <p> <input type="text" name="height"> <select name="height16" id="height16"> <option value="0">Choose sixteenth</option> <option value="0.0625">1/16</option> <option value="0.125">1/8</option> <option value="0.1875">3/16</option> <option value="0.250">1/4</option> <option value="0.3125">5/16</option> <option value="0.375">3/8</option> <option value="0.4375">7/16</option> <option value="0.500">1/2</option> <option value="0.5625">9/16</option> <option value="0.625">5/8</option> <option value="0.6875">11/16</option> <option value="0.750">3/4</option> <option value="0.8125">13/16</option> <option value="0.875">7/8</option> <option value="0.9375">15/16</option> </select> <br> <input type="text" name="width"> <select name="width16" id="width16"> <option value="0">Choose sixteenth</option> <option value="0.0625">1/16</option> <option value="0.125">1/8</option> <option value="0.1875">3/16</option> <option value="0.250">1/4</option> <option value="0.3125">5/16</option> <option value="0.375">3/8</option> <option value="0.4375">7/16</option> <option value="0.500">1/2</option> <option value="0.5625">9/16</option> <option value="0.625">5/8</option> <option value="0.6875">11/16</option> <option value="0.750">3/4</option> <option value="0.8125">13/16</option> <option value="0.875">7/8</option> <option value="0.9375">15/16</option> </select> </p> <p><br> <input type="submit" name="submit" value="Calculate"> </p> </form> <? if(!empty($_POST)){ // set the PRICE to the square footage cost of the inserts $price = 0.25; $totalwidth = $width + $width16; $totalheight = $height + $height16;// the variable $lenght isn't setup jet $total = $totalwidth * $totalheight * $price; echo "Your inserts are an estimated cost of $ $total"; } ?> </body>
  15. try ... $page = ($_GET['id'] / $perpage);// + 1; $total = ceil($TotalRec / $perpage); for($i=0; $i<$total;){ if($i==$page) echo " ",++$i; else echo '<a href="pagination.php?id=' , ($i * $perpage) , '"> ',++$i,' </a>'; } if($start + $perpage >= $TotalRec) { echo "NEXT"; } ...
  16. change line echo "<div class='detailTextGrey'>".$authorArray.", </div>"; to echo "<div class='detailTextGrey'>".$authorArray[0].", </div>";
  17. while(file_exists($filename)) { //recalculte $secs_ago = $days_ago * $daylength; $then_date = ($current_date - $secs_ago); $filedate = date('Y-m-d', $then_date); $filename = "file_$filedate.html"; // Testing variables print " \$daylength = $daylength<br /> \$current_date = $current_date <br /> \$days_ago = $days_ago <br /> \$secs_ago = $secs_ago <br /> \$then_date = $then_date <br /> \$filedate = $filedate <br /> \$filename = $filename <br /> "; print("<a href='./$filename'>$filedate</a><br />"); $days_ago += 1; }
  18. sasa

    .=

    it's good practis to declare variable before use it
  19. try <?php foreach($_GET['id'] as $key => $value) { $select_query = mysql_query("SELECT email, name FROM members WHERE id = '$value' "); while ($member = mysql_fetch_array($select_query)){ $emails = $member['email']; $update = mysql_query("UPDATE banned SET email = CONCAT(email,',','".$emails."') WHERE id = '".$listid."' "); echo '<span style=" font-family:Arial; color:red; font-weight:bold; font-size:12px;">added: '. $member['name'].' to users banned<br /></span>'; } } ?> where yod define variable $listid used in query
  20. look mysql function FIND_IN_SET()
  21. try <?php $a = 'lscr|30,lsct|d,lsmcr|30,lsmct|d,msmcr|30,msmct|d,keancr|30,keanct|d,kswl|yes'; foreach (explode(',',$a) as $tmp){ $tmp = explode('|', $tmp); $returned[$tmp[0]] = $tmp[1]; } print_r($returned); ?>
  22. try <?php $char = 'mlfraum'; $word_list = 'frr,print,mam,the,ra,fratzl,rai,far,maul,maal,mail,ram,ramm,farm,farrm'; $a = explode(',',$word_list); $char = str_split($char); sort($char); $char ='/^'.implode('?',$char).'?$/'; foreach ($a as $word){ $word1 = str_split($word); sort($word1); $word1 =implode('',$word1); if (preg_match($char, $word1)) echo $word; } ?> speed 10 000 words per sec
×
×
  • 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.