sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
try if (($data=file("phone.csv", FILE_IGNORE_NEW_LINES))!== FALSE) { //while (($data=fgetcsv($open))!==FALSE) { foreach ($data as $key =>$numbr){ /// working code logic echo $key."<br>"; } }
-
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
-
Selecting members who's birthday is in the next month
sasa replied to denno020's topic in PHP Coding Help
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); ?>
-
How to get accented characters identified as wordy characters(?)
sasa replied to leke's topic in Regex Help
[^\w\ŝ\ĉ\ĝ\ĵ\ŭ\ĥ\Ŝ\Ĉ\Ĝ\Ĵ\Ŭ\Ĥ] -
Can a $_POST[$variable] use a variable in the argument position?
sasa replied to ICubis2's topic in PHP Coding Help
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; ?>
-
Desplaying something if a value is found in an array?
sasa replied to Alex1646's topic in PHP Coding Help
use in_array() function -
Protecting Input fields from illegal characters.
sasa replied to stevengreen22's topic in PHP Coding Help
$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]; ?>