Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. Ajax method Test3.js var testvar = 'Failure'; function checkVar() { alert(testvar); } Test1.html <html> <head> <script type="text/javascript" src="test3.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript"> $().ready(function() { $("#btnTest").click(function() { checkVar(); }) $.get( "test2.php", function(data){ testvar = data; }, "text" ) }) </script> </head> <body> <input type="button" name="btnTest" id="btnTest" value="Test Var"> </body> </html> Test2.php <?php echo "Success"; ?>
  2. Yes, that way it gets rendered in the the js script while the PHP is executing on the server. The page is then sent to the browser at which point the external JS file is included
  3. My theory is that by the time the external js file is loaded by the browser, PHP has finished executing on the server. edit: try issuing an AJAX call to get the value when the page has loaded
  4. Out of curiosity, as no-one else can recreate this problem, what happens if you specify the indexes of the checkbox array? <input type="checkbox" name="user_rights[0]" value="0">0<br> <input type="checkbox" name="user_rights[1]" value="1">1<br> <input type="checkbox" name="user_rights[2]" value="2">2<br>
  5. In which way is NOW() behaving contrary to the manual?
  6. A quick Google suggests you can do it with the ibm_db2 extension for PHP
  7. Did you look at UNIX_TIMESTAMP() in the manual?
  8. What software are you using to view the tables and produce the data shown in your screenshot? Is it an old version that requires updating, or replacing altogether?
  9. That is a screenshot of the table structure (and looks correct). You should be looking at the data in that table to see if there really is one with a blank database name.
  10. Yes, you now have an array of lines instead of one long string try function getdatafile($file) { # code... $coursedata = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $course_array = array(); foreach($coursedata as $row) { $course_array[] = explode('||', $row); } return $course_array; }
  11. Not only changes that character but appears to change the whole description
  12. Are you talking about "\n"? If so, instead of file_get_contents(), use file() which returns an array of the lines in the file.
  13. 'leave' is a MySQL reserved word. You need to enclose it in backticks (`leave`). NB - not single quotes. http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html
  14. You are working on the incorrect assumption that returning no results will result in query failure. No results is a perfectly valid result. Check the number of rows returned instead to see if any records were found.
  15. It sounds like the problem is with an empty value in one of the records inside that "db" table
  16. It was to enable you to view the raw data held by MySQL to try and locate the blank name. Do you have another database on your server with a table named "DB" which might have the offending blank name?
  17. Try executing just the SQL SELECT SCHEMA_NAME , DEFAULT_CHARACTER_SET_NAME , DEFAULT_COLLATION_NAME FROM information_schema.schemata;
  18. It was working when it left the factory! What is the actual error message that you get?
  19. you could try running this query and see if there is an empty schema name $sql = "SELECT SCHEMA_NAME , DEFAULT_CHARACTER_SET_NAME , DEFAULT_COLLATION_NAME FROM information_schema.schemata";
  20. $result = getDate($campid); echo $result['date']; If you only ever get a single date, why return an array?
  21. Probably. Let us know. Or, you could UPDATE post JOIN topic ON topic_id = 2014 SET post_forum_id = topic_forum_id WHERE post_id = 237;
  22. Are you setting the value of $_SESSION['start_time'] somewhere else in the script then?
  23. Then your code isn't what SocialCloud posted
  24. act: verb behave perform operate function @roparzhhemon237, It isn't a subquery, it is part of the INSERT...SELECT syntax, as Ch0cu3r's link shows
  25. If that hard-code "2014" never needs to change INSERT INTO post_table (post_topic, post_forum) SELECT 2014, topic_forum_id FROM topic_table WHERE topic_id= 2014;
×
×
  • 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.