Jump to content

btherl

Staff Alumni
  • Posts

    3,893
  • Joined

  • Last visited

Everything posted by btherl

  1. Can you post line 9 of login.php? Or you can post the whole file if it is small.
  2. Ok it appears it does accept them. What is the error you get and what is the actual query you are running (after variable substitution)?
  3. Ok I think i'm clear on the problem now. Postgres stores timestamps with a GMT offset, not an english description of the timezone such as "America/Chicago". And it doesn't translate descriptions into offsets either. If you can work out yourself which timezone you are in and give it the offset, then that should work fine. Even if your time zone changes due to daylight savings, the timestamp you stored is still valid and will work with postgres arithmetic. It checks the timezone of "timestamp with time zone" data types and takes them into account.
  4. What happens when you use what you have now?
  5. There is no simple way to run a script on a different server. If you want maximum reliability then you can create a db table which stores the command, who triggered it and when, which server it's running on, its output (or the name of a file containing the full output), any errors, and anything else interesting. The front end adds an entry to that table, and the AJAX calls a simple script that checks if the db table entry is marked as "done". In the meantime, another job, which can run on another server, polls that db table and starts anything that needs starting. The most complex script is the one that runs each job, monitors it and makes sure any error status is recorded. The job may crash altogether, in which case the monitor needs to detect that and record it in that db table. If the script succeeds then the job itself can update the db table.
  6. The way to copy and paste a query is to have your php script echo the query like this: print "<br>About to run this query: $wsi_query<br>"; And then copy and paste it exactly. Also can you please paste the code you used to display all query results in a loop?
  7. There's two approaches that come to mind here. The first is recursion: function getParents($DoggieID, $Depth, $DepthLimit) { $Sire = getSire($DoggieID); $Dam = getDam($DoggieID); $Depth++; if ($Depth == $DepthLimit) { return array($Sire, $Dam); } else { # Now get grandparents too $SireParents = getParents($Sire, $Depth, $DepthLimit); $DamParents = getParents($Dam, $Depth, $DepthLimit); return array($Sire, $Dam, $SireParents, $DamParents); } } That's the general idea - the data structure used to return everything might not be ideal. The other idea is to use self joins: SELECT RegName, SireID, DamID , p2.RegName AS p2RegName, p2.SireID AS p2SireID, p2.DamID AS p2DamID, CASE WHEN p2.ID = p.SireID THEN 'Sire' ELSE 'Dam' END AS p2ParentType , p3.RegName AS p3RegName, p3.SireID AS p3SireID, p3.DamID AS p3DamID, CASE WHEN p3.ID = p2.SireID THEN 'Sire' ELSE 'Dam' END AS p3ParentType FROM pedigrees p LEFT JOIN pedigrees p2 ON (p2.ID = p.SireID OR p2.ID = p.DamID) LEFT JOIN pedigrees p3 ON (p3.ID = p2.SireID OR p3.ID = p2.DamID) WHERE p.ID=123 And you can add p4, p5, p6 etc etc. Neither of these approaches are ideal but they will get the job done. What you really need for the output is a tree structure.
  8. Using the same variable $query might be an issue. I would try using a different variable name for each query.
  9. Can I confirm - when you run this query in workbench it gives all results, including lrank = 1, but when you run it in php and output all rows it is missing the lrank = 1 row? Did you copy and paste the query when doing this comparison?
  10. When you test the query in mysql workbench for one of the seasons where the min or max is not showing, what output do you get?
  11. The usage of $url looks fine to me. Can you try putting a space in front of "width" ?
  12. There are many possibilities, one of which is: Defining the CSS files: <?php $css_files = array( "_css/compare.css", "_css/groovy.css", ); ?> And then when you are producing the HTML output: <?php foreach ($css_files as $cf) { print "<link rel=\"stylesheet\" href=\"$cf\">\n"; } ?>
  13. Ok you've now identified the problem - sqlite IS installed in your system, but not installed in php. I don't know enough about your OS to help further, but there appear to be related comments here - http://php.net/manual/en/sqlite.installation.php
  14. I would try just phpinfo(). My guess is that the server is configured not to display errors and sqlite_libversion() is not defined.
  15. An exception can break out of anything. But if you don't always want to execute a particular method you probably shouldn't be writing it in a chain in the first place. Or you can replace it with a mutant method which can handle both types of output from the previous stage in the chain. That's the typical approach in functional and logic languages where you have no choice about chaining.
  16. Have you read this thread? http://www.phpfreaks.com/forums/index.php?topic=37442.0 According to the error the output was started on the first line of your script.
  17. Ok that tells you the problem - your script expects a response saying "percentDone:53" or something similar, but instead the response is "duplicate torrent". You need to check if the response is "duplicate torrent", and if it is, do something appropriate.
  18. Ok, let's trace back the cause of the error: if (preg_match('/"percentDone":[0-9.]+/i', $result[0], $matches)) $temp was not set because this preg_match() did not match. It didn't match because it didn't find "percentDone" followed by a number in $result[0]. $result[0] came from callTransmission(). The difficulty is that you don't know at which point things failed. The first step in finding out where it failed is to uncomment this code: /* echo "<pre>"; print_r($result); echo "</pre>"; */ So you can see what is in $result, and see if it really does have the "percentDone" that preg_match() is looking for. You can uncomment that code by removing the "/*" and the "*/" that surround it. If you're not sure what the output means, please post it here so we can take a look.
  19. The right fix for that depends on how you want the program to behave. One possible fix is: $temp = 0; # Default value if it can't be found in $result[0] if (preg_match('/"percentDone":[0-9.]+/i', $result[0], $matches)) $temp = str_replace('"id":', "", $matches[0]); // $temp="hlDr1wqu2ONtM3McVGHoVzfrkp2UgUcGwDt66IuxAe0LBkru"; $id[0] = $temp; But instead you might want to skip the later code if $temp wasn't able to be set.
  20. $Delete = mysql_query("DELETE FROM blabbing WHERE id='$blad_id' AND mem_id='$id'"); header("location: profile.php?id=$id"); How do you know if this query succeeded or failed? Also it's very strange that you have a loop over $_POST, and inside the loop you check if the key is NOT deleteBtn. And then inside that you use two values $blad_id and $id which are not related to the key you found in $_POST at all. I don't understand the logic of that.
  21. I thought you wanted to put multiple files into one zip? And that the problem is that when you open the zip to get the files back, it creates directories as well? If you use this code it should not create the directories when you open the zip file: //add the files foreach($valid_files as $file) { $zip->addFile($file, basename($file)); }
  22. Would it be Percentage = O / T * 100 Where O = obtained marks and T = total marks?
  23. Ok, can I clarify what the problem you're having is - is it that the files you add to the zip archive keep their directory inside the zip file, and instead you want them to be just files only? If that's the case I would try this: $zip->addFile($file,basename($file)); Based on the documentation here: http://www.php.net/manual/en/function.ziparchive-addfile.php
  24. What do you want to use them for?
  25. Please show the code.
×
×
  • 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.