sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
UPDATE table_name SET field = replace(field, '[39,10]', '.') http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace
-
look http://www.w3schools.com/tags/att_form_method.asp
-
how can i validate a number or letters with numbers with PHP
sasa replied to worldcomingtoanend's topic in PHP Coding Help
ctype_alnum() function -
add end php tag (?>) in lines 34 and 25 (just before lines with errors)
-
Not able to pass Concatenated value to an Array…
sasa replied to natasha_thomas's topic in PHP Coding Help
what you got if you try to var_dump($prodarray2); -
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"; } ?>
-
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; ?>
-
<?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++; } ?>
-
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..
-
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++; } ?>
-
$pattern1 = "/books/"; pattern2 = '/5/'; if(preg_match($pattern1, $list) and preg_match($pattern2, $list)) {
-
change to foreach ($imglinks[1] as $imagelink){
-
look http://www.phpfreaks.com/forums/index.php?topic=95426.0
-
preg_match to show directories and exclude certain directories
sasa replied to RopeADope's topic in Regex Help
for compare with array use in_array() function -
$sql = mysql_query("UPDATE UserList SET Rewards = (Rewards + $addvaule) WHERE Username LIKE '%$add%'");
-
post your new code and we can help you
-
ln US differen states has different driver's license format
-
preg_match to show directories and exclude certain directories
sasa replied to RopeADope's topic in Regex Help
try $value=="php" or $value=="css" -
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); ?>
-
the solutin is given in 1st replay ( cunoodle2 ) but discusion goes to wrong way
-
you mean ORDER BY COUNT(`like`)
-
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
-
try <?php $price = ' 123.3'; if(preg_match('/^\s*\d*\.?\d{1,2}\s*$/', $price)) echo "ok"; else echo "no"; ?>
-
OK then use $num=mysql_result($result, 0, 0);