[PHP-DB] Re: Help with SQLite and ADOdb
---davd wrote--- To: [EMAIL PROTECTED] Date: Sat, 21 Feb 2004 09:08:17 -0500 From: [EMAIL PROTECTED] Subject: Help with SQLite and ADOdb I'm working on a website whose hosting package doesn't include any db (except maybe gdbm). I've install sqlite in the home directory. The question is what adjustment do I have to make to my PHP script and ADOdb in order for it to exicute SQLite in from the account home direcory? TIA, Davd ---davd finished--- Hi Davd, Not sure if you'll get this since : From: [EMAIL PROTECTED] hmmm??? Anyways... Who's hosting for you? Paid or free? There is only certain privlidges you can use if your a user on a server so installing SQLite may require administrators approval to set it up, could be wrong here depending on your server privlidges. Many hosts there days offer mysql and PHP on default. I could point you in the write direction if your willing to pay around $5 - $10 a month on hosting. Which is quite reasonable for the kind of service you get and services (more importantly). If you want to know more please let me know or point your web browser to http://www.tassiedemononline.org.au Jerry Find local movie times and trailers on Yahoo! Movies. http://au.movies.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Q
Dear friends, How do I enable the same.Comments, please You don't have permission to access /$_SERVER[PHP_SELF]/ on this server.
[PHP-DB] Connect to MSDE using PHP
I've downlownded and installed the Desktop Edition of MSSQL and am trying to connect to it with PHP. Has anyone ever accomplished this? I've uncommented the line in php.ini to load the MSSQL functions and they show up on a phpinfo() page, so that part is good. When I installed MSDE I tried it without a named instance first and just set an SA password. Neither of these worked: mssql_connect('localhost','sa','password') mssql_connect('coconut','sa','password') where coconut is the name of my computer. Then I tried installing MSDE again with a named instance and tried mssql_connect('namedinstance\localhost','sa','password') mssql_connect('namedinstance\coconut','sa','password') and those wouldn't work either. The only response I get is failed to connect to server ... I'm off to try ODBC. Anyone have any suggestions? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Q
Dear friends, I have pap4, mysql, apache installed. How do I enable to access /$_SERVER[PHP_SELF]/ .Comments, please I getting folloing error You don't have permission to access /$_SERVER[PHP_SELF]/ on this server.
Re: [PHP-DB] Q
On Sun, 22 Feb 2004 11:02:29 EST, [EMAIL PROTECTED] wrote: Dear friends, I have pap4, mysql, apache installed. How do I enable to access /$_SERVER[PHP_SELF]/ .Comments, please Correct your syntax errors: \$_SERVER['PHP_SELF']\ Doug -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MS SQL 'Changed database context' error
Hi Michael Can I see the script you are using that causes the problem? When I change the database context using the mssql extension under PERA it is not a problem. The PEAR DB drivers suppress all messages generated by their underlying extensions. The mssql DB driver will only stop if the mssql ext function it calls fails. Since changing the database context should not cause a function to fail, I am not exactly sure why your script is stopping. -- bob On Sat, 21 Feb 2004, Michael Flanagan wrote: Thanks, Frank. Since I'm getting script stoppage as a result of this error (message), does that suggest that PEAR is mishandling the error/message? (I think PEAR loads and uses the standard mssql extension, but I'm not sure. Even if it does, I don't know if it inserts itself into the error handling stream.) You say that if a message has a severity higher than the setting in php.ini (mine is set to 10), then it will stop the script. Since the message I'm concerned with is a 0, then it should not stop the script. But, my script is stopping as a result of that message. So, is this a PEAR problem? If not, what am I doing wrong? If so, how can I get around this? Thanks! Michael -Original Message- From: Frank M. Kromann [mailto:[EMAIL PROTECTED] Sent: Saturday, February 21, 2004 7:40 PM To: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error The MSSQL standard mssql extension handles the 'Changed database context' message correct. Each query send to the SQL server results in some form of message returned. This can be either an error message or an information message. The MSSQL extension uses two ini settings to tell PHP how to handle these messages. If a message from the server has a severity equal to or higher than the setting in php.ini, PHP will create a warning or an error (stop processing the script). The default setting for both parameters is 10, and that should give a smooth execution of most PHP scripts. For debugging you might want to lover these values. (And this is not what I said in an earlier post but I was wrong then. This time I checked it :-)) 'Changed database context' has a severity = 0. This will only be handled by PHP if mssql.min_message_severity = 0. The mssql_get_last_message() function will always return the last message from the server. This function should not be used to check for errors. The function is intended to give the programmer a tool to fetch the message if an error is detected. - Frank Hi Robert, I've seen your name on a few of the ODBTP posts. You're one of the developers of same, yes? Are you familiar with the 'Changed database context' message? Do you know for sure that ODBTP handles that correctly? Thanks. Michael -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 5:38 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Hi Michael You might get better results using the odbtp extension with support for the mssql functions. Since you are using Windows, use php_odbtp_mssql.dll instead of php_mssql.dll. -- bob On Thu, 19 Feb 2004, Michael Flanagan wrote: Adam, Thanks for the suggestions. I don't want to ignore all error handling. Later, I might get an error that I really don't want php to swallow due to either of your suggestions. Has anyone else run into this and solved it? Any idea why the following lines in the php.ini file don't work? mssql.min_error_severity = 11 mssql.min_message_severity = 11 Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:44 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Try putting the error suppressor (@) before the query, eg: @mssql_query Or, try setting the error reporting: error_reporting(0); On Thu, 2004-02-19 at 14:38, Michael Flanagan wrote: Thanks, Adam. I don't get the error in Enterprise manager. MS has a KB article out that says that this message is informational. I seem to remember that the article also says the message comes out some times, and not other times, but that you should just forget it. The particular SELECT statement I'm getting the message on is the second query in my script. The other query is to the same db; in fact, it uses the exact same $db connection object. Any ideas on getting PHP to ignore this info message? Thanks again. Michael -Original Message- From: Adam Voigt [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 12:13 PM To: Michael Flanagan Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MS SQL 'Changed database context' error
Re: [PHP-DB] Connect to MSDE using PHP
Hi John I have never used MSDE, but from my understanding if is suppose to behave like SQL Server. When you installed it, did it mention anything about whether or not TCP/IP connectivity should be supported? You may need to ensure that the server is communicating over port 1433. If you are unsuccessful with either mssql or odbc, then you should try the odbtp extension at http://odbtp.sourceforge.net. If you use odbtp, use (local) for the SERVER parameter. -- bob On Sun, 22 Feb 2004, John W. Holmes wrote: I've downlownded and installed the Desktop Edition of MSSQL and am trying to connect to it with PHP. Has anyone ever accomplished this? I've uncommented the line in php.ini to load the MSSQL functions and they show up on a phpinfo() page, so that part is good. When I installed MSDE I tried it without a named instance first and just set an SA password. Neither of these worked: mssql_connect('localhost','sa','password') mssql_connect('coconut','sa','password') where coconut is the name of my computer. Then I tried installing MSDE again with a named instance and tried mssql_connect('namedinstance\localhost','sa','password') mssql_connect('namedinstance\coconut','sa','password') and those wouldn't work either. The only response I get is failed to connect to server ... I'm off to try ODBC. Anyone have any suggestions? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MS SQL 'Changed database context' error
Robert, Believe it or not, it's a simple SELECT statement! (I'm not even aware that I'm changing context, nor exactly what that means. I thought that if I used the same $db resource, things would be fine.) Other SELECTs work, but not this particular one! Here's the script (the FindInDb function below has, of course, been called from a prior script): /** * Find the record in the db that matches the Encounter info. * * If $updateObject is TRUE, then we update the object's fields with * values from the matching record in the database record. */ function FindInDb($db, $updateObject, $errStr) { global $DbOwner;// null string () for MS Sql Server if (!IsSet($this-_deviceId) || !(IsSet($this-_timeStart))) { $errStr .= Encounter::FindInDb: either _deviceId or _timeStart is NULL.; return FALSE; } $sql = SELECT * from {$DbOwner}Encounter . WHERE (Device_key = $this-_deviceId) AND . (Time_start = . ToDate($this-_timeStart, -MM-DD HH24:MI:SS) . ); if (!UseOrOpenDb($db, $closeDb, $errStr)) return FALSE; $result = GetInfoFromDbHelper($db, $sql, $errStr); and so on. The routine UseOrOpenDb looks at $db to see if it's a valid $db connection. If not, it opens a new one. I've determined that FindInDb is always passed a valid $db, so UseOrOpen doesn't open a fresh one. /** * Determine whether a db resource is already open; open one if not * * In many places we pass a $db resource to a routine. That resource might * not be open, in which case the called routine should open the db. */ function UseOrOpenDb($db, $dbOpened, $errorString) { if (!$db) { if (!($db = GetDbConnection ($errorString))) { return FALSE; } $dbOpened = TRUE; } else { $dbOpened = FALSE; } return TRUE; } GetInfoFromDbHelper simply executes the SQL string: function GetInfoFromDbHelper ($db, $select, $errorString) { // Get info, based on the $select query $result = $db-query($select); if (DB::isError($result)) { $errorString .= $result-getMessage() . $result-getDebugInfo (); return FALSE; } return $result; } -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Sunday, February 22, 2004 2:49 PM To: Michael Flanagan Cc: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Hi Michael Can I see the script you are using that causes the problem? When I change the database context using the mssql extension under PERA it is not a problem. The PEAR DB drivers suppress all messages generated by their underlying extensions. The mssql DB driver will only stop if the mssql ext function it calls fails. Since changing the database context should not cause a function to fail, I am not exactly sure why your script is stopping. -- bob On Sat, 21 Feb 2004, Michael Flanagan wrote: Thanks, Frank. Since I'm getting script stoppage as a result of this error (message), does that suggest that PEAR is mishandling the error/message? (I think PEAR loads and uses the standard mssql extension, but I'm not sure. Even if it does, I don't know if it inserts itself into the error handling stream.) You say that if a message has a severity higher than the setting in php.ini (mine is set to 10), then it will stop the script. Since the message I'm concerned with is a 0, then it should not stop the script. But, my script is stopping as a result of that message. So, is this a PEAR problem? If not, what am I doing wrong? If so, how can I get around this? Thanks! Michael -Original Message- From: Frank M. Kromann [mailto:[EMAIL PROTECTED] Sent: Saturday, February 21, 2004 7:40 PM To: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error The MSSQL standard mssql extension handles the 'Changed database context' message correct. Each query send to the SQL server results in some form of message returned. This can be either an error message or an information message. The MSSQL extension uses two ini settings to tell PHP how to handle these messages. If a message from the server has a severity equal to or higher than the setting in php.ini, PHP will create a warning or an error (stop processing the script). The default setting for both parameters is 10, and that should give a smooth execution of most PHP scripts. For debugging you might want to lover these values. (And this is not what I said in an earlier post but I was wrong then. This time I checked it :-)) 'Changed database context' has a severity = 0. This will only be handled by PHP if mssql.min_message_severity = 0. The mssql_get_last_message() function will always return the last message from the server. This function should not be used to check for errors. The function is intended to give the
Re: [PHP-DB] Connect to MSDE using PHP
Robert Twitty wrote: I have never used MSDE, but from my understanding if is suppose to behave like SQL Server. When you installed it, did it mention anything about whether or not TCP/IP connectivity should be supported? You may need to ensure that the server is communicating over port 1433. If you are unsuccessful with either mssql or odbc, then you should try the odbtp extension at http://odbtp.sourceforge.net. If you use odbtp, use (local) for the SERVER parameter. I was able to get it to work through ODBC both using the ODBC functions in PHP and through ADOdb, so I guess I'll have to settle for that. I just want an MSSQL test environment (for free) that I can use to develop scripts on. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals . www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MS SQL 'Changed database context' error
Hi Michael Prior to executing a query with the PEAR mssql DB driver, the driver will always call mssql_select_db(). The db that was specified in the DSN is the one that is selected. If the db is changed after connecing via a query, i.e., use AnotherDB, this will cause a problem if the context is changed back to the original DB. Are you changing the DB after connecting? -- bob On Sun, 22 Feb 2004, Michael Flanagan wrote: Robert, Believe it or not, it's a simple SELECT statement! (I'm not even aware that I'm changing context, nor exactly what that means. I thought that if I used the same $db resource, things would be fine.) Other SELECTs work, but not this particular one! Here's the script (the FindInDb function below has, of course, been called from a prior script): /** * Find the record in the db that matches the Encounter info. * * If $updateObject is TRUE, then we update the object's fields with * values from the matching record in the database record. */ function FindInDb($db, $updateObject, $errStr) { global $DbOwner; // null string () for MS Sql Server if (!IsSet($this-_deviceId) || !(IsSet($this-_timeStart))) { $errStr .= Encounter::FindInDb: either _deviceId or _timeStart is NULL.; return FALSE; } $sql = SELECT * from {$DbOwner}Encounter . WHERE (Device_key = $this-_deviceId) AND . (Time_start = . ToDate($this-_timeStart, -MM-DD HH24:MI:SS) . ); if (!UseOrOpenDb($db, $closeDb, $errStr)) return FALSE; $result = GetInfoFromDbHelper($db, $sql, $errStr); and so on. The routine UseOrOpenDb looks at $db to see if it's a valid $db connection. If not, it opens a new one. I've determined that FindInDb is always passed a valid $db, so UseOrOpen doesn't open a fresh one. /** * Determine whether a db resource is already open; open one if not * * In many places we pass a $db resource to a routine. That resource might * not be open, in which case the called routine should open the db. */ function UseOrOpenDb($db, $dbOpened, $errorString) { if (!$db) { if (!($db = GetDbConnection ($errorString))) { return FALSE; } $dbOpened = TRUE; } else { $dbOpened = FALSE; } return TRUE; } GetInfoFromDbHelper simply executes the SQL string: function GetInfoFromDbHelper ($db, $select, $errorString) { // Get info, based on the $select query $result = $db-query($select); if (DB::isError($result)) { $errorString .= $result-getMessage() . $result-getDebugInfo (); return FALSE; } return $result; } -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Sunday, February 22, 2004 2:49 PM To: Michael Flanagan Cc: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Hi Michael Can I see the script you are using that causes the problem? When I change the database context using the mssql extension under PERA it is not a problem. The PEAR DB drivers suppress all messages generated by their underlying extensions. The mssql DB driver will only stop if the mssql ext function it calls fails. Since changing the database context should not cause a function to fail, I am not exactly sure why your script is stopping. -- bob On Sat, 21 Feb 2004, Michael Flanagan wrote: Thanks, Frank. Since I'm getting script stoppage as a result of this error (message), does that suggest that PEAR is mishandling the error/message? (I think PEAR loads and uses the standard mssql extension, but I'm not sure. Even if it does, I don't know if it inserts itself into the error handling stream.) You say that if a message has a severity higher than the setting in php.ini (mine is set to 10), then it will stop the script. Since the message I'm concerned with is a 0, then it should not stop the script. But, my script is stopping as a result of that message. So, is this a PEAR problem? If not, what am I doing wrong? If so, how can I get around this? Thanks! Michael -Original Message- From: Frank M. Kromann [mailto:[EMAIL PROTECTED] Sent: Saturday, February 21, 2004 7:40 PM To: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error The MSSQL standard mssql extension handles the 'Changed database context' message correct. Each query send to the SQL server results in some form of message returned. This can be either an error message or an information message. The MSSQL extension uses two ini settings to tell PHP how to handle these messages. If a message from the server has a severity equal to or higher than the setting in php.ini, PHP will create a warning or an error (stop processing the script). The default setting for
[PHP-DB] Bad date external representation
I am running into a Bad date external representation when I try to insert some data from one of my pages. This is the SQL statement: $sql=insert into Vehicle_List (Date_PU,Date_Called,Company,Stock_Number,VIN,Veh_Year,Veh_Make,Veh_Model,Veh_Color, PU_LOC,Recd_Orig_Title,Sent_Title,Recd_Title,Sold_Date,Sale_Date,Sale_Status,VIN_Short) VALUES ('$Date_PU','$Date_Called','$Company','$Stock_Number','$VIN','$Veh_Year','$Veh_Make', '$Veh_Model','$Veh_Color','$PU_LOC','$Recd_Orig_Title','$Sent_Title', '$Recd_Title','$Sold_Date','$Sale_Date','$Sale_Status','$VIN_Short'); I am using Postgres 7.3. The date is being entered as 10/10/2004. Any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MS SQL 'Changed database context' error
Hi Bob, Problem solved! In the process of looking around, to ensure that I wasn't switching db's, I found that the second SELECT I was doing was using an empty select string, as opposed to SELECT * FROM... I fixed tha blunder, and things started working. I'm never quite so stupid as when I'm trying to be quite so smart! Thanks for sticking with me on this one. Michael -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Sunday, February 22, 2004 6:38 PM To: Michael Flanagan Cc: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Hi Michael Prior to executing a query with the PEAR mssql DB driver, the driver will always call mssql_select_db(). The db that was specified in the DSN is the one that is selected. If the db is changed after connecing via a query, i.e., use AnotherDB, this will cause a problem if the context is changed back to the original DB. Are you changing the DB after connecting? -- bob On Sun, 22 Feb 2004, Michael Flanagan wrote: Robert, Believe it or not, it's a simple SELECT statement! (I'm not even aware that I'm changing context, nor exactly what that means. I thought that if I used the same $db resource, things would be fine.) Other SELECTs work, but not this particular one! Here's the script (the FindInDb function below has, of course, been called from a prior script): /** * Find the record in the db that matches the Encounter info. * * If $updateObject is TRUE, then we update the object's fields with * values from the matching record in the database record. */ function FindInDb($db, $updateObject, $errStr) { global $DbOwner; // null string () for MS Sql Server if (!IsSet($this-_deviceId) || !(IsSet($this-_timeStart))) { $errStr .= Encounter::FindInDb: either _deviceId or _timeStart is NULL.; return FALSE; } $sql = SELECT * from {$DbOwner}Encounter . WHERE (Device_key = $this-_deviceId) AND . (Time_start = . ToDate($this-_timeStart, -MM-DD HH24:MI:SS) . ); if (!UseOrOpenDb($db, $closeDb, $errStr)) return FALSE; $result = GetInfoFromDbHelper($db, $sql, $errStr); and so on. The routine UseOrOpenDb looks at $db to see if it's a valid $db connection. If not, it opens a new one. I've determined that FindInDb is always passed a valid $db, so UseOrOpen doesn't open a fresh one. /** * Determine whether a db resource is already open; open one if not * * In many places we pass a $db resource to a routine. That resource might * not be open, in which case the called routine should open the db. */ function UseOrOpenDb($db, $dbOpened, $errorString) { if (!$db) { if (!($db = GetDbConnection ($errorString))) { return FALSE; } $dbOpened = TRUE; } else { $dbOpened = FALSE; } return TRUE; } GetInfoFromDbHelper simply executes the SQL string: function GetInfoFromDbHelper ($db, $select, $errorString) { // Get info, based on the $select query $result = $db-query($select); if (DB::isError($result)) { $errorString .= $result-getMessage() . $result-getDebugInfo (); return FALSE; } return $result; } -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Sunday, February 22, 2004 2:49 PM To: Michael Flanagan Cc: Php-Db Subject: RE: [PHP-DB] MS SQL 'Changed database context' error Hi Michael Can I see the script you are using that causes the problem? When I change the database context using the mssql extension under PERA it is not a problem. The PEAR DB drivers suppress all messages generated by their underlying extensions. The mssql DB driver will only stop if the mssql ext function it calls fails. Since changing the database context should not cause a function to fail, I am not exactly sure why your script is stopping. -- bob On Sat, 21 Feb 2004, Michael Flanagan wrote: Thanks, Frank. Since I'm getting script stoppage as a result of this error (message), does that suggest that PEAR is mishandling the error/message? (I think PEAR loads and uses the standard mssql extension, but I'm not sure. Even if it does, I don't know if it inserts itself into the error handling stream.) You say that if a message has a severity higher than the setting in php.ini (mine is set to 10), then it will stop the script. Since the message I'm concerned with is a 0, then it should not stop the script. But, my script is stopping as a result of that message. So, is this a PEAR problem? If not, what am I doing wrong? If so, how can I get around this? Thanks! Michael -Original Message- From: Frank M. Kromann [mailto:[EMAIL PROTECTED] Sent: Saturday, February 21, 2004 7:40 PM To: Php-Db