-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
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"; ?>
-
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
-
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
-
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>
-
MySQL exact equivalent of the PHP "time()" function
Barand replied to roparzhhemon237's topic in PHP Coding Help
In which way is NOW() behaving contrary to the manual? -
A quick Google suggests you can do it with the ibm_db2 extension for PHP
- 1 reply
-
- 1
-
MySQL exact equivalent of the PHP "time()" function
Barand replied to roparzhhemon237's topic in PHP Coding Help
Did you look at UNIX_TIMESTAMP() in the manual? -
Found an entry in the 'db' table with empty database name; Skipped
Barand replied to Klaipedaville's topic in MySQL Help
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? -
Found an entry in the 'db' table with empty database name; Skipped
Barand replied to Klaipedaville's topic in MySQL Help
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. -
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; }
-
Not only changes that character but appears to change the whole description
-
Are you talking about "\n"? If so, instead of file_get_contents(), use file() which returns an array of the lines in the file.
-
'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
-
Error condition not triggering correct response
Barand replied to mmckimson1's topic in PHP Coding Help
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. -
Found an entry in the 'db' table with empty database name; Skipped
Barand replied to Klaipedaville's topic in MySQL Help
It sounds like the problem is with an empty value in one of the records inside that "db" table -
Found an entry in the 'db' table with empty database name; Skipped
Barand replied to Klaipedaville's topic in MySQL Help
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? -
Found an entry in the 'db' table with empty database name; Skipped
Barand replied to Klaipedaville's topic in MySQL Help
Try executing just the SQL SELECT SCHEMA_NAME , DEFAULT_CHARACTER_SET_NAME , DEFAULT_COLLATION_NAME FROM information_schema.schemata; -
Found an entry in the 'db' table with empty database name; Skipped
Barand replied to Klaipedaville's topic in MySQL Help
It was working when it left the factory! What is the actual error message that you get? -
Found an entry in the 'db' table with empty database name; Skipped
Barand replied to Klaipedaville's topic in MySQL Help
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"; -
Need Help With Getting values From a PHP Function
Barand replied to surprino's topic in PHP Coding Help
$result = getDate($campid); echo $result['date']; If you only ever get a single date, why return an array? -
Is this mix of php and mysql translatable into pure MySQL ?
Barand replied to roparzhhemon237's topic in PHP Coding Help
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; -
Are you setting the value of $_SESSION['start_time'] somewhere else in the script then?
-
Then your code isn't what SocialCloud posted
-
Is this mix of php and mysql translatable into pure MySQL ?
Barand replied to roparzhhemon237's topic in PHP Coding Help
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 -
Is this mix of php and mysql translatable into pure MySQL ?
Barand replied to roparzhhemon237's topic in PHP Coding Help
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;