Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. UPDATE table_name SET field = replace(field, '[39,10]', '.') http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace
  2. look http://www.w3schools.com/tags/att_form_method.asp
  3. add end php tag (?>) in lines 34 and 25 (just before lines with errors)
  4. try <?php $file = file_get_contents("http://www.apmex.com"); $do = preg_match('/<span id="ctl08_ctl05_gvMetals_ctl02_label3">(.*)<\/span>/', $file, $matches); if ($do) { $no_dollar = preg_replace('/[\$,]/', '', $matches); $dollar = $no_dollar['1']*1.02; echo "Price multiplied with 1.02 is ", number_format($dollar,2,'.',','); } else { echo "No Price"; } ?>
  5. before calculate with price you must strip out comma too change regex pattern in preg replace from [\$] to [\$,] <?php $file = file_get_contents("http://www.apmex.com"); $do = preg_match('/<span id="ctl08_ctl05_gvMetals_ctl02_label3">(.*)<\/span>/', $file, $matches); if ($do = true) { $no_dollar = preg_replace('/[\$,]/', '', $matches); print $no_dollar['1']; } else { echo "No Price"; } echo "\n<hr />Price multypled with 1.7 is ",$no_dollar[1]*1.7; ?>
  6. <?php $left = 0; $top = 30; $num = mysql_num_rows($result2); $num_col = 5; $len1 = floor($num/$num_col); for($i=0;$i<$num_col; $i++)$len[$i]=$len1; $j = 0; $r = $num % $num_col; for($i=0; $i< $r; $i++){ if($j >= $num_col) $j = 1; $len[$j]++; $j +=2; } $count = 0; $i = 0; while($userinfo = mysql_fetch_array($result2)){ if($count==$len[$i]){$top=($top%100==30) ? 80 : 30; $i++; $left=200 * $i; $count=0;} echo "<div style=\"left:{$left}px; top:{$top}px; position:absolute;\">{$userinfo['message']}</div>\n"; $top +=100; $count++; } ?>
  7. all div in 1st column have same left property and each next top is 2 row biger i just calculate numberd of data in 1st column ($len1) when 1st column is full go to 2nd column all div in 2nd column have same left property and each next top is 2 row biger i calculate number of data in 2nd column and add to $len1 ($len2) when fierst two columns is full go to 3rd..
  8. try <?php $left = 0; $top = 0; $num = mysql_num_rows($result2); $len1 = ceil($num/3); $len2 = $len1 + floor($num/3); while($userinfo = mysql_fetch_array($result2)){ if($count==$len1){$top=30; $left=100;} if($count==$len2){$top=0; $left=200;} echo "<div style=\"left:{$left}px; top:{$top}px; position:absolute;\">{$userinfo['message']}</div>\n"; $top +=60; $count++; } ?>
  9. $pattern1 = "/books/"; pattern2 = '/5/'; if(preg_match($pattern1, $list) and preg_match($pattern2, $list)) {
  10. change to foreach ($imglinks[1] as $imagelink){
  11. look http://www.phpfreaks.com/forums/index.php?topic=95426.0
  12. $sql = mysql_query("UPDATE UserList SET Rewards = (Rewards + $addvaule) WHERE Username LIKE '%$add%'");
  13. post your new code and we can help you
  14. sasa

    REGEX for DL

    ln US differen states has different driver's license format
  15. or <?php $priceRegEx = '/^\s*\d*\.?\d{1,2}\s*$/'; for($i=1;$i<=16;$i++) if(!preg_match($priceRegEx, ${'price'.$i})) $errors[]=$i; if(count($errors)>0) echo 'error in price(s) ', implode (', ', $errors); ?>
  16. the solutin is given in 1st replay ( cunoodle2 ) but discusion goes to wrong way
  17. try <?php $username = 'Joe'; $myfriends = "SELECT * FROM users JOIN friends ON users.code = friends.f_userid WHERE friends.friendwith ='$username' AND friends.f_userid NOT IN (SELECT friendwith FROM friends WHERE f_userid='$username')"; $myfriendsresult = mysql_query($myfriends); while($myfriendsrow = mysql_fetch_array($myfriendsresult)) { echo $myfriendsrow['f_userid']."<br/>"; echo $myfriendsrow['friendwith']."<br/>"; } ?> not teted
  18. try <?php $price = ' 123.3'; if(preg_match('/^\s*\d*\.?\d{1,2}\s*$/', $price)) echo "ok"; else echo "no"; ?>
  19. $input2[$rand_keys[0]]
  20. OK then use $num=mysql_result($result, 0, 0);
×
×
  • 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.