Jump to content

madcapone

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by madcapone

  1. It says it's undefined because you have to set it some value. What's $day[$x] ???? Try this fix ... Pseudo-code (didn't check the rest, just the undefined $day variable ...) $x=2; $times = 59; while ($x < $times) { $prev = $x-1; $next = $x+1; $day[$prev] = isset($day[$prev]) ? $day[$prev] : 0; $day[$next] = isset($day[$next]) ? $day[$next] : 0; $day[$x] = isset($day[$x]) ? $day[$x] : 0; $deposit = $day[$x] + $day[$prev] + $day[$next]; echo $x; echo " - "; echo $deposit; echo "<br>"; $x++; }
  2. Hi! I've developed some piece of software locally using up-to-date PHP5 and Apache 2.2. This software is PHP/Oracle. All my database related functions are now PHP5 standard. Like oci_fetch_all instead of ocifetchstatement, oci_parse instead of ociparse, and so on. So what I did was to create an include file that goes in all my php pages and this include file contains compatibility functions. I was just trying to make it work on both enviroments. I've been smacking my head for so long now I might get Parkinson. Here are my working functions (maybe it'll help someone). # oci_parse if (!function_exists("oci_parse")) { # Custom Function function oci_parse($connection, $string_query) { return ociparse($connection, $string_query); } } # # oci_execute if (!function_exists("oci_execute")) { # Custom Function function oci_execute($statement, $mode = OCI_COMMIT_ON_SUCCESS) { return ociexecute($statement, $mode); } } # # stripos if (!function_exists("stripos")) { # Custom Function function stripos($str, $needle, $offset = 0) { return strpos(strtolower($str), strtolower($needle), $offset); } } # #str_ireplace if (!function_exists("str_ireplace")) { # Custom Function function str_ireplace($needle, $replacement, $haystack) { $i = 0; while (($pos = strpos(strtolower($haystack), strtolower($needle), $i)) !== false) { $haystack = substr($haystack, 0, $pos) . $replacement . substr($haystack, $pos + strlen($needle)); $i = $pos + strlen($replacement); } return $haystack; } } # Those are all working fine. Trouble comes with oci_fetch_all ... # oci_fetch_all if (!function_exists("oci_fetch_all")) { # Custom Function function oci_fetch_all($statement, $output, $skip = 0, $maxrows = -1, $flags = OCI_FETCHSTATEMENT_BY_COLUMN) { return ocifetchstatement($statement, $output, $skip, $maxrows, $flags); } } # This won't work. The error I get is undefined variable in the line in which the oci_fetch_all is called. For example: 1. # 1. Parse & Execute 2. $Query_Statement = oci_parse($conn, $statement); 3. oci_execute($Query_Statement); 4. 5. # 2. Fetch 6. $Return["Rows"] = oci_fetch_all($Query_Statement, $Return["RS"], $QF_Init, $QF_PageSize, $QF_Flag); This would return me an error in line 6: undefined Variable Return (...). I understand why it doesn't work. Because the oci_fetch_all was supposed to set the $Return["RS"] variable with the fetched Result Set, but when the new custom function is called $Return["RS"] is just an unset variable. Also this function actually returns the total records found (either columns or rows). So I know that my Custom Function can't just return the deprecated function, but I can't figure out how to solve that. Is there any other way to rename a function, or copy it to another function name or something like that? I know it looks nooby, but I tried something like oci_fetch_all = ocifetchstatement; out of pure despair. Any help will be very much appreciated.
×
×
  • 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.