Jump to content

BlueSkyIS

Members
  • Posts

    4,268
  • Joined

  • Last visited

Everything posted by BlueSkyIS

  1. the number of possible combinations is n!/(n-r)! where n is the number of words in the collection and r is the number of words taken from the collection. So knowing that the minimum number of words is 1 and the maximum is the total number of words in the sentence: $words = explode(" ",$sentence); for ($i=0;$i<count($words);$i++) { // Make every possible permutation using $words[$i]; }
  2. if nothing else, you probably need to wrap some of your arrays, for instance: {$sharedinfo[id]} I always try to consistently single-quote every field. Sometimes you do, sometimes you don't. If you made it consistent, that might help you fix the problem.
  3. You need to add the sort parameter to your Next>> link URL. For instance: echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage&sortby=$sortby'>Next</a> ";
  4. "How do I only show the error AFTER the user has pressed my submit button??" check to see if the form was POSTed. I use this: if ($_SERVER['REQUEST_METHOD'] == "POST") { // The form was posted }
  5. SELECT `names` FROM `table` WHERE `names` IN (SELECT `names` FROM `othertable`) ORDER BY `points` DESC
  6. remove the single quotes from $row = so you have... $row = mysql_fetch_assoc($sql);
  7. try this? $result = mysql_query($query) or die(mysql_error());
  8. while($i_main < $count_main) { $links .= " <a href=\"".$main_nav['pages'][$i_main]."\" class=\"glink\" id=\"g".$i_main2."\">".$main_nav['names'][$i_main]."</a> "; $i_main++; $i_main2++; } echo $links;
  9. because your function echos $links, then loops over some numbers doing nothing: echo $links; // You echo one time, but then.... while($i_main < $count_main) { // Nothing is happening here. $i_main++; $i_main2++; }
  10. what do you mean by "if I leave out $fname='fname' it does not work"? Do you see an error, a "Notice"? You shouldn't need to declare a variable unless you have Notices turned on... Anyway, try using this instead: $output = $row[${$fieldList[0]}];
  11. if i understand correctly, you are trying to get the value of N in: <include picture# N> If you need to get the value of N, you might want to try int preg_match ( string pattern, string subject [, array &matches [, int flags [, int offset]]] ) and look in &matches. perhaps like this: $pattern = '/<include picture# ([0-9]+)>/'; $matches = array(); if (preg_match($pattern, $string, $matches)) { // found at least one match: $image_number = $matches[1]; } Edited: $matches[0] will be the part that matches. $matches[1] is the value in the parentheses. $image_number is N, assuming N is always a number [0-9]+
  12. and then you can refer to it as a variable: ${"var_" . $i}
  13. should have the exact same result either way.
  14. Javascript. You could add an onClose() event to the window to send a value to the window's opener. not php....
  15. how to declare $var as int in PHP: you don't. secondly how to cast a variable like () in PHP: if you want the integer value of a string, use intval($string). If you need to determine if a value is a number, you can use is_numeric(). to test whether a value is an integer, I use if (intval($string) == $string) {}
  16. It looks like you're expecting $ipresult to contain a single value when it will actually contain an entire row. You might try this instead: list($ipresult) = mysql_fetch_row($ipsearch); ...and there is no need to check $ipsearch a second time since you already tested with if ($ipsearch... you probably don't need this: if (!$ipsearch); { echo "Could not run query:" . mysql_error(); exit; }
  17. no. use this to get the result of the query the first time and then use it as you like: $result = mysql_query($sql, $connect1); then you can do stuff like loop over results, etc: while ($row = mysql_fetch_array($result)) { // Do something with the row of data... }
  18. ^^^ yes! I didn't know this and had been doing it a not-so-easy way myself. i think i found my own answer. mysql_query() takes an options resource link, so we can query each separately with: mysql_query($sql, $connect1); mysql_query($sql, $connect2);
  19. after connect2 = mysql_connect(), a mysql_query() is performed. Which connection does the mysql_query() act on? -BSIS
  20. I don't see anything obvious, but I'd be wary of an if (mail()) I'd step through, putting echo() here and there, hack away, etc. etc.
  21. the page is probably going blank due to code after the if. For sure, if you use $_POST['buttonname'] without an _x or _y, you'll get nothing.
  22. exactly. the result of the implode will be INSERT INTO dbTable ('column1') VALUES ('$val1'), ('$val2'), ('$val3'), etc. There will be one row for each value.
  23. I see this in there: if(isset($_POST['register'])) should be if(isset($_POST['register_x']))
  24. I use implode. Something like this: "INSERT INTO dbTable ('column1') VALUES ('".implode("'), ('", $_POST['myArray'])."')"; -BSIS
×
×
  • 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.