Re: [PHP] ADOdb Operator question
That helps, thanks! "Curt Zirzow" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > * Thus wrote Gabe ([EMAIL PROTECTED]): > > If you're using ADOdb, what is the name, purpose, and function of this > > operator? > > > > -> > > > > e.g. $conn->Connect(false, 'scott', 'tiger', $oraname); > > The $conn variable is a adodb object that has methods and > properties associated with it. The -> tells php to access the > property or method of the object. > > > Curt > -- > "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP/MySQL difficulties on WindowsXP
I don't know if this is the root of your problem or not, but I tried running PHP 4.3.5 on my Win2K box and it crashed a lot. I found out that if you have PHP configured to run as a SAPI module there are stability issues with that version (this bug has been reported). I think the CGI install should be good though. I reverted back to version 4.3.4 and don't have any problems yet with the SAPI module. <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello; > > We are having a miserable time with MySQL on a Windows/IIS server with PHP. > Here's the version numbers: > > MySQL 3.23.58-nt > PHP 4.35 > Windows XP (although we previously experienced the same problems w/ Server > 2000), 1gb RAM > > The site is for academics to submit scientific "papers" (data) for their > organization. In addition to submitting data, they can browse and search the > database. > > The problem is that one or more times per day, they whole thing grinds to a > halt. Not sure that the server is completely locking up, but response times > are so slow it might was well be. Restarting MySQL corrects the problem, but > that may be a symptom rather than the disease. At one time we had IIS running > on one server and MySQL on another. In this configuration, the IIS server > would lock up, and reloading MySQL on *that* machine fixed the problem, > according to my administrator. That server was remote, and the admin drove out > to it to observe and noted that there were virtual RAM errors - running out - > which motivated us to move it to the XP box in the office. > > There's really not much complicated going on here. The paper submission engine > is session based, and some data is stuffed into session variables until it can > be validated in later steps, then saved to the database. I've optimized the > queries as much as possible, checked that MySQL connections are being closed > and result resources freed, and php session variables unset and the session > destroyed when appropriate. > > We're stuck, and the client is getting upset. > > Ideas? > > TIA > > Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] http header
Is the following code the best way to redirect someone to a different page using PHP? http://www.yahoo.com";); ?> I looked for a "redirect" function of some kind and didn't come up with anything. Just curious what the consensus is... Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: http header
Brandon Holtsclaw wrote: Thanks for the ideas. The header option will work, I was just curious. or you could try something like : window.location.href='http://www.slashdot.org' and / or window.location.href='http://www.slashdot.org'"; ?> Brandon Holtsclaw [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ADOdb SQL Updates
I'm trying to do a simple update to an access database using the ADOdb library. For some reason I can't get it to work. I can however, get a simple select statment to work just fine. Take a look at my code below as well as the error message. Maybe someone can help me out. As you'll see below there isn't an error generated from the select statement, but I do get one from the Update statment. The error says there are too few parameters, but I'm not sure what else I need. *disclaimer* - my SQL skills are not real strong Any help is much appreciated! CODE * $sql = "SELECT * FROM tblFAQ_Book WHERE autoBookID = 1"; $rs = $db_conn->Execute($sql); $updateSQL = "UPDATE tblFAQ_Book SET tblFAQ_Book.fldTitle = \"one more test\" WHERE (tblFAQ_Book.autoBookID = 1)"; $db_conn->Execute($updateSQL); $db_conn->Close(); ERROR MESSAGE (access): SELECT * FROM tblFAQ_Book WHERE autoBookID = 1 (access): UPDATE tblFAQ_Book SET tblFAQ_Book.fldTitle = "one more test" WHERE (tblFAQ_Book.autoBookID = 1) Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in \adodb\drivers\adodb-odbc.inc.php on line 504 07001: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ADOdb SQL Updates
I double checked the names. Everything looks okay. Another ideas? Curt Zirzow wrote: * Thus wrote Gabe ([EMAIL PROTECTED]): ... (access): UPDATE tblFAQ_Book SET tblFAQ_Book.fldTitle = "one more test" WHERE (tblFAQ_Book.autoBookID = 1) Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in \adodb\drivers\adodb-odbc.inc.php on line 504 07001: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. Recheck the spelling of column names and table names. Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ADOdb SQL Updates
It sort of did. It may have corrected that error, but now I get a new error: Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in d:\adodb\drivers\adodb-odbc.inc.php on line 504 S1000: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. What do you think? Lester Caine wrote: Gabe wrote: I double checked the names. Everything looks okay. Another ideas? Did the ADOdb list answer not work? http://phplens.com/lens/lensforum/msgs.php?id=9285 Single and double quotes can be a problem in SQL. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ADOdb SQL Updates
Here's another version of the SQL statement and I get a different error now. When I copy and paste this exact same SQL statement into an update query in Access it works fine. When I try to use it in my PHP code, I get the following error: SQL Statement: UPDATE tblFAQ_Book SET fldTitle = 'one more test' WHERE (autoBookID= 1); Error Message: Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in d:\adodb\drivers\adodb-odbc.inc.php on line 504 S1000: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. Thanks Curt Zirzow wrote: * Thus wrote Gabe ([EMAIL PROTECTED]): ... (access): UPDATE tblFAQ_Book SET tblFAQ_Book.fldTitle = "one more test" WHERE (tblFAQ_Book.autoBookID = 1) Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in \adodb\drivers\adodb-odbc.inc.php on line 504 07001: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. Recheck the spelling of column names and table names. Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ADOdb SQL Updates
Thanks Dave. It's working now. I searched many different places for an answer and yet for whatever reason, I just didn't check Google. We're all allowed a few brain mishaps, right? :-) Thanks again. David O'Brien wrote: After googling the error message for you, I found about a zillion pages which all basically say the same thing. http://support.microsoft.com/default.aspx?scid=kb;en-us;Q175168 -Dave At 11:01 AM 4/21/2004, Gabe wrote: Here's another version of the SQL statement and I get a different error now. When I copy and paste this exact same SQL statement into an update query in Access it works fine. When I try to use it in my PHP code, I get the following error: SQL Statement: UPDATE tblFAQ_Book SET fldTitle = 'one more test' WHERE (autoBookID= 1); Error Message: Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in d:\adodb\drivers\adodb-odbc.inc.php on line 504 S1000: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query. Thanks Curt Zirzow wrote: * Thus wrote Gabe ([EMAIL PROTECTED]): ... (access): UPDATE tblFAQ_Book SET tblFAQ_Book.fldTitle = "one more test" WHERE (tblFAQ_Book.autoBookID = 1) Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in \adodb\drivers\adodb-odbc.inc.php on line 504 07001: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. Recheck the spelling of column names and table names. Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php David G. O'Brien Web Services Coordinator / Systems Administrator NACCRRA The Nation's Network of Child Care Resource & Referral 1319 F Street NW, Suite 500 Washington, DC 20004 (202) 393-5501 ext. 113 (202) 393-1109 fax -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP modifying data from DB?
I have a field in a DB that contains a date. The format of the date is: 04/08/2004 However, when I retrieve the date from DB using PHP, it displays the following: 2004-04-08 00:00:00 Is PHP tacking on the zero's? I've tried using the date() function to reformat it back to how I want it, but haven't gotten it to work. Any ideas? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP modifying data from DB?
I should also probably mention that I'm using ADOdb as well. Gabe wrote: I have a field in a DB that contains a date. The format of the date is: 04/08/2004 However, when I retrieve the date from DB using PHP, it displays the following: 2004-04-08 00:00:00 Is PHP tacking on the zero's? I've tried using the date() function to reformat it back to how I want it, but haven't gotten it to work. Any ideas? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP modifying data from DB?
Hi Richard, I checked the field type in access and it is a date/time field (it's the only option). However, in access I told it to do a short date format mm/dd/. Unfortunately it still gives me those extra zero's. Let's say that getting those zero's is ok. Is this the code that I would write to form the proper date I want? $dbDate = value from the date field in the database date("m-d-Y", $dbDate); Richard Davey wrote: Hello Gabe, Friday, April 23, 2004, 7:20:14 PM, you wrote: G> However, when I retrieve the date from DB using PHP, it displays the G> following: G> 2004-04-08 00:00:00 G> Is PHP tacking on the zero's? I've tried using the date() function to G> reformat it back to how I want it, but haven't gotten it to work. You are probably using a datetime field in your database, as opposed to a date field - which is where the extra zeros are coming from. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP modifying data from DB?
Here's what I tried and it seems to be working now. Thanks Richard! $var = date("m-d-Y", strtotime($dbDate)); $var then has the value of the date only. Still curious as to why those extra zero's are tacked on. Dare I mention it on this newsgroup, but when I used ASP I only got the date without the extra zero's. Richard Davey wrote: Hello Gabe, Friday, April 23, 2004, 7:33:53 PM, you wrote: G> Let's say that getting those zero's is ok. Is this the code that I G> would write to form the proper date I want? G> $dbDate = value from the date field in the database G> date("m-d-Y", $dbDate); Yeah that should be fine - you could do: date("m-d-Y 00:00:00", $dbDate); But I'm sure Access will add on the extra zeros if you do not specify them - would be worth testing to make sure though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Creating an assoc array from two arrays
Alex Hogan wrote: Hi All, I am looking through the manual and I think I may be blind or something, but how can I create an associative array from two arrays. What I have is two arrays that look like this; Array1([0]=>Spider, [1]=>Monkey, [2]=>Cards) Array2([0]=>26.3, [1]=>0.65, [2]=>62.07) I want to combine them into; ArrayCombined([Spider]=>26.3, [Monkey]=>0.65, [Cards]=>62.07) So I can compare it to a third array. TIA alex ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. ** Well, if you use PHP5 you could use this function: (probably not an option now, but good to know for the future) http://us4.php.net/manual/en/function.array-combine.php Gabe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Scripting practices
When scripting in a language (such as PHP) that doesn't require you to determine the variable type before you use it, is it still considered good technique to initialize it to the type you're going to use it as? Or is it considered ok to just use it? e.g. $strText = "";//initialize $strText = "now i'll give it a useful value"; Or is it just better to skip the first line? Just curious, thanks! Gabe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date Function - Empty Value
Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( "" ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( "" ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date Function - Empty Value
Matt Matijevich wrote: [snip] Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? [/snip] Do you have access to the mdb file? If you do you can just go into design view of the table to find out the data definitions. I do have access to the mdb but there's no way for me to export the structure that I'm looking at so I can send it to other people. Or do you know of a way? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( "" ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? This command should show you the table structure: SHOW CREATE TABLE tablename Please post the output. regards, Torsten Sorry Torsten, but you'll have to forgive my lack of understanding. Where should I put that command in? Thanks for you patience. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( "" ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? This command should show you the table structure: SHOW CREATE TABLE tablename Please post the output. regards, Torsten Sorry Torsten, but you'll have to forgive my lack of understanding. Where should I put that command in? Thanks for you patience. In the mysql command line, if possible or if you're using phpMyAdmin. Should also work with mysql_query() in a php script and echoing out the result. Do you know how to do this? Regards, Torsten I'm using Microsoft Access for my database not MySQL. Does that change what I need to do? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date Function - Empty Value
Mark Pecaut wrote: On Thu, May 20, 2004 at 12:28:00PM -0400, Gabe wrote: I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( "" ) I'm using Microsoft Access for my database not MySQL. Does that change what I need to do? Access delimits dates with '#' hash marks. Try something like: UPDATE tablename SET date_field=#9/30/2003# WHERE foo='bar'; or UPDATE tablename SET date_field=NULL WHERE foo='bar'; if you want to make that field null. If it complains when you try to set it NULL and you want it to be null, put 'No' for 'Required' for that field in Design View. -Mark I'll give those a try. Thanks for the tips. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Function - Empty Value
Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: "Gabe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Environment: PHP 4.3.6 Access DB W2K IIS 5 I'm trying to store a date in a date/time field using the short date format ( m/d/ ). For some reason it won't let me post an empty value to that field in the DB. I've tried using empty quotes ( "" ) or NULL and I always get a datatype mismatch sql error. So then I just tried submitting a date that will never be used ( e.g. 1/1/ ). That works, but then when I try to read the date out of the field in the DB and format it using the date() function in PHP it doesn't display anything (which is fine with me). I read up on the date function on the PHP website and valid dates are limited from 01-01-1970 to 19-01-2038 on windows machines. So that explains why the function returns nothing. So, I guess my question is this: Is what I'm doing technically ok (using a date that's not in the valid range)? Or does anyone know of an empty date value that I can submit to the DB? Thanks! NULL should work if you have allowed it for the column when creating the table. Can you post your table structure? Regards, Torsten Well, I would, but I can't seem to figure out how to export just the structure out of access. Wouldn't NULL be allowed by default? This command should show you the table structure: SHOW CREATE TABLE tablename Please post the output. regards, Torsten Sorry Torsten, but you'll have to forgive my lack of understanding. Where should I put that command in? Thanks for you patience. In the mysql command line, if possible or if you're using phpMyAdmin. Should also work with mysql_query() in a php script and echoing out the result. Do you know how to do this? Regards, Torsten I'm using Microsoft Access for my database not MySQL. Does that change what I need to do? I'm not familiar with Access but should have an option or specific view to show you the table structure. Look at the Access program help for something like that. Regards, Torsten After looking carefully through the table structure, it does allow NULL values. So maybe I'm not passing it correctly to the variables in the SQL. I thought I was -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] script location
Does anyone know of a simple/efficient way to determine the path to a script on the URL? For instance: http://www.nowhere.com/test/whatever/testing.php All I want out of that URL is this: /test/whatever/ I didn't see an element in one of the super global variables that would provide me this information. Any ideas? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] script location
Thanks Matt and James... very helpful! James Harrell wrote: See the parse_url() function. -Original Message- From: Matt Matijevich [mailto:[EMAIL PROTECTED] Sent: Friday, June 04, 2004 9:57 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] script location [snip] http://www.nowhere.com/test/whatever/testing.php All I want out of that URL is this: /test/whatever/ [/snip] http://php.net/dirname I think that will do it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] script location
Knowing the functions is half the battle. :-) David T-G wrote: Gabe -- ...and then Gabe said... % % Does anyone know of a simple/efficient way to determine the path to a % script on the URL? Gee, it sounds like you want the dirname() of the SCRIPT_URL. You're on the right track :-) HTH & HAND :-D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Search Sanitization
I'm writing a *very* simple search form for my db and was interested in hearing some recommendations on what to check for with the user's input for the search. However, I guess more specifically my question is if anyone had any advice as to other things I should check since it's a search form. Obviously there's a lot more valid entries that a user can make than a normal form where you might know more specifically what they should enter and thus your validation can be more stringent. Any advice? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Search Sanitization
Greg Donald wrote: On Wed, 16 Jun 2004 10:34:21 -0400, Gabe <[EMAIL PROTECTED]> wrote: I'm writing a *very* simple search form for my db and was interested in hearing some recommendations on what to check for with the user's input for the search. However, I guess more specifically my question is if anyone had any advice as to other things I should check since it's a search form. Obviously there's a lot more valid entries that a user can make than a normal form where you might know more specifically what they should enter and thus your validation can be more stringent. Well, for starters you should definately check and prevent SQL injection. I use this in all my scripts: set_magic_quotes_runtime(0); if(get_magic_quotes_gpc() == 0){ $_GET = isset($_GET) ? array_map("slashes", $_GET) : array(); $_POST = isset($_POST) ? array_map("slashes", $_POST) : array(); $_COOKIE = isset($_COOKIE) ? array_map("slashes", $_COOKIE) : array(); } function slashes($var){ if(is_array($var)) return array_map("slashes", $var); else return addslashes($var); } Hi Greg, I was looking at your function and I was wondering if you could explain how the slashes function works exactly. It looks like it is recursive, but I don't understand why you would need to do that. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Association Problem?
Wanted to see if anyone had any input on this. I have a recordset that is returned to me in my script. What I then would like to do is go through each row of the recordset and use the substr_count function to count the number of times a string appears in each row. Then I'd like to sort & display the recordset based on how many times the string appeared in each row. Basically this is a very light search with a very quick & dirty way to find relevancy. I've thought that I could just store the relevancy numbers in an array, but then how do I know which relevancy number goes with what row in the recordset? That's the association problem I'm talking about. Also, how would I then sort the recordset accordingly based on the relevancy array? I've been looking through the PHP documentation and can't quite get past this question. Anyone have any ideas? Thanks! Gabe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Association Problem?
Thanks for all the help guys! All of your suggestions got me going in the right direction. I'm using ADOdb, so some of the code below may look a little different than suggested. //stores the RS in an array and creates a sortable array for relevancy while ( !$objRS_Results->EOF ) { $strHaystack = $objRS_Results->fields[1] . $objRS_Results->fields[2]; $intRelevancy = substr_count( $strHaystack, $strCriteria ); $arrRS_Data[$objRS_Results->fields[0]] = array( "title" => $objRS_Results->fields[1], "relevancy" => $intRelevancy ); $arrSort[$objRS_Results->fields[0]] = $intRelevancy; $objRS_Results->moveNext(); } //prints out the search results based on the relevancy array while ( current( $arrSort ) ) { echo $arrRS_Data[key($arrSort)]["title"] . ""; next( $arrSort ); } Thanks again Gabe Gabe wrote: Wanted to see if anyone had any input on this. I have a recordset that is returned to me in my script. What I then would like to do is go through each row of the recordset and use the substr_count function to count the number of times a string appears in each row. Then I'd like to sort & display the recordset based on how many times the string appeared in each row. Basically this is a very light search with a very quick & dirty way to find relevancy. I've thought that I could just store the relevancy numbers in an array, but then how do I know which relevancy number goes with what row in the recordset? That's the association problem I'm talking about. Also, how would I then sort the recordset accordingly based on the relevancy array? I've been looking through the PHP documentation and can't quite get past this question. Anyone have any ideas? Thanks! Gabe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Case sensitivity
I hope I don't get too chastised for a double post ( posted in .db first ), but I'm hoping someone can help me. I'm using PHP with ADOdb ( and an MS Access 2000 db ) to write a simple SQL statement but was running into some case sensitivity issues. Here's my SQL currently: SELECT autoQuesID,fldQuesTitle,fldBody FROM tblFAQ_Question WHERE fldBody LIKE '%$strSearchFor%'; All I'm trying to do is have the users search string searched for in the "fldBody" field. However, I'm having problems trying to get it so that the search is case-insensitive. For instance: If I search on "Airline", I get 1 record. If I search on "airline", I get 0 records. I make the value of $strSearchFor lower case ( using strtolower() ), but I don't know how to get it so that the contents of the "fldBody" field is lower case also. I can't seem to find any functions or operators that remove the case-sensitivity. However, I have tried this where clause to no avail: WHERE LCase(fldBody) LIKE '%$strSearchFor%' Any help would be much appreciated! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] substr_count
Does anyone know of a way to have this function run case insensitive? E.g. $strHaystack = "this iS a tEsT."; $strNeedle = "is"; $intCount = substr_count( $strHaystack, $strNeedle ); Anyway, to get this to return a count of two? The haystack that I'm searching in could be just about anything, so I can't rely on upper case and lower case only ( or even Ucfirst() or Ucwords() ). Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr_count
Matt Matijevich wrote: [snip] Anyway, to get this to return a count of two? [/snip] just strtolower or strtoupper both $strHaystack and $strNeedle I think I've been looking at the same code for so long, I'm missing the blatantly obvious stuff now... I can't believe I didn't think of that. Thanks Matt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] string function that adds before and after
What I'm trying to do is find a substring in a much longer string and insert another string before and after the substring. For example: string to find: weather string to search in: "This is the worst weather ever. Weather around here is terrible." string to add before: string to add after: I can't do a simple search and replace, because I need to maintain the case sensitivity of the word that's in the searched string. So I was hoping to find something that would locate the string to find, add something before and after it (which that something before and after could be different from each other), then continue the search to see if another instance exists. And so on and so forth There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string function that adds before and after
Matt M. wrote: There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long? try this preg_replace('/(weather)/i', "$1", 'This is the worst weather ever. Weather around here is terrible. ') Thanks Matt. I think that will do the trick. Let me see if I understand it correctly. the "i" will make the search case-INsensitive, and the parenthesis around "weather" will store what it finds in the variable $1? Is that right? Thanks again, that was a big help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string function that adds before and after
Philip Olson wrote: There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long? try this preg_replace('/(weather)/i', "$1", 'This is the worst weather ever. Weather around here is terrible. ') Thanks Matt. I think that will do the trick. Let me see if I understand it correctly. the "i" will make the search case-INsensitive, and the parenthesis around "weather" will store what it finds in the variable $1? Is that right? Also consider str_replace() as it's faster albeit case sensitive. str_ireplace() exists in PHP 5. Just another option, I'm surprised you didn't find it when looking around strpos() and friends. Your assumptions above are correct, sorry Matt for stepping in! :) I prefer cold weather. Regards, Philip Thanks Philip. I did notice str_replace() but it didn't look like I could use it without it actually replacing what it found instead of just adding strings before and after it. Am I wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Comparison Operator
I was looking at the comparison operators page and noticed that these two operators were listed as "PHP4 only". Is that an error, or are they really not used in PHP5? I don't want to use them if they're going to break when I upgrade. And if they aren't included, then does something else replace their functionality? Operators in question: === !== Referenced URL: http://www.php.net/manual/en/language.operators.comparison.php Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparison Operator
Michael Sims wrote: Gabe wrote: I was looking at the comparison operators page and noticed that these two operators were listed as "PHP4 only". Is that an error, or are they really not used in PHP5? I don't want to use them if they're going to break when I upgrade. And if they aren't included, then does something else replace their functionality? Operators in question: === !== The "PHP 4 only" means those operators did not exist in PHP version 3. The documentation should probably say "PHP 4 or later only"... That's what I suspected, but just wanted to make sure. Thanks for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Malicious SQL
Can someone help me understand how people are able to use SQL maliciously if you don't protect against it in PHP? For example, I've written a very simple search SQL statement that takes the value of a variable for the search criteria ( from a webpage form ). I don't understand how someone could enter an SQL statement that could be malicious. Here's the SQL statement that I run once I have the search criteria stored in $strCriteria: SELECT autoQuesID, fldQuesTitle, fldBody FROM tblFAQ_Question WHERE (blnHidden = FALSE AND ((fldBody LIKE '%$strCriteria%') OR (fldQuesTitle LIKE '%$strCriteria%'))); I know in general that protecting against someone entering SQL is a must . So I guess I'm just wondering if anyone has any real-world experience with how people can take advantage of SQL and forms. Thanks! Gabe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Malicious SQL
Gabe wrote: Can someone help me understand how people are able to use SQL maliciously if you don't protect against it in PHP? For example, I've written a very simple search SQL statement that takes the value of a variable for the search criteria ( from a webpage form ). I don't understand how someone could enter an SQL statement that could be malicious. Here's the SQL statement that I run once I have the search criteria stored in $strCriteria: SELECT autoQuesID, fldQuesTitle, fldBody FROM tblFAQ_Question WHERE (blnHidden = FALSE AND ((fldBody LIKE '%$strCriteria%') OR (fldQuesTitle LIKE '%$strCriteria%'))); I know in general that protecting against someone entering SQL is a must . So I guess I'm just wondering if anyone has any real-world experience with how people can take advantage of SQL and forms. Thanks! Gabe That was very helpful. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Frameworks - Opinion
What's the common consensus as to a solid PHP framework to use for application development? There seems to be a number of them out there, but I'm not sure which one's are the most robust, actively developed, secure, etc etc. Thoughts? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Frameworks - Opinion
Gabe wrote: What's the common consensus as to a solid PHP framework to use for application development? There seems to be a number of them out there, but I'm not sure which one's are the most robust, actively developed, secure, etc etc. Thoughts? Sounds like it's just personal preference. But thanks for all the posts! Too bad there isn't a skeleton sort-of system that you essentially then just plug in the modules that you want/need to "flesh" it out. Then you'd have your own customized framework for each app that is developed and keeps *all* of the modules relevant to that app. Nothing extra would be included that isn't needed. Then as a developer all you're looking for is modules and not huge frameworks that may include lots of functionality that you don't have any interest in. It would certainly keep any attack surface smaller when it comes to vulnerabilities. Is there anything out there like that? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Frameworks - Opinion
Robert Cummings wrote: On Wed, 2006-08-02 at 10:50 -0400, Gabe wrote: Gabe wrote: What's the common consensus as to a solid PHP framework to use for application development? There seems to be a number of them out there, but I'm not sure which one's are the most robust, actively developed, secure, etc etc. Thoughts? Sounds like it's just personal preference. But thanks for all the posts! Too bad there isn't a skeleton sort-of system that you essentially then just plug in the modules that you want/need to "flesh" it out. Then you'd have your own customized framework for each app that is developed and keeps *all* of the modules relevant to that app. Nothing extra would be included that isn't needed. Then as a developer all you're looking for is modules and not huge frameworks that may include lots of functionality that you don't have any interest in. It would certainly keep any attack surface smaller when it comes to vulnerabilities. Is there anything out there like that? A good framework won't load all of the code out there. It will load the code on an as-needed basis. So that if you only use one piece, that's the only piece loaded (notwithstanding the loading mechanism being loaded also :) Cheers, Rob. True, but I was also talking more about the package of files to install that contains all of the code. For instance, if the Zend Framework contains 8 different modules and all of the php code files to support those 8, and I only need to use 3 of those modules for my specific app, then it would be cool to be able to not have to have all the additional code files that aren't used. I just like to keep things as small and tidy as possible. :) Of course, maybe frameworks do this and I'm just missing something... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Frameworks - Opinion
Paul Scott wrote: Too bad there isn't a skeleton sort-of system that you essentially then just plug in the modules that you want/need to "flesh" it out. Then you'd have your own customized framework for each app that is developed and keeps *all* of the modules relevant to that app. Nothing extra would be included that isn't needed. Then as a developer all you're looking for is modules and not huge frameworks that may include lots of functionality that you don't have any interest in. It would certainly keep any attack surface smaller when it comes to vulnerabilities. Is there anything out there like that? You have just described KINKY/Chisimba... --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm I see that there are a few different Universities in Africa supporting that framework. How active is the developer community? How long has KINKY/Chisimba been around? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Static Member Variables holding objects w/methods
I'm trying to use the following method of a class (DbConnector): public function closeConnector() { // echo "in closeConnector()"; var_dump(DbConnector::$connector); echo ""; //make sure the db object is cleaned up properly if ( gettype(DbConnector::$connector) == 'object' ) { echo "close the ADOdb connection"; DbConnector::$connector->Close(); } //put things back the way they were found $this->connector = false; } DbConnector is meant to be a singleton class that manages an ADOdb object. However, when the code executes and it gets to this line: DbConnector::$connector->Close(); the script fails and says "Call to undefined method DbConnector::Close()" Is trying to call the Close() method of the static member var (which holds an ADOdb object) not possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Static Member Variables holding objects w/methods
Gabe wrote: I'm trying to use the following method of a class (DbConnector): public function closeConnector() { // echo "in closeConnector()"; var_dump(DbConnector::$connector); echo ""; //make sure the db object is cleaned up properly if ( gettype(DbConnector::$connector) == 'object' ) { echo "close the ADOdb connection"; DbConnector::$connector->Close(); } //put things back the way they were found $this->connector = false; } DbConnector is meant to be a singleton class that manages an ADOdb object. However, when the code executes and it gets to this line: DbConnector::$connector->Close(); the script fails and says "Call to undefined method DbConnector::Close()" Is trying to call the Close() method of the static member var (which holds an ADOdb object) not possible? I think I thought of a better way to ask my question. :) Is it possible for a static member to hold an object? If so, is it possible for me to access the members and methods of that object like so: myClass::myStaticVarHoldingTheObject->methodOfTheObject I'm trying to access methods of an object that is stored in a static variable using that line of code. It keeps spitting out an error that says "myClass" does not have a defined method "methodOfTheObject". I hope that's clearer. Sorry about any confusion... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Static Member Variables holding objects w/methods
Richard Lynch wrote: On Wed, August 16, 2006 9:13 am, Gabe wrote: I'm trying to use the following method of a class (DbConnector): public function closeConnector() { // echo "in closeConnector()"; var_dump(DbConnector::$connector); What is $connector ??? Perhaps you want DbConnector::connector echo ""; //make sure the db object is cleaned up properly if ( gettype(DbConnector::$connector) == 'object' ) { echo "close the ADOdb connection"; DbConnector::$connector->Close(); Try it without the $ If that's not it, try: $connector = DbConnector::$connector; $connector->Close(); Sometimes PHP is not so good at -> chasing down a tree... Or, at least, it used to be not so good at that... I suspect that's been fixed for ages, but worth a shot. } //put things back the way they were found $this->connector = false; } DbConnector is meant to be a singleton class that manages an ADOdb object. However, when the code executes and it gets to this line: DbConnector::$connector->Close(); the script fails and says "Call to undefined method DbConnector::Close()" Is trying to call the Close() method of the static member var (which holds an ADOdb object) not possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Actually I found that I should use this notation: self::$connector->Close(); And my class method wasn't static. So I couldn't access the static member. Details, details =) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Programmatic POST
I'm looking to write a function that will receive the contents of a web form, do some data manipulation, then pass on the manipulated data to another URL via POST. Is there a built-in function in PHP that I can use to send the data to another URL via POST without a user having to click submit on a form? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ADOdb installation
For those of you that are using ADOdb, hopefully you can help me out. I'm evaluating PHP on IIS and I was curious if I had to have a directory with the ADOdb scripts for every virtual host? For example, if I had three virtual hosts at three different IP's: 210.210.210.200 210.210.210.201 210.210.210.202 Would each virtual host need to have a directory with the ADOdb scripts? Or would it be possible to setup a virtual directory in each virtual host that points to one folder that has the scripts? It seems a little wasteful and inefficient to have to copy the scripts for each virtual host. Or does someone know of a good way to do this? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie question about operators
Looking at the code below, what exactly is happening with the $name=>$value part? I looked in the PHP online documentation and I can't find that operator. What is it doing exactly and what is it called? foreach ($some_array as $name=>$value) { ... some code ... } Thanks alot! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about operators
Thanks for the page. That was helpful. Just to make sure, is that operator only typically used then with foreach loops and arrays? "Matt Matijevich" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [snip] > foreach ($some_array as $name=>$value) > { > ... some code ... > } > [/snip] > > http://www.php.net/foreach > > will give you a good explanation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie question about operators
Thanks Ligaya "Ligaya Turmelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > it is refering to the associative array, specifically the $key => $value . > Note here (http://www.php.net/manual/en/language.types.array.php). > > Respectfully, > Ligaya Turmelle > > "Gabe" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Looking at the code below, what exactly is happening with the > $name=>$value > > part? I looked in the PHP online documentation and I can't find that > > operator. What is it doing exactly and what is it called? > > > > foreach ($some_array as $name=>$value) > > { > > ... some code ... > > } > > > > Thanks alot! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ADOdb Operator question
If you're using ADOdb, what is the name, purpose, and function of this operator? -> e.g. $conn->Connect(false, 'scott', 'tiger', $oraname); I can follow some tutorials, but I'm just not sure when I need to use it and when I don't. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ADOdb Operator question
I tried the URL you supplied but I didn't see any reference to the operator in question. I hope I'm not blind "Alex Hogan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > If you're using ADOdb, what is the name, purpose, and function of this > > operator? > > > > -> > > > > e.g. $conn->Connect(false, 'scott', 'tiger', $oraname); > > > > I can follow some tutorials, but I'm just not sure when I need to use it > > and > > when I don't. > > This is an explanation that's in the manual. > > $conn->Open("Provider=SQLOLEDB; Data Source=localhost;Initial > Catalog=database; User ID=user; Password=password"); > > http://www.php.net/manual/en/ref.com.php > > > > alex hogan > > > > -Original Message- > > From: Gabe [mailto:[EMAIL PROTECTED] > > Sent: Thursday, April 08, 2004 1:43 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] ADOdb Operator question > > > > If you're using ADOdb, what is the name, purpose, and function of this > > operator? > > > > -> > > > > e.g. $conn->Connect(false, 'scott', 'tiger', $oraname); > > > > I can follow some tutorials, but I'm just not sure when I need to use it > > and > > when I don't. > > > > Thanks > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > ** > The contents of this e-mail and any files transmitted with it are > confidential and intended solely for the use of the individual or > entity to whom it is addressed. The views stated herein do not > necessarily represent the view of the company. If you are not the > intended recipient of this e-mail you may not copy, forward, > disclose, or otherwise use it or any part of it in any form > whatsoever. If you have received this e-mail in error please > e-mail the sender. > ** > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ADOdb Operator question
Yeah, I looked at that page, but didn't see any specifications for it. I guess I'll probably just have to use the tried and true method of "trial and error". Thanks Matt. "Matt Matijevich" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [snip] > e.g. $conn->Connect(false, 'scott', 'tiger', $oraname); > [/snip] > > http://www.php.net/oop will give you some help. > > I am not even sure if I can explain it correctly. > > I believe you would say use -> to call object methods and -> to get/set > the class variables. I am sure someone can give a better explanation > than that, or correct me if I am wrong. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Assigns True but not false?
Thanks guys, very helpful! Gabe wrote: In this if statement, if the condition is true, then it will assign true to the array (as I want it to). If the condition evaluates to false, it assigns nothing. Any idea why it won't assign false? If I switch the FALSE boolean value to the number 0, that will get assigned. Seems kinda strange... $this->m_arrQuesInfo[$this->m_itemID]['blnVacPromo'] = ( ( !empty($_POST['vac_promo']) ) && ( $_POST['vac_promo'] == 'on' ) ) ? TRUE : FALSE; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session cookie authentication
is it possible to write a script that can screen scrape a site that uses session cookies for authentication? the reasoning for this is so that i can add check boxes to a list so i can reset more then one port on my isp router at a time. thanks -- 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]
Re: [PHP] PHP / JavaScript integration
On Wed, Mar 09, 2005 at 12:27:39AM +, M?rio Gamito wrote: > Hi, > > I'm trying to integrate some JavaScript functions in PHP, but so far, no > good :( > > I want to have a js.php file that has the JavaScript functions i want to > use. This file, albeit its extension, has no PHP code or even tag. > > It's just like this: > > js.php > -- > > > function def(word) { > if (word == 'all_not_filled') { > type = 'error1'; > definition = 'You didn't filled all form fields.'; > } > myFloater = > window.open(filename,'myWindow','scrollbars=no,status=no,width=300,height=200') > } > > > -- > > Now... i want to call this JavaScript function from the regular PHP files. > In particular, before the HTML code. > Like this: > > index.php > -- > > > if (condition) > def('all_not_filled') // def is a JS function in js.php > > ?> > > > > > (...) > > > -- > > How can i do this ? > How to tell PHP, that def(word) is a JS function in js.php file ? > I've tried include ('js.php'), etc., but got no results :( why not use a script include instead of a php one? ie:
[PHP] Re: UPDATE problem
> I have created a predictionscompetition and some code counts te total score of > a match of a person. > On the screen it workes, but in de database it goes wrong. Each person gets > the total of the last person. There must be something wrong with the update > statement. > I hope someone can help me. > > Cheers, > Martin. > > $number = MYSQL_NUMROWS($result); > $i = 0; > WHILE ($i < $number): > $naam = mysql_result($result,$i,"naam"); > $uit_gr = mysql_result($result,$i,"uit_gr"); > $uit_te = mysql_result($result,$i,"uit_te"); > $ru_gr = mysql_result($result,$i,"ru_gr"); > $ru_te = mysql_result($result,$i,"ru_te"); > $minuut = mysql_result($result,$i,"minuut"); > $toto = mysql_result($result,$i,"toto"); > > /* Count everything*/ > > $t01 = $u1+$r1+$b1+$m1+$t1; > $sqlb = "UPDATE voorspelling1 SET totaal='$t01' WHERE id_voorspelling = > '$id_voorspelling'"; > $resultb = mysql_query($sqlb); > PRINT "$naam $uit_gr $uit_te $u1 $r1 $b1 $m1 $t1 $t01"; > PRINT "$t1"; > $i++; > ENDWHILE; So $t01 is PRINTed correctly but is incorrect in the database? Check mysql_affected_rows() after the query is run to see if any changes were made to the databse. The only potential problems I see off the top of my head are the single quotes around $t01 and $voorspelling in the query. If either of those are numeric values, then you must omit the single quotes. Hope this helps... -- 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] Re: header function
This is a shot in the dark since I've never even done PHP redirection, but did you try using absolute system pathname (eg. /home/httpd/html/index.php), or absolute web address (eg. http://www.yoursite.com/index.php)? > From: [EMAIL PROTECTED] (Jay Paulson) > Reply-To: "Jay Paulson" <[EMAIL PROTECTED]> > Newsgroups: php.general > Date: Mon, 20 Aug 2001 17:29:15 -0500 > To: <[EMAIL PROTECTED]> > Subject: header function > > Hello everyone- > > I have a slight problem.. I'm running php 4.0.6 on RedHat 7.1 and I run my > script and it hit's: > > header("Location:index.php"); > > well the thing is once it hits that line in my script and just fails, > however i don't get any type of parse error the browser just says 404 error > page not found... could it be i forgot to add something when i configured > and installed php on my machine? > > i'm really losted here cause i can put an echo "blah"; before it or after it > and it will print out just fine.. but comment out that echo and have it hit > the header() line and i get teh 404 page error.. (and yes i've double and > tripled checked that all the files etc are there it's just not doing the > header function for some reason) > > Thanks! > Jay > -- 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] Re: IIS
Microsoft Internet Information Server. > From: [EMAIL PROTECTED] (Nafiseh Saberi) > Newsgroups: php.general > Date: Wed, 22 Aug 2001 19:22:16 +0430 > To: [EMAIL PROTECTED] > Subject: IIS > > > hi. > what is IIS? > > thanks. -- 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] Re: To jump or not to jump?
I generally like to write separate library files containing most of the code, store them outside of the web directory, include the necessary libraries and then just insert function calls where I need them in the html. > From: [EMAIL PROTECTED] (Seb Frost) > Newsgroups: php.general > Date: Tue, 21 Aug 2001 20:10:38 +0100 > To: <[EMAIL PROTECTED]> > Subject: To jump or not to jump? > > Is it good practice (sp?) to jump in and out of php whenever you've got some > plain html to write, or should one write an entire file in php? I'm leaning > towards the latter, unless there's a huge chunk of html code. > > opinions? > > - seb > -- 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] Re: functions and quotes
Well, just off the top of my head, you seem to be mostly storing data. None of the strings you are storing contain any variable values, so they don't need to be double quoted. I would even take it a step further, and move all your HTML data into raw text files, then use the readfile() function to insert them where needed. This would make your program logic clearer and allow easier editing of the data since they would no longer need to have quotes escaped. It would also be faster because it doesn't need to parse through all the data, it simply echoes what you need to the screen. The overhead for printing multiple files is negligible in comparison... especially if you are calling this function from multiple pages... In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Kurth Bemis) wrote: > i'm working on a site that is going to require some fancy image switching > based on URL called...thats part isn't a problem...the problem comes in the > way that i'm passing the HTML from the function. > > My main concern here is speed with the second being workload on the server. > > right now the function looks like this. > > function tab($section){ > > $hmenav = " onMouseOver=\"MM_swapImage('document.Nav2','document.Nav2','/images/nav/home_h > i.gif','#931914015883')\"> src=\"/images/nav/home_off.gif\" width=\"62\" height=\"16\" border=\"0\" > name=\"Nav2\" alt=\"\">"; > > $comnav = " onMouseOut=\"MM_swapImgRestore()\" > onMouseOver=\"MM_swapImage('document.Nav3','document.Nav3','/images/nav/com_hi > .gif','#931914051666')\"> src=\"/images/nav/com_off.gif\" width=\"79\" height=\"16\" border=\"0\" > name=\"Nav3\" alt=\"\">"; > > $curnav = " onMouseOver=\"MM_swapImage('document.Nav4','document.Nav4','/images/nav/cur_hi > .gif','#931914075550')\"> src=\"/images/nav/cur_off.gif\" width=\"113\" height=\"16\" border=\"0\" > name=\"Nav4\" alt=\"\">"; > > $llsnav = " onMouseOver=\"MM_swapImage('document.Nav5','document.Nav5','/images/nav/lls_hi > .gif','#931914098883')\"> src=\"/images/nav/lls_off.gif\" width=\"168\" height=\"16\" border=\"0\" > name=\"Nav5\" alt=\"land mark land services\">"; > > $navspc = " height=\"10\" border=\"0\" alt=\"\">"; > > if ($section == "root"){ > $hmenav = " width=\"62\" height=\"16\" border=\"0\" name=\"Nav2\" alt=\"\">"; > }elseif ($section == "company"){ > $comnav = " src=\"/images/nav/com_on.gif\" width=\"79\" height=\"16\" border=\"0\" > name=\"Nav3\" alt=\"\">"; > } > print "$navspc$hmenav$comnav$curnav$llsnav"; > } > > section is passed to the function and the function returns the correct > tab. IS there a better and faster way? > > ~kurth > -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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] Re: Newsgroup?
Yup, connect your news client to news.php.net. In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Christopher Raymond) wrote: > Is this PHP listserve available as a newsgroup? I'm getting tired of > managing this much mail everyday. I'd like it a bit simpler. > > If this list is not available, are there other equally busy newsgroups for > PHP? > > > Thanks, > > Christopher Raymond > -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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] Re: how to disable the automated "userID/password" in Internet Explor er
Just look through the preferences, disable forms auto-complete. That should take care of it for forms, I don't know about dialog boxes. In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Zhu George-Czz010) wrote: > Hi, all. > >Sorry, I know there is out of the topic, but you are highly possible to >help on this. > My browser --Internet Exporer will remember my userID and password, and the > next time, after I type the first char of my user ID, it will automatically > fill in the userID and password. Is there a way to disablt it? > > Thanks. -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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] Re: Please Help - getting a hightlight depending on selected page
Is the menu part of each page? Or is it a separate file/script that gets included in each page? Or is the navigation in a separate frame? If the menu is hard-coded into each page, then there's no reason to use PHP, because you have to modify each page ANYWAY, so you might as well just set each page to what it needs to be. The only way you are going to be able to accomplish this with significantly less work than that is if you store your image URLs and menu links in a database. In that case as you printed out the links, you would check each one to see if $PHP_SELF was equal to the link. Ultimately there are so many ways that you could be doing this that there is no simple answer. Post your menu code, and tell us how it gets included in your page and then we can help... In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Martin Hughes) wrote: > Hi can anyone help me please!? > > I have a page that has a navigation table on the left with various links: > > Information > Software > Cars > Dishwashers > Paper > Contact > etc... > > (not the real links ;)) > > and I want the cell of the section I am in to be highlighted (ie if I am in > "Cars" I want the "Cars" link to have a red background). I have set it up so > that in CSS the id "sel" is a red b/g. > > How do I set the id of a certain cell to "sel" taking it from the url > (index.php?menu=cars as a very bad example of php coding :)). > > Cheers > > Martin > > -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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] Re: Please Help - getting a hightlight depending on selected page
Okay, well you could either put code like this into each td cell like this: > That is kind of ugly, however. A more elegant solution would be to make an array containing the links then do a loop kind of like this (I'm just typing the code off the top of my head, so there is likely to be some errors): $menuItems = array('Home', 'Introduction', 'Changes & Cuts', 'Scores', 'Orchestra', 'Synthesizers', 'Sound System', 'Articles'); $i = 0; foreach ($menuItems as $item) { if($sect == $i) { print "$item\n"; } else { print "$item\n"; } $i++; } The obvious problem with my solution is the links will also presumably have to be entered into an array, and I don't think the foreach construct can work on two arrays simultaneously, but you can use the $i variable as the index to your second array. In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Martin Hughes) wrote: > OK here's the code in the page: > > > > > > > Welcome > > Home > Introduction > Changes & Cuts > Scores > Orchestra > Synthesizers > Sound System > Articles > 21st Century Les > Misérables > Information > Discussion Forums > > > > > > > I am using this 1 page as the php 'template' with content added depending on > the url. For example, to go to the synthesizers page the url is: > index.php?sect=5&id=0&page=31 > > where sect=5 is the part that sets the menu highlight (the menu is alway the > same, hard-coded into the page - all I want to do is change the css id="sel" > from Home to Synthesizers. > > Cheers > > Martin > > -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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] Getting MySQL Query Times.
I was looking thru the mysql functions, and there doesn't seem to be one that gives you the amount of time a query takes. Is there anyway to get this information (since it gives it to you when you type queries directly into the mysql shell client)? A script of mine is starting to get fairly slow (2-3 seconds for page to process) and I want to be able to log the query speeds so I can see if there's a database bottleneck or if my code is just kludgy. -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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] Re: mail function
There are not a lot of guarantees. A big part of the problem is that you can't get instant feedback. Your mail server may queue the message and not even send it right away, or it could get sent, and your mail server doesn't find out for several minutes while the message goes out on the 'net and eventually bounces because the address is bad. There is probably a way you can get your mail server to inform you when a message fails to get delivered, but beyond that you probably can't do much. In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Richard Baskett) wrote: > I am trying to get the mail function to return anything that tells me that > it was sent successfully or at least there were no errors, but assigning a > variable to equal the mail function does not seem to return anything... On > php's site it says it should return true. Am I going about this wrong? > > Quite confused! :) > > Rick > -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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]
Re: [PHP] Getting MySQL Query Times.
Thank you Andrey & Nathan. THat was probably going to be the next thing to research. I think I figured out why my code got slow though. I have a preg search of a large field with .* in it at the beginning of an if,elseif,elseif,elseif struct that I should move to the end of it. In article <007601c12bf4$e0b41f40$[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Nathan Cook) wrote: > IMO, you are better off printing microtime > [http://www.php.net/manual/en/function.microtime.php] before and after the > query, and after you loop through it. This will give you a better idea of > where > the hangups may be. You may also want to sprinkle mircotimes throughout your > code to get a good idea of processing time. In article <047c01c12bf3$bdae2b40$0b01a8c0@ANDreY>, [EMAIL PROTECTED] (Andrey Hristov) wrote: > Use microtime before and after the query. -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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]
Re: [PHP] The future of PHP
Let's not forget the ecosystem in which these different technologies thrive. It's all based on who's paying whom to do what. The reality of the situation is that the people in charge don't know (or care) about all these different technologies. They may make some broad decisions (linux vs win), but you can bet they often rely on individual techies to help guide them to the solution they need. As technology advances, you can bet the divide between management and development will only widen. All that matters now is the end result. With the disparity in developer skill, the difficulty in estimating development time accurately, and the increase in processing power there's a lot of room for developers to make their own decisions. In this kind of environment, there is a lot of room for different programming languages. PHP has the benefits of lightning fast development cycles. Java has the advantage of being a strict, modern, fault-tolerant language that lends itself to well-written code. ASP has advantage of MS 'programming for dummies'-style devlopment tools. Perl has the advantage of its text processing abilities. C has the speed advantage by staying barebones and relatively low level for a verbose language. In order for one of these technologies to die, something has to come along with all the advantages and no new disadvantages. Somehow I don't see this happening to open-source projects like PHP, or MySQL. It's much easier to improve them then to develop something better. I see it much more likely that these projects could fork to encompass different goals. In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Dave) wrote: > >He would see JSP at 19.9% and PHP at 11.2 and say that proves his point. > > And flash developers will claim that the only way to create a site is have > the > whole thing Flash and crap flying across the client screen all the time... > Untill the modem access market drops below 50% of the users on the net... > hard > time convincing me that 100's of kb in Flash is worth it. > > He obviously is sold on JSP... let him sink with his ship. PHP isn't going > anywhere anytime soon... not while *nix boxes are still the most stable > performers for web. -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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] Re: code check
Perhaps you could put it on a webpage and ask a Mac user to see if it works. BTW, there is no reason to use preg_match for that. Instead use strpos(), it is MUCH faster. In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Tom Malone) wrote: > Sorry to bother you all with this, but I have no way to test this, as I have > no access to a Mac. Could you tell me if this little piece of code looks as > if it would work (detect whether someone's using the Mac OS)? > > if (preg_match("/mac/i", "$HTTP_USER_AGENT") || preg_match("/macintosh/i", > "$HTTP_USER_AGENT") || preg_match("/ppc/i", "$HTTP_USER_AGENT") || > preg_match("/PowerPC/i", "$HTTP_USER_AGENT")): > $basefont = "Geneva"; > else: > $basefont = "Verdana, Helvetica, Serif"; > endif; > > It doesn't return an error, but that doesn't mean it works. I really > appreciate your help. TIA > > Tom Malone > Web Designer > http://www.tom-malone.com > -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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] Re: [PHP-DB] restoring mysql db after mysqldump
I know nothing about this, but did you investigate 'SHOW TABLE STATUS' for any clues? In article <018601c12b3c$2c2970b0$6e00a8c0@webdesign>, [EMAIL PROTECTED] (Jay Paulson) wrote: > I've checked and the ROOT user has access to everything... but still no > luck.. when i run the mysql -u root -p < 'all_databases.sql' it gets to the > first table and tries to insert some information into it and says "blah > table is read only" and it stops... > > jay -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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] Re: MySQL read only?
This would probably be a better question for a MySQL newsgroup... Anyway, I am just talking off the top of myhead since I never did anything like this, but i don't think copying DB files is the proper way to move databases. I believe there is some MySQL dump utility you need to create one transferable file that you can then import on the other machine. In article <00da01c12b1d$6fefb170$6e00a8c0@webdesign>, [EMAIL PROTECTED] (Jay Paulson) wrote: > Anyone know why a MySQL table is set to read only? I'm logged in as the > root user of MySQL and I have checked the privalages of the root user in the > MySQL table and everything is set to "Yes" and I'm able to add and delete > users in the MySQL table. > > Here's what I did... I had a database on my Win2k machine and I just ftp'ed > those files over to MySQL running on RedHat. I noticed that the permissions > of the files on the RedHat box were different than the MySQL database so I > changed the permissions on those files I ftp'ed over. But to no evail it > still doesn't work correctly. > > Would it make a difference if I was using a earlier version of MySQL on my > Win2k machine than on the RedHat machine? > > Anyway, I'm at a total lost here so any help would be great! > > Thanks, > Jay > -- __ Gabe da Silveira, Web Designer Twin Cities Student Unions University of Minnesota http://www.coffman.umn.edu wFone: (612)624-7270 eMail: [EMAIL PROTECTED] hPage: http://www.visi.com/~jiblet -- 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]