RE: [PHP-DB] No Caching (Reloading Fresh Content)
How can I ensure that a specific page is never cached and ALWAYS gets processed every time it is viewed? Sometimes a viewer can hit his/her browser's Back button (such a hateful button), and get a cached version of a dynamic page. I want this page's PHP code to be executed even if the visitor uses their Back button to get to the page. Any thoughts on how to do this? Check out the discussion on the following page: http://www.web-caching.com/forums/Forum1/HTML/000133.html Chris
RE: [PHP-DB] inserting array into mySQL
I have an array coming from a form that I need to insert into mySQL. example: name[], phone[], address[] Use serialize() on the variable before inserting into the table and then unserialize() after retrieving the data from the table. Read up on both of the above functions for more information. Chris
RE: [PHP-DB] Individual Lines of text
I need to know if it is possible with PHP to write a script that will pull the individual lines of this text file and store them into a mysql database line by line. use file() and then loop through the array. Chris
RE: [PHP-DB] Valid resource
I'm getting the following error and have no idea what the hell it means: ** the mentioned lines are: ** fputs ( $file, /channel\n); fputs ( $file, /rss\n); fclose( $file ); ** The file did not get opened properly. Do some error checking to try to find out why. Chris
RE: [PHP-DB] WHERE field = str
I am trying to find a str within a field using a select statement like SELECT * FROM tablename WHERE fieldname has the string within it Is there a way to do this? WHERE fieldname LIKE %$string% Chris
RE: [PHP-DB] WHERE field = str
I searched everything I could think of. Where should I have found this is the manual? Nowhere in the PHP manual, I think. But you could find info on this in the MySQL manual (or any other db server's documentation...) Chris
RE: [PHP-DB] Unexplained MySQL Error..
UPDATE WLPbib, WLPpublisher,WLPprofile,WLPbib2profile I think you can only update one table at a time... I could be wrong, though... Chris
RE: [PHP-DB] Unexplained MySQL Error..
Chris: The MySQL documentation would make you think so... I don't think so UPDATE [LOW_PRIORITY] [IGNORE] tbl_name Note there isn't a tbl_name [, tbl_name2, ...]. It's just tbl_name... Right... that means just *one* table. Your query is updating 4 tables. Chris
RE: [PHP-DB] Use of Like
Can anyone tell me a way to simulate the command LIKE in mySQL query´s, Simulate it where? In a SQL database? Another kind of database? Programatically? Chris
RE: [PHP-DB] Header() order
Do you know the header() order? For example: header("Set-Cookie") should come before/after header("Location")? Cause IE seems to be sensitive about this. Cookies need to come first. Chris
RE: [PHP-DB] Hold that insert!
Click Here! "), so in that case I display the form. If it does not have an empty value, the user has clicked the submit button, so I can go ahead processing the form data. Like this: if ( empty($submit) ) { ### Display the form } else { ### Do some checks to make the the data is OK ### Do the Insert, or whatever else is to be done } I do something similar. However, my layout is like this: -- if( isset( $submit )) { errorChecking(); if( $noErrors ) { doDBInsert(); header( "location: blah" ); exit(); } // end if( $noErrors ) showErrors(); } // end if( isset( $submit )) displayForm(); -- This accomplishes a few things: * The code is easier to follow * If there is an error in the form, the errors display and the form re-displays. There is only one section of code that deals with the form, not two as there would be in an IF/ELSE situation. But then, this is just me. :) Chris
RE: [PHP-DB] Hold that insert!
I like your simplicity and straightforwardness. Thanks. ;p My code tends toward: switch($submit) { case: "Accept": .. insert record break; case: "Delete": .. delete record break; case "Cancel": .. cancel record changes and return to previous condition break; } If there is the possiblity of processing different functions, I do this: -- if( isset( $submit )) { errorChecking(); if( $noErrors ) { switch( $function ) { case "insert": doDBInsert(); $resultPage = "here"; break; case "modify": doDBModify(); $resultPage = "there"; break; case "delete": doDBDelete(); $resultPage = "over"; break; } header( "location: $resultPage" ); exit(); } // end if( $noErrors ) showErrors(); } // end if( isset( $submit )) displayForm(); -- Just as before, but doing different things depending on function. That way, the code is still only run when the form submits. And still, if there are any errors, the same code is run to (re)display the form. And since all the POST vars are passed through, the form elements poplulate them selves with the data that the user previously entered so the user loses nothing. I rarely display results on the same page. This allows me to keep it a little more modular and if I ever need to modify one, I don't have to worry about touching the other. Just out of principle, I like to keep as few ELSEs on a page as possible. Generally, if you look at the code, you can streamline things alot just by getting rid of some of the ELSE statements.