-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
Get MySQL Results from Current Time to Last Week
PFMaBiSmAd replied to scottnicol's topic in MySQL Help
Literal datetime values are strings and must be enclosed in single-quotes. Assuming you have set the timezone in mysql, the following query will (untested) accomplish the same thing - $sqlquery = "SELECT * FROM dirt WHERE timestamp BETWEEN NOW() - INTERVAL 7 DAY AND NOW() ORDER BY votes DESC LIMIT 30"; Also the BETWEEN min AND max syntax need the min to be less than max. Your query had min > max because today is greater than a date in the past. -
Each <area tag has a href="..." attribute. Just use a GET parameter ?seat=some_value on the end of each URL in the href to tell you which one was clicked on. The value would be available as $_GET['seat']
-
When you do a 'view source' of the page in your browser, what do you get?
-
Your use of ob_start(); and ob_end_flush(); could be hiding any errors being reported/displayed in the first code. Just remove those two statements (you should only use output buffering if you want to capture output, not to fix problems in your logic.)
-
include_path not working on new installation
PFMaBiSmAd replied to mellis95's topic in PHP Installation and Configuration
Does the phpinfo() show that you are changing the php.ini that php is using? Edit: Actually, I'm not sure why we are answering a slightly dated thread, it was probably already solved. -
If all the information you have posted is accurate, best guesses are that either you have disabled cookies in your browser or session handling is disabled or is not working as expected on your server. After you attempt this and your browser is still open, look at the cookies or the page info in your browser and check if you are getting a cookie named PHPSESSID under your web site URL.
-
THAT error is because you are not passing an array to a function that expects and array. That has nothing to do with your mysql query question. Why cannot people provide actual information that they know about a problem when they ask a for help No one can really help you with what is wrong with your code without seeing the actual code responsible for the symptom and the symptom.
-
That's not what he asked, nor is that what the link he provided suggested.
-
OR should have worked. Could you form the query string in a variable (i.e. $query) and echo and post it along with example data showing what the location and genre columns contain that should match the query you are trying.
-
It's called Pagination. See this tutorial - http://www.phpfreaks.com/tutorial/basic-pagination
-
Your script is in - The require() statement you are using is attempting to access - A leading slash / on a file system path refers to the root of the current hard disk. Your code may have worked before, but not as written with the leading / on it.
-
PHP register form can't access mySQL database
PFMaBiSmAd replied to bicoo_2010's topic in MySQL Help
Umm. My statement concerned what DaiLaughing posted right above it - -
PHP register form can't access mySQL database
PFMaBiSmAd replied to bicoo_2010's topic in MySQL Help
The list of field names in an insert query are only required if you don't provide a value for every column. bicoo_2010, sorry to be blunt, but you seem to be just randomly changing code for no good reason and without knowing why it should or should not be a certain way. It will take you a very long time to produce any code that works using this method. Just changing code in a desperate effort to eliminate error messages without finding out why it was not working in the first place does not lead to any learning and you will end up making the same basic mistake over and over. You must learn the reason why you are doing any particular thing. For example, the first problem of not putting double-quotes at the start and end of your query string. You do have quotes around the other strings in your code. Quotes must be around the query string as well in order to make it a string. Edit: And I just tried the form code you posted and the form is incomplete and cannot possible be submitting at all to your reg.php script. The first step in this process is the form and it must be tested and work first. -
If you are using an include() statement with a file system path and not a URL, the code in the included file essentially becomes part of the source code of the main file at the point where it was included and it inherits the variable scope of the main file, including any session variables. You would need to post your main code showing how you are including the file and the included code showing this problem for anyone to be able to tell you why your code is not working.
-
How long does the main php script typically take to execute each pass through the foreach() loop? The ajax cannot make a http request to the same main php script as that would cause another instance of the script to be started. You would need the php script to update the changing status information in a location (database table, flat-file) where another php script (such as get_status.php) could read it and then the ajax would make http requests to the get_status.php page. You would need to generate a unique process id (perhaps just use the session id if you are already using a session for the visitor) per visitor to identify the correct status information in the http requests so that you could have more than one instance of this process at any point in time.
-
Assuming that you didn't xxxxx out a www. vs no-www. on either of the URLs, add the following two lines of code at the line after the line with your first opening <?php tag in both files - ini_set("display_errors", "1"); error_reporting(E_ALL);
-
What are the complete URLs (with the http://www.domain.com/path/page_name.php, xxxxxx out the domain if you don't want to post it) of both the checklogin.php page and the users/username/ page? Also, what does a phpinfo() statement show for the session.cookie_path and session.cookie_domain settings?
-
The correct format for putting a GET parameter on the end of a URL is - your_page.php?name=value&name2=value2&name3=value3 In your case you are only using one name/value pair, so you would need to produce - your_page.php?name=value If the name you want is comDiscussNo and the value is in the variable $comDiscussNo, you would need to use - your_page.php?comDiscussNo=$comDiscussNo
-
Edit: ^^^ I want to know the same thing. You keep starting new threads for this problem. Why? If you had continued with your very first thread on this problem, you could have probably solved this by now. When you don't continue a problem in the same thread, that just throws away the history of how you got to this point and people end up needing to ask you for details of what you are doing.
-
Yes, because you have two lines of code that unconditionally assign 100 every time the page is requested - $_SESSION["playerHp"] = 100; $_SESSION["dragonHp"] = 100; You would need to add conditional logic so that they are only initialized once - if(some_condition_in_your_script_when_to_initialize_the_variables){ $_SESSION["playerHp"] = 100; $_SESSION["dragonHp"] = 100; }
-
^^^ You generally don't want to ever loop through the records your query returns and filter the results using some php code. You should just select just the data you want in your query and if you actually wanted to do this for ALL or just a range/list of departments, you would also do that in your query using a GROUP BY. It would help if you posted your query and showed how your ts_timein and ts_timeout are defined, because you can likely do everything in a single query and then just iterate over the date/total hours values.
-
Also, the global keyword only has meaning inside of a function definition and even then it should not be used. I'm guessing that the code you posted is not inside of a function, so you wasted some time typing all those lines with the global keyword and they should be removed since they don't do anything.
-
Since the following query does match your id 1 row (just tested), you must be doing something else wrong in your actual code or query - SELECT * FROM your_table where field LIKE '%walking%' It would take seeing some actual information about what you are doing to be able to help you.
-
Php is a server-side scripting language and the include statements have nothing to do with the browser.