[PHP] Stripping Single Quotes
Hi, I have a string, "'abc'". How do I convert it to "abc" (i.e. how do I strip the embedded single quotes) with a minimum of overhead? (In case you'r wondering: I created the quoted string to store it in MySQL, now I want to display the same string in a Webpage. Usually the strings I display do not have embedded single quotes, and I add the single quotes when I output the string printf("", $value); That works well enough for strings that don't already have embedded quotes. But when they do I want to get rid of them quickly and easily, otherwise I get ...value = ''some value''> and Netscape doesn't display the value embedded in two single quote characters). TIA, Elan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Custom Session Func?
Hi, Problem: I register a session variable and assign a value to it. The value is lost when I try to access it from a different webpage later. Must I use custom session_save_handler functions if I want to extend the life of a variable's value from Webpage to Webpage? Details: I'm using PHP's session management (PHP 4.0.3pl1). session.save_handler is set by default to files. According to the manual track_vars is always enabled for this version of PHP. I use the following code to manage my session. It is contained in a include file that is shared by all PHP pages: session_save_path("/usr/some/path/html/sessions/"); session_start(); $registered_user_key = false; if ( ! session_is_registered("user_key") ) { session_register("user_key"); $HTTP_SESSION_VARS["user_key"] = "dummy"; $registered_user_key = true; } function log_user_key($user_key = false) { global $HTTP_SESSION_VARS, $set_user_key, $get_user_key; $HTTP_SESSION_VARS["user_key"] = $user_key; $set_user_key = $user_key; $get_user_key = get_session_key("user_key"); } function log_session() { } function get_session_key($key_name) { global $HTTP_SESSION_VARS; return($HTTP_SESSION_VARS[$key_name]); } I submit a Webpage that includes a value for "user_key". A session file is created in the subdirectory sessions. This file's filename coincides with the reported cookie session id. The function log_user_key(...) is called with a legal value in response to my user input. In response to the user's input I generate webpage that reports the value that was saved. I report this value using the function log_user_key(). I submit another Webpage. This Webpage reports: a) The registration of the variable "user_key" was apparently preserved. How I know that? Because $registered_user_key is set to false, which means that the body of the if (! sesson_is_registerd ...) {} wasn't visited. b) I report the result of session_is_registered and it report 1 (i.e. true). c) get_session_key("user_key") does not return the value I previously assigned to "user_key" using the log_user_key function. I checked the session file in the sessions/ subdirectory. It is empty. Doesn't PHP's session manager keep its info in there? If it does, why wasn't it written to the file? Doesn't the default files session_save_handler take care of that? Or must I supply a custom handler set to ensure that the values are saved? TIA, Elan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Accessing Intberase database in NT
Hello, Any idea how can i possibly access an Interbase database residing in NT4 from my web server running in Linux? Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]