
sasa
-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Posts posted by sasa
-
-
or
<?php $string = "this, that;some.word;second"; $separators = array(":", ";", ",", "-", '\.');//must escape dot $result = preg_split('/('.implode('|',$separators).')\s*/',$string); print_r($result); ?>
-
you need functions array_intersect() and array_diff() for this job
-
try to explicite convert value to float type
change line
$tltsave = $invoiceline->total
to
$tltsave = (float)$invoiceline->total
-
try
<?php $a='sasa + sasa'; echo '<a href="?data='. urlencode($a).'">click me</a>'."<br />\n"; if (isset ($_GET)) echo $_GET['data']; ?>
script just generate link with + and space, and echo result
-
use urlencode() function on variable before put it in link and urldecode() on $_GET variable
-
are you sure about spaces
try to use this pattern
'~<a\s+href="solre.php?[^"]"\s*class=\'nav\'\s*>~'
-
the variable $thing isn't set before you use it in query
-
what if you run your code in december?
-
you can binary tree put in array in this way
1. root node put on index 1 in array
2. lchild of node with index n put in array element with indeks 2*n
3. rchild of node with index n put in array element with indeks 2*n+1
parent element of element with index n is in position (int)(n/2)
level of element with index n is log(n, 2) (root element is level 0)
on n-th level is elements with index from pow(2, n) to pow(2, n+1)-1
here is code for put tree in array
<?php function tree_gather($node) //Function to calculate count { $tree = array(1 => $node); b_tree($node, 1, &$tree); return $tree; } function b_tree($node, $index, &$tree){ $sql = "SELECT lchild,rchild FROM tree WHERE parent = '$node'"; $execsql = mysql_query($sql); if($array = mysql_fetch_array($execsql)){ if(!empty($array['lchild'])){ $tree[$index * 2] = $array['lchild']; b_tree($array['lchild'], $index * 2, &$tree); } if(!empty($array['rchild'])){ $tree[$index * 2 + 1] = $array['rchild']; b_tree($array['rchild'], $index * 2 + 1, &$tree); } } } ?>
the code is not tested
-
change
$laprov=$_POST["$provincias"];
to
$laprov=$_POST["provincias"];
-
change
while($i <= $cuenta){
to
while($i < $cuenta){
and some in 2n while loop
-
<?php $array=array('word1', 'word2', 'word3'); $string="This is a sentence containing word2"; if(preg_match('/\b'. implode('\b|\b', $array).'\b/i', $string)) echo 'yes'; else echo 'no'; ?>
-
you can use "... ORDER BY RAND($seed) ..." where $seed is random number generated for pagination
see http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand
-
$formula = $production_per_hour / 3600 * $difference + $current_number;
-
try
<?php $test = 'I am 13 as of today, what an unlucky number. "B1D3AY"'; function remove_numbers($a){ return preg_replace('/\d/','', $a[0]); } echo preg_replace_callback('/"[^"]+"/','remove_numbers',$test); ?>
-
[^\w\ŝ\ĉ\ĝ\ĵ\ŭ\ĥ\Ŝ\Ĉ\Ĝ\Ĵ\Ŭ\Ĥ]
-
or just
$temp = $_SESSION['Num_Part']; //$count = 0; //while ($count <= $temp){ $temp3=$_POST['Participant_P']; $temp5=$_POST['Result_P']; // $count++; //}
-
try
<?php $test = '<td> <b><font size="+2" color="#FF0000">Neighboorhood:</font> <font size="+2" color="#0000FF">Greenacre</font></b> </td> '; $out = preg_replace('/(Neighboorhood:.*?<font.*?)>/s', '\1 what you want to insert>', $test); echo $out; ?>
-
use in_array() function
-
$bio = preg_replace('#[^A-Za-z 0-9\']#i', '', $_POST['bio']);
-
UPDATE points SET members_point=IF(members_point+1000 > 5000, 5000, members_point+1000).......
-
look some pagination tutorials like http://www.phpfreaks.com/tutorial/basic-pagination
-
it echo 37.91 for me
-
try to do all job witk SQL
<?php $r2 = mysql_query("SELECT MAX(progrm_id) AS level FROM user_program WHERE ID='".$usrid."' AND user_status='Active'"); $buffer_r2 = mysql_fetch_assoc($r2); $level_id = $buffer_r2['level']; $levels = array(1 => "Professional", "Gold", "Diamond", "Platinum", "Elite"); $level_name = $levels[$level_id]; ?>
Array keys are Zero
in PHP Coding Help
Posted
try