Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. try $query_string[] = 'INSERT INTO'; $query_string[] = $array['table']; $query_string[] = '(`'.implode('`, `', array_keys($array['values'])).'`)'; $query_string[] = 'VALUES'; $query_string[] = "('".implode("', '", array_values($array['values']))."')";
  2. $list = implode ("','",$aEmail); $query = "select id from table where id in('$list')";
  3. last part of script // clean up table - makes your code valid! if($i < $max_columns) { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table> must be // clean up table - makes your code valid! if($i > 0) // $i is always be less then $max_columns { for($j=$i; $j<$max_columns;$j++) echo "<td> </td>"; } ?> </tr> </table>
  4. try SELECT a.user, a.id, a.text, a.posted FROM item a WHERE a.posted = 1 AND (SELECT COUNT(b.id) FROM item b WHERE b.id>a.id AND a.user=b.user AND b.posted=1)<3 ORDER BY a.id DESC LIMIT 10
  5. change form part to <?php //this code is from a while loop through $optionslist print "<input type=checkbox name='chk[]' value='$optionslist[name]'>" ; print $optionslist[name]; //$optionyear=$optionslist[name]."yyyy"; print " <select name='mm[$optionslist[name]]'> <option>MM</option> $monthselect <select name='dd[$optionslist[name]]' > <option>DD</option> $dayselect <select name='yy[$optionslist[name]]'> <option>YYYY</option> $yearselect "; ?> and Page 2 to <?php if (isset($_POST['chk'])){ foreach ($_POST['chk'] as $name){ $m = $_POST['mm'][$name]; $d = $_POST['dd'][$name]; $y = $_POST['yy'][$name]; echo 'Name: ', $name,' | MM: ', $m, ' | DD: ', $d, ' | YYYY: ', $y, "<br />\n"; } } ?>
  6. sasa

    Adding

    for your data SUM(`field_name`) return -45. is it OK?
  7. try $contents .="\tif(parse_url(PUMMS_GLOBAL_INSTALLED_URL,1) !='localhost') {\$pumms_domain_cookie=ereg_replace('^[^\.]*\.([^\.]*)\.(.*)$', '\\1.\\2',parse_url(PUMMS_GLOBAL_INSTALLED_URL,1));}else{\$pumms_domain_cookie='';}\n";
  8. trY <?php $test = '1819237363Hasbrome'; $b = preg_split('/(?=[^0-9])/',$test,2); print_r($b); ?>
  9. try SELECT * FROM $tablename WHERE text LIKE '%$search%' or tags LIKE '%$search%' or title LIKE '%$search%' and (cat=$cat1 or cat=$cat2)
  10. try <?php $test = '{"totalResultsCount":1,"geonames":[{"countryName":"United States","adminCode1":"CA","fclName":"spot, building, farm","countryCode":"US","lng":-117.1883677,"fcodeName":"airport","fcl":"S","name":"San Diego International Airport","fcode":"AIRP","geonameId":5391847,"lat":32.733384,"population":0,"adminName1":"California"}]} '; preg_match_all('/"(lat|lng)"[0-9.-]+)/', $test, $b); $b = array_combine($b[1], $b[2]); print_r($b); ?>
  11. you have $i = $_GET['id']; in your script it's mean thet your URL looks like some_file.ph?id= blah but in your form tag you have <form name='input' action='".$_SERVER['PHP_SELF']."' method='post'> it's mean that url is sone_file.php miss ?id=blah part
  12. you don't set up variable id in your form action url
  13. try <?php $lines = array(); $txt = "The documentation for 'offset' is misleading. It says, offset may be specified to begin searching an arbitrary number of characters into the string. Negative values will stop searching at an arbitrary point prior to the end of the string. This is confusing if you think of strrpos as starting at the end of the string and working backwards. A better way to think of offset is: If offset is positive, then strrpos only operates on the part of the string from offset to the end. This will usually have the same results as not specifying an offset, unless the only occurences of needle are before offset (in which case specifying the offset won't find the needle). If offset is negative, then strrpos only operates on that many characters at the end of the string. If the needle is farther away from the end of the string, it won't be found. If, for example, you want to find the last space in a string before the 50th character, you'll need to do something like this.--------------------------"; print_r(makeWordWrap($txt, 70)); function makeWordWrap($text, $maxChars){ /* see if the text is longer than maxChars characters. If it is, find the space closest to character maxChars and split the string there */ /* do this again and again until we have an array of lines that are all maxChars or less characters long */ if(strlen($text) < $maxChars){ return array($text); } /* we know the text is longer than 70, so figure out how many lines we are going to need */ $currentChunk = substr($text,0,$maxChars); $lastSpace = strrpos($currentChunk," "); $currentRow = substr($text,0,$lastSpace); $text = substr($text,$lastSpace); $out = array_merge(array($currentRow), makeWordWrap($text,$maxChars)); return $out; } ?>
  14. if you pass variable throw URL use urlencode() fubction
  15. look http://www.weberdev.com/get_example-3688.html
  16. change line echo $line[$i]; to echo $line;
  17. try <?php $str="1 and (2 and 3) and (4 or 5) or 6"; //$str="(1 and 2) or 3"; $b = preg_split('/(and|or)(?=[^)]+(\(|$))/i', $str); print_r($b); echo '<hr />'; foreach ($b as $k => $v){ $v = trim($v); $v = trim($v, '('); $v = trim($v, ')'); $b[$k] = $v; } print_r($b); ?>
  18. move line $tableRowNumber = 1; before foreach loop
  19. http://portableapps.com/apps/development/xampp
  20. try <?php $array = array('01', '01', '02','02','02','03','03'); $colors = array('red', 'blue'); $color_count = count($colors); $color = 0; echo '<div style="color:',$colors[$color],';">',$array[0],'</div>'; for ($i =1; $i < count($array); $i++){ if ($array[$i - 1] != $array[$i]) $color = ++$color % $color_count; echo '<div style="color:',$colors[$color],';">',$array[$i],'</div>'; } ?>
  21. or <?php $a = ' '; if (preg_match('/\S+/',$a)) echo 'not empty'; else echo 'empty'; ?>
  22. <?php $vals = array('sasa', 'xxx'); $sasa = 'OK'; $xxx = 'ups'; foreach ($vals as $val) echo $val, ' --> ',$$val,"<br />\n"; ?> output sasa --> OK<br /> xxx --> ups<br />
×
×
  • 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.