sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
why is field receiptnum type varchar if you put number in it?
-
no let see 1st condition strpos($currentuser['Skills'],"Accordion-") == "true" strpos return number 0 (start position of substring) when php compare number and string it convert string to number and get 0 == 0 => true (btw. "true" is not same as true) 1st condition can be strpos($currentuser['Skills'].'-',"Accordion-") !== false 2nd must be strpos($currentuser['Skills'].'-',"Bass (Upright)-") !== false and so on
-
try <?php $array1 = array('info 1', 'info 2', 'info 3'); $array2 = array('thank you and welcome to what ever', 'the info you added * thanks for entering your info'); foreach ($array1 as $val) $array2[1] = str_replace('*', "* ".$val, $array2[1]); print_r($array2); ?>
-
try to explode $currentuser['Skills'] with '-' and then use in_array() function
-
$array_name[] = $cols->item(0)->nodeValue;
-
Checking if Variable contains a number at line 1
sasa replied to Modernvox's topic in PHP Coding Help
try if($itemDescription[0] === "1") { $itemPrice *= 1.0625;//add 6.25 % mysql_query("INSERT INTO transactions (`itemDescription`, `itemPrice`, `bidderId`, `itemQty`, `totalPrice`) VALUES ('$itemDescription', '$itemPrice', '$winningBidder', '$totalDeals', '$totalPrice');"); $message1 = 'The transaction has been successfully added.'; } -
foreach on a sequence of $_POST or $_GET variables
sasa replied to turpentyne's topic in PHP Coding Help
named your form fields as array in your input tags change name="s1" to name="s[1]" and so on -
this part of code[code=php:0]if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table>[/code]shold be[code=php:0]if($i > 0) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; echo '</tr>'; } ?> </table>[/code]
-
look function number_format()
-
updating multiple rows in mysql with radio button
sasa replied to 1981tarun's topic in PHP Coding Help
change this part of code <td id="present"> <input type="radio" name="present<? echo $rows['STUDENT_ID']; ?>" checked="checked" value="PRESENT">Present </td> <td id="absent"> <input type="radio" name="present<? echo $rows['STUDENT_ID']; ?>" value="ABSENT">Absent </td> to <td id="present"> <input type="radio" name="present[<? echo $rows['STUDENT_ID']; ?>]" checked="checked" value="PRESENT">Present </td> <td id="absent"> <input type="radio" name="present[<? echo $rows['STUDENT_ID']; ?>]" value="ABSENT">Absent </td> and in action page yo can do foreach(S_POST['present'] as $student_id => $value){ //etc. } -
try <?php $test = array('key1'=>'test1', 'key2'=>'value2', 'key3'=>array('test','test1','test2')); function my_str_replace($srch, $replace, $subject){ if(!is_array($subject)) return str_replace ($srch, $replace, $subject); $out = array(); foreach ($subject as $key => $value) $out[$key] = my_str_replace($srch, $replace, $value); return $out; } $a = my_str_replace('test', 'hello', $test); print_r($a); ?>
-
change for ($col = 0; $col < 5; $col++) { if (isset($serenwilde[$rw][$col])) { echo "<li>".$serenwilde[$rw][$col]."</li>"; } } to if (isset($serenwilde[$rw][0])) { echo "<li>".$serenwilde[$rw][0l]."</li>"; }
-
in your INSERT query mysql_query("INSERT INTO topics (managerId, equip, title, url_big, url_small, egroup1, egroup2, egroup3, egroup4, egroup5, egroup6) VALUES ('$userid','$wordquip', '$equip', '$bigpic', '$smallpic', '$egroup1', '$egroup2', '$egroup3', '$egroup4', '$egroup5', '$egroup6')") or die (mysql_error("error 1321")); in fields list equip is on the 2nd position and in value list is 3rd
-
try <?php $musername = '<font color="#ff0000"><u>Psycho</u></font>'; $name = strip_tags($musername); $parts = explode($name, $musername); print_r($parts); ?> btw you can't see html tags in browser - look in source kode
-
change varijable $bgcolorplace to static try[/code]<?php function changebgcolor(){ static $bgcolorplace = 0; if ($bgcolorplace=="0"){ $bgcolorplace="1"; //$bgcolor="444444" echo("0 to 1<br/>".$bgcolorplace."<br/>");//display which part of code is executed 1 to 0 or 0 to 1(can never get the script to run this part), this line is temp/test code }else{ $bgcolorplace="0"; //$bgcolor="ffffff" echo("1 to 0<br/>".$bgcolorplace."<br/>"); //display which part of code is executed 1 to 0 or 0 to 1(It works), this line is temp/test code } } for($i=0; $i<10; $i++){ changebgcolor(); echo "<hr />\n"; } ?>[/code]
-
try to change foreach ($players as $player) { to foreach ($players[1] as $player) {
-
After output_buffering on and ob_start() still not redirecting :-(
sasa replied to usiyalla's topic in PHP Coding Help
remove 1st blank line in file session.php -
$query = "SELECT * FROM (SELECT statez, COUNT(statez) AS c FROM distributors GROUP BY statez) AS r ORDER BY c DESC";
-
you didn't close 2nd 'echo <<<_END' block
-
WHERE `ID` = '{$_POST['ID']}'") something gone wrong in copy paste
-
remove ' from string $valid_chars_regex
-
change WHERE `ID` = "{$_POST['ID']}'") to WH to ' ERE `ID` = '{$_POST['ID']}'") change " to ' before {
-
foreach($results as $link) echo file_get_contents($link);
-
function compare($x, $y) { if ( $x['repeat'] == $y['repeat'] ) return 0; else if ( $x['repeat'] < $y['repeat'] ) return -1; else return 1; } uasort($colors, 'compare'); print_r($colors);
-
my cristal bowl sey: add ; in line before