-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
How do you know it is not working? Does the query produce an error, as indicated by using mysql_error(); or does it simply fail to match any rows in your table?
-
The if() statement is missing a closing ) and produces a fatal parse error, but you should have discovered that when you put the code into your file and executed it on your development system (almost all of the code you see posted in a forum is NOT TESTED and could contain typos.) You should be developing and debugging your code on a system with error_reporting set to E_ALL and display_error set to ON in your master php.ini so that all the php detected errors will be reported and displayed.
-
How to php loop with multiple databases
PFMaBiSmAd replied to skillednerd's topic in PHP Coding Help
If you truly need to access two different databases at one time, you will need two different database connections and then simply use that connection link in the appropriate mysql_ statements. -
functions in include file: Call to undefined function
PFMaBiSmAd replied to funzoh's topic in PHP Coding Help
The only way you can use a URL to do this is if the file being requested does not get parsed/executed as a php file. You would either need to disable the php language engine for that file or use a file extension that does not invoke the php language. If you do this, you won't be able to put any security related settings into the file being included as that information would be available to anyone who happens to find the file and request it themselves. You could have the file in an encrypted format and decrypt it after it was included, but that would add even more time to your page generation time every time you included a file. And, you do realize that using a URL in an include statement takes 50 - 100 times longer to execute than doing this through the file system. -
The following are the differences between the two requests - 2011-01-23 08:03:01|0.06320700 1295791381 [HTTP_ACCEPT]=image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* [uNIQUE_ID]=TTw1FK54U@IAAFiuBboAAAEG [REQUEST_TIME]=1295791381 2011-01-23 08:03:07|0.30064900 1295791387 [HTTP_ACCEPT]=*/* [HTTP_REFERER]=http://x.mochiads.com/srv/1/49876907fdb169d1.swf [HTTP_X_FLASH_VERSION]=10,1,102,64 [uNIQUE_ID]=TTw1G654U@IAAFiuBeAAAAEG [REQUEST_TIME]=1295791387 The second request is apparently occurring because the .swf that you are loading on your site is sending your browser to the mochiads site and it is then causing your browser to request your page again, ~6 seconds later in this case. This action is probably out of you hands, so the best you can do is detect and ignore the extra request(s). The UNIQUE_ID is, well, unique and cannot be used. There's also no guarantee that you will get exactly two requests in every case either. It does appear that the request is coming from the browser, so you can probably use a $_SESSION variable to detect and ignore the extra request(s). I would use a $_SESSION['page'] variable that you use to remember the current page. If you navigate to a new page (I would use $_SERVER['REQUEST_URI'] to identify pages as this would allow you to both use GET parameters on the end of one URL to specify different games or different URLs to specify different games), the $_SESSION['page'] variable either won't exist at all (the first time you did this after opening your browser) or it will hold the previous/different page name. In either of these two cases, you would assign it the current page name and increment the timesplayed counter in the database. This will cause the counter to increment only on the first request for any specific page.
-
Since you didn't state what problem, error, or other symptom you saw in front of you that leads you to believe that part of the code isn't right, no one here can really help you based on what you posted above. Did you even add the validation code that someone posted to test if only one of $name or $email is set and are you testing if there were no validation errors before you actually execute the final part of the code on that page?
-
SELECT * FROM table WHERE DATE(date_time_value) = curdate() ORDER BY date_time_value
-
AND is a logical operator, not a list separator.
-
I would start by finding out everything you can about the two requests. Add the following code to your page so that you can log all the information that the server gets with the requests - <?php $log_this = date('Y-m-d H:i:s') . '|' . microtime(); foreach($_SERVER as $key => $value){ $log_this .= "[$key]=$value"; } $log_this .= "<br />\n"; error_log($log_this,3,'log_file.txt'); ?> The log_file.txt will contain all the $_SERVER variables for each request to your page.
-
Any answer to this question -
-
You don't use different tables just because you have a different produce type. It creates a data management nightmare, like you are having with setting up unique product id's.
-
Headers error unique not in the sticked thread
PFMaBiSmAd replied to mike12255's topic in PHP Coding Help
Since you didn't bother to post the code that produces the error and the error message, it would be a little hard for anyone to directly help you. Executing php code doesn't cause a header problem unless that code causes some character(s) to be output to the browser. -
Well, you are ordering by age, which is not a date, and you also didn't post any information about what result you are getting and what your expected result should be.
-
Call to undefined method database::onConnect()
PFMaBiSmAd replied to andrew89898's topic in Third Party Scripts
In the class where the above addClient() method is defined or more likely in the class that it extends, there is not a class method named onConnect(). -
In the code you posted above to protect access to a page, you must put an exit; statement in your code after the header(); statement in order to prevent the remainder of the code on your 'protected' page from being executed while the browser preforms the redirect OR you need to put the remainder of the code on the page inside of an else{} statement that you add to that if(){} statement.
-
Headers error unique not in the sticked thread
PFMaBiSmAd replied to mike12255's topic in PHP Coding Help
No. I don't know how many times this has been stated, but I'll do it again. YOU CANNOT OUTPUT ANY CHARACTERS to the browser before you use a header() statement, a setcookie() statement, or a session_start() statement. If the code that you are referring to is the 8 lines of HTML in your post above, that code is made up of about 200+ characters. -
Umm. The post by inversesoft123 in this thread must have been intended for some other thread, because it has absolutely nothing to do with your problem. You are reusing the same exact names in each set of similar form fields and the last set of fields in the form using those names will be what is submitted. You should use an array for the field names. See this link - http://us3.php.net/manual/en/faq.html.php#faq.html.arrays Once you do this, you can simply use php array functions, such as foreach(), to iterate over the arrays of data from the form.
-
Your tr1_name, tr2_name fields are not working because you misspelled type. You have typee You don't have any form fields named tr1_location and tr2_location, so it will be a little hard to get any values for those two fields. And you should use arrays for your form fields, instead of the sequentially numbered - tr1_..., tr2_... Your code will be much simpler. See this link - http://us3.php.net/manual/en/faq.html.php#faq.html.arrays Once you do this, you can simply use php array functions, such as foreach(), to iterate over the arrays. You won't even need the rowCount value any more.
-
How do you know that only article_id is saved? What method are you using to look at what was stored in the database table?
-
Have you tried putting the form in its own file and the download portion of the code in its own file (which you will need to do anyway as you can only output the headers followed by the file contents) AND then using an onclick event for the Export Excel button that would request the download link and also trigger AJAX to update the form. Javascript on your form page - <script type="text/javascript"> function download() { window.location.href='dl.php'; // Other code to trigger AJAX to read the status from the server and update this form. // The dl.php code is what outputs the headers followed by the file contents and will update the status in a session variable that the AJAX will get and display. } </script> The button - <input name="ExportCarrier" type="button" value="Export Excel" onClick=download();> The above parts do what you expect (less any actual AJAX code.) Searching the Internet for 'onclick download a file' did return a large number of promising looking results.
-
Specifically for your Reply #2 post questions - ^^^ That defines $blog_categoryName as a public variable/property of your Category class. After you create an instance of your class using - $content = new Category;, then you can reference the class variable/property using - $content->blog_categoryName in the scope of your program where $content exists. To set or reference the public $blog_categoryName variable/property from inside your class code, you use $this->blog_categoryName Using just $blog_categoryName inside your class code is creating a local variable that only exists within the class method where it is referenced or set. If you used $blog_categoryName in every one of your class methods - A) Each class method would have its own separate local $blog_categoryName variable, and B) Since local variables in functions and class methods are destroyed when that function/class method ends, it doesn't exist longer then the time it takes for the code in that function/class method to run.
-
LOL, and since the places where you are defining and setting $blog_categoryName aren't written correctly to reference or set the main program's $blog_categoryName variable, your code needs some help. Sorry to be blunt, but if you are writing a major application in php, you cannot just take a block of code and put a function definition definition around it and call it a function. You must define what input data values the function will receive, if any, define what processing and result the function will produce, and what value(s) the function will return, if any. Functions and OOP class methods have their own isolated variable scope so that you can write whatever code and use whatever variables you need inside the function/method to accomplish the stated goal of that function. Also, OOP classes have their own isolated variable/property scope so that you can define and use whatever class variables/properties you need inside of that class to accomplish the stated goal of that class. You need pass data values into the function/method as parameter(s) when you call that function/method or you need to use class variables/properties to supply the data values and you need to either set class variables/properties with the value(s) that your function/method produces or return the value(s) to the code that called the function/method.
-
And if you throw in a GROUP BY WEEK(date) term, the query will actually give you the sum for each week within the range of dates you specify.
-
You can actually do the foreach() directly on the data array - foreach($data['options'] as $value){