-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
I'm thinking that enough time has gone by that a session id cookie that was set with some + life time value has now expired or that the session data file on the server was deleted by garbage collection.
-
You should be developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON so that all the php errors would be reported and displayed. You will save a ton of time. There would be an errors about an undefined variable explode and a function name must be a string in your line of code with $explode(...) because you have a $ in front of the function name explode(). I also recommend for any type of file modification operation like this that one of the first things your code does it to rename your original file to something like news.bak so that you always have an unmodified copy of the data in case something goes wrong when writing the modified output to the news.db file.
-
You can use mysql_error() to find out why your query is failing. You can also look at it. You have an extra comma after $selectval, that wasn't present in the first post. You also need single-quotes around the string data values in the query.
-
Session not carried between sub-folder and root
PFMaBiSmAd replied to stuartmarsh's topic in PHP Coding Help
Any chance you have a $_COOKIE['test'] that only matches your root folder AND register_globals are on so that the cookie is overwriting your session variable with the same name 'test'? All indications are that your $_SESSION variable is getting overwritten. Have you tried using a different name than test? -
It depends on the session.cookie_lifetime setting (assuming that you are passing the session id using a cookie) or if you are passing the session id on the end of the URL and you are using a URL that contains the session id when you revisit the second page after opening your browser.
-
Session not carried between sub-folder and root
PFMaBiSmAd replied to stuartmarsh's topic in PHP Coding Help
Any .htaccess files in either or both the admin and root folder that could be affecting the session settings? I recommend that you echo session_id(); after the session_start() statements so that you can see if/when the session id is changing. -
Session not carried between sub-folder and root
PFMaBiSmAd replied to stuartmarsh's topic in PHP Coding Help
Add the following three lines of code after your first opening <?php tag and before your session_start() statement on both pages - ini_set("display_startup_errors", "1"); ini_set("display_errors", "1"); error_reporting(E_ALL); -
Session not carried between sub-folder and root
PFMaBiSmAd replied to stuartmarsh's topic in PHP Coding Help
A url with the www. on it and a url without the www. on it is not switching domains, but sessions won't match both unless you set the session cookie parameters correctly. It sounds like your code on the page in the root folder is clearing the session variables. You would need to post your code if you want help with what it is doing. -
Session not carried between sub-folder and root
PFMaBiSmAd replied to stuartmarsh's topic in PHP Coding Help
Are you switching back and forth between url's that have and don't have the www. on them and/or what does a phpinfo(); statement show for the session.cookie_path setting? -
Mysql converts a quoted number to a FLOAT. If the number happens to be a decimal, you can end up with an unintended floating point conversion error. It also causes more processor cycles due to the first conversion to a float, then the conversion to the actual data type of the field.
-
As someone already suggested, you need to define everything before you can write any code to do it. For example, where is your template stored? You class constructor should accept, as a parameter, the name of the template to use and then read it from wherever it is stored and place it into a class variable. Once you have the raw template available in an instance of your class, you can then think about replace values in it. Once you have replaced all the values in it, you can think about displaying it.
-
There's no code in your code to do anything other than echo 'hello'. In order for you to write a class to implement even a simple template, you must first define what you want each of your class methods to do and what class variables you will need. You have just thrown some random code into a class structure.
-
unable to input value into database table using php code
PFMaBiSmAd replied to genzedu777's topic in PHP Coding Help
Yes, mdewyer posted a generic answer without reading your code to see that you are using mysqli_ functions and since you have not bothered to read the php.net documentation for the functions you are putting into your code, you don't know the proper parameters to put into the function call, even after you got an error message that indicates the wrong number of parameters. Programming language reference documents exist for a reason, so that you can look up how to use the elements of those programming languages. Programming languages are one of the more heavily documented subjects on the planet because it is simply impossible to effectively use a programming language without reading the documentation for whatever elements you are using of that language. -
I recommend getting a list of the matching available files into an array using glob, then iterating over that array. Your existing code will output empty values/php errors for the lines where there are not matching images.
-
unable to input value into database table using php code
PFMaBiSmAd replied to genzedu777's topic in PHP Coding Help
It's likely that your form is invalid (the dob field is not located inside the form.) -
Php variables are not replaced with their value when they are enclosed by single-quotes. Unless you are building a string that also contains literal characters in addition to php variables, there's no point in putting any quotes around a php variable.
-
To reference the value from the url for ?ReportType= xxxxx you would need to use $_GET['ReportType'] in your php code.
-
The reason you are getting a zero minutes value is because you have single quotes around the $xplodeTime variable in the strtotime('$xplodeTime') code and php variables are not replaced with their value when inside of a single-quoted string. The reason you are getting the wrong hour is because you are specifying a time zone in the value (CST) that is different than the time zone setting that php is using and php is adjusting the number of seconds that strtotime() returns to your current time zone setting.
-
Since you forgot to tell us what it does do vs what output you expected, no one here can directly help you. It also appears that those two lines of code are taken out of their actual context, so there could easily be a dozen different problems in the code you did not post that could cause the two lines you did post to not work. Post the actual code that demonstrates the problem and tell us what the actual symptom is.
-
Works as expected for me - echo date('H:i', strtotime('12:03PM')); You would need to post the code that produces the incorrect output for any one here to be able to help you with what it is doing.
-
Your <form > tag does not have the necessary enctype= attribute so that uploading a file would work. You php code is also not testing if the upload worked successfully before attempting to access any of the uploaded file information. I recommend reading the upload handling section in the php.net documentation - http://us3.php.net/manual/en/features.file-upload.php
-
1:03 pm is 13:03 in military time/24 hour format, not 12:03 pm.
-
Your form's drop down select list lets you pick either sid or sname for the $field variable that the query operates on as a column name in the WHERE clause. Obviously, sid is not a column in the table you are using.
-
If you are using mysqli, you must use mysqli_error($con) to find out why the query is failing.
-
You would need to give your form's submit field a - name='submitted' attribute if you want it to do the same thing as the hidden form field that you removed was doing.