[PHP-DB] PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so'
Hi, I installed mysql and php. Its OK. After I install php-mysql, the following messages come out. PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysqli.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_mysql.so' - libmysqlclient.so.15: cannot open shared object file: No such file or directory in Unknown on line 0 The file of libmysqlclient.so.15 is located in /usr/lib/mysql and this folder is in ld.so.conf. But libmysqlclient.so.15 works fine in DBD::mysql and command line "mysql" (OS- fedora linux 8, mysql-5.0.45, php-5.2.6, php-mysql-5.2.6) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PostgreSQL pg_connection_status() bug?
I found some quite odd today and I am wondering if anyone else has encountered this (or can reproduce it) - or maybe I am just going crazy. The function pg_connection_status() should return PGSQL_CONNECTION_BAD or null if the PostgreSQL service/database has stopped/restarted/ is not responding - after you have connected to it. But what I encountered today suggests that is continues to return PGSQL_CONNECTION_OK after the stop / restart. It will only start returning PGSQL_CONNECTION_BAD if you try to run a query. For example - this is what I am experiencing: $link_id = pg_connect("dbname=test"); //do some queries ... etc ... // pg_connection_status($link_id) equals PGSQL_CONNECTION_OK; *** PostgreSQL database/service is stopped or restarted *** // pg_connection_status($link_id) still equals PGSQL_CONNECTION_OK; pg_query($link_id,$query); // this fails - outputs an error // pg_connection_status($link_id) now equals PGSQL_CONNECTION_BAD or null; Any comments or suggestions would be appreciated. Thanks. Scott -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Creating drop down lists
Hi everyone! I would like to create a drop down list with the info in my database. I would also like to have more options so it will filter down to many rows of data displayed then filtered down to a few rows of data that said user is looking for. Kind of like select a state then in the next box you can select the city. but first thing is first. I have tried a few things out there that I searched for but everything I tried it will not populate the drop down list with the data in my database. So I know it somewhere along the lines of: $query = mysql_query("SELECT root FROM training"); echo ""; while ($r = mysql_fetch_array($query)) { $user = $r["username"]; echo "$user"; } echo ""; or something like that but nothing populates What is the proper code to get this done to populate and display what I select from the drop down menu? Say my DB name is: TUBA My table name is: FLUTE and I have xxx amounts of rows to filter through with three columns in my mysql db. Does that all make sense? Thanks in advance! You all rock!! sb -- AOL IM: Jestrix1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Creating a Table to line query results in php?
ThanksI was trying to do that but was not working for me. I think I was over thinking it. The obvious is never obvious :) On 2/25/07, Matt Anderton <[EMAIL PROTECTED]> wrote: why not just create a table? echo "\n"; echo "ImageNameEffectCategoryOrigin\n"; while ($data = mysql_fetch_array($res)) { echo "\n"; echo "" . $data['Image'] . "\n"; echo "" . $data['Name'] . "\n"; echo "" . $data['Effect'] . "\n"; echo "" . $data['Category'] . "\n"; echo "" . $data['Origin'] . "\n"; echo "\n"; } echo "\n"; Or am I oversimplifying? ~ matt On 2/25/07, Scott <[EMAIL PROTECTED]> wrote: > > Hi everyone! > > How can I create a table...or even something similar...to line information up? > > The information is coming from an mysql database and there are 5 > columns of data. > > Of course I am using php to call the data out of the database. > > A simple example: > > while ($data = mysql_fetch_array($res)) > { > $idfield = $data['IDFIELD']; > $name = $data['Name']; > $effect = $data['Effect']; > $category = $data['Category']; > $origin = $data['Origin']; > $image = $data['Image']; > > echo ", $name, $effect, $category, $origin"; > } > > The echo is the stuff I want to line up under the headings of the > columns when they are displayed. > > So there are 5 headers and under the 5 headers is the resulting > display of info and I want it lined up, centered, under the headers. > > Does that all make sense? > > Thanks for all of your time! > > S > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Scott Burcky AOL IM: Jestrix1 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Creating a Table to line query results in php?
Hi everyone! How can I create a table...or even something similar...to line information up? The information is coming from an mysql database and there are 5 columns of data. Of course I am using php to call the data out of the database. A simple example: while ($data = mysql_fetch_array($res)) { $idfield = $data['IDFIELD']; $name = $data['Name']; $effect = $data['Effect']; $category = $data['Category']; $origin = $data['Origin']; $image = $data['Image']; echo ", $name, $effect, $category, $origin"; } The echo is the stuff I want to line up under the headings of the columns when they are displayed. So there are 5 headers and under the 5 headers is the resulting display of info and I want it lined up, centered, under the headers. Does that all make sense? Thanks for all of your time! S -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Serialize
you should definitely quote it because serialized strings can still contain quotes, semicolons, commas, etc... and other stuff thats used in sql injection attacks. On 5/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi, Is a serialized array a "safe" string to enter into a mysql text field? Or is a function such as mysql_real_escape_string needed to ensure it is inserted correctly? regards Simon. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Scott Hurring [scott dot hurring dot lists at gmail dot com] http://hurring.com/
[PHP-DB] odbc_exec error
I'm pretty new to PHP so I need help. I'm getting this error: Error in updating SQL PHP Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2., SQL state 07001 in SQLExecDirect in c:\Inetpub\wwwroot\shout.php on line 77 Lines 76 and 77: $sql="UPDATE shout SET UserName=$laName,Message=$laMessage WHERE Dat=$laDate"; $updating=odbc_exec($conn,$sql); where $laName, $laMessage, and $laDate are from a POST. I've checked my spelling a million times and changed the names of variables. Why is it still complaining? Please help! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Array problem...
I am migrating a web app from an old server running PHP 4.2.3 to a new server running 4.3.8. The problem I am running into at the moment is building an array and passing it to another page. This code works fine on the old server, but the array is not coming across to the new page on the new server. Help... mysql_select_db($database, $Prod); $shell_list = getEnumOptions('accounts','shell'); $shell_tmp = "\n"; $shell_tmp .= "Default Shell\n"; $shell_tmp .= "-\n"; foreach ($shell_list as $item) { $shell_tmp .= "$item\n"; } $shell_tmp .= "\n"; $query_groups = "SELECT name FROM grps"; $groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error()); $grp_list = "\n"; $grp_list .= "Primary Group\n"; $grp_list .= "---\n"; while($item2 = mysql_fetch_row($groups_tmp)) { $grp_list .= "$item2[0]\n"; } $grp_list .= "\n"; ".$_POST['system'][$cntr].""; echo "".$shell_tmp.""; echo "".$grp_list.""; echo ""; $tmp = $sbcuid."-".$_POST['system'][$cntr]; $cntr++; array_push( $accnts, $tmp ); } ?> If the systems listed above are correct, please proceed. Otherwise, please hit the Back button on your browser and review your system selections again. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: php-db Digest 7 Jun 2005 17:56:06 -0000 Issue 2973
Bastien, That seems to have worked. I can see php admin's home page. And it looks like PHP BB got installed. I understand the error message (basically, the compiled-in library is out of date with the server) but it could be A LOT clearer...it sounds like the MySQL client libraries are out of date and they're not. I know PHP and the other tools are all free. But this is a pretty basic compatibility issue that could be VERY easily documented right in the install file for PHP 4.x: if you are using version x.y or greater of MySQL, please be sure... would go a long way to eliminating this confusion. Thanks Scott [EMAIL PROTECTED] wrote: php-db Digest 7 Jun 2005 17:56:06 - Issue 2973 Topics (messages 39594 through 39599): Re: Newbie with mail problem 39594 by: Andrés G. Montañez 39599 by: Wings Cannot connect to local MySQL -- Client does not support authentication protocol 39595 by: Scott Powell 39596 by: Bastien Koert 39597 by: Scott Powell 39598 by: Román Sánchez Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-db@lists.php.net -- Date: Tue, 7 Jun 2005 09:25:58 -0300 From: Andrés G. Montañez <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: Re: [PHP-DB] Newbie with mail problem Use a real hostname, not 'localhost'.- -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay To: php-db@lists.php.net From: "Wings" <[EMAIL PROTECTED]> Date: Tue, 7 Jun 2005 10:38:24 -0700 Subject: Re: [PHP-DB] Newbie with mail problem ""Andrés G. Montañez"" wrote in message news:[EMAIL PROTECTED] Use a real hostname, not 'localhost'.- Will give that a try. Thank you. -- Atte, Andrés G. Montañez Técnico en Redes y Telecomunicaciones Montevideo - Uruguay Date: Tue, 7 Jun 2005 07:43:23 -0700 (PDT) From: Scott Powell <[EMAIL PROTECTED]> To: php-db@lists.php.net Subject: Cannot connect to local MySQL -- Client does not support authentication protocol I am trying to set up my laptop to run PHP and MySQL together.My system summary is:Win 2000 (localhost)PHP 4.3.11MySQL Server 4.1.12MySQL Client 5.0.0MySQL Admin 1.0.9I can connect to my local MySQL host using MySQL client tools.I can connect to a remote MySQL server (don't know the exact version) from PHP in a very simple connect/select template.But I cannot connect to my local MySQL Server from my local PHP installation.Using phpMyAdmin version 2.2.7-pl1, the error message is:"MySQL said: Client does not support authentication protocol requested by server; consider upgrading MySQL client"PHP BB gives a similar message:"Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in c:\inetpub\wwwroot\phpbb2\db\mysql4.php on line 48"Can anyone suggest how to solve this problem? I've spent the better part of every evening for th epast week trying to get PHP and MySQL to work...I'm at wits end.ThanksScott __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From: "Bastien Koert" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED], php-db@lists.php.net Date: Tue, 07 Jun 2005 11:47:22 -0400 Subject: RE: [PHP-DB] Cannot connect to local MySQL -- Client does not support authentication protoco MySQL's instructions, while 'clear'(upgrade the client library), don't tell you where to get the damn library. If anyone has a link to the new mysql client libraries, I'd appreciate it. I tend to simply downgrade the password string to the old 16bit style run this command: SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd'); Bastien >From: Scott Powell >To: php-db@lists.php.net >Subject: [PHP-DB] Cannot connect to local MySQL -- Client does not support >authentication protocol >Date: Tue, 7 Jun 2005 07:43:23 -0700 (PDT) > > >I am trying to set up my laptop to run PHP and MySQL together.My system >summary is:Win 2000 (localhost)PHP 4.3.11MySQL Server 4.1.12MySQL Client >5.0.0MySQL Admin 1.0.9I can connect to my local MySQL host using MySQL >client tools.I can connect to a remote MySQL server (don't know the exact >version) from PHP in a very simple connect/select template.But I cannot >connect to my local MySQL Server from my local PHP installation.Using >phpMyAdmin version 2.2.7-pl1, the error message is:"MySQL said: Client does >not support authentication protocol requested by server; consider upgrading >MySQL client"PHP BB gives a similar message:"Warning: mysql_connect(): >Client does not supp
RE: [PHP-DB] Cannot connect to local MySQL -- Client does not support authentication protocol
I tried the use old passwords flag in the my.ini file. That has completely crashed out the Admin GUI (GPF writing to ntdll.dll) and not corrected the problem. I'll try this too. Bastien Koert <[EMAIL PROTECTED]> wrote: MySQL's instructions, while 'clear'(upgrade the client library), don't tell you where to get the damn library. If anyone has a link to the new mysql client libraries, I'd appreciate it. I tend to simply downgrade the password string to the old 16bit style run this command: SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd'); Bastien >From: Scott Powell >To: php-db@lists.php.net >Subject: [PHP-DB] Cannot connect to local MySQL -- Client does not support >authentication protocol >Date: Tue, 7 Jun 2005 07:43:23 -0700 (PDT) > > >I am trying to set up my laptop to run PHP and MySQL together.My system >summary is:Win 2000 (localhost)PHP 4.3.11MySQL Server 4.1.12MySQL Client >5.0.0MySQL Admin 1.0.9I can connect to my local MySQL host using MySQL >client tools.I can connect to a remote MySQL server (don't know the exact >version) from PHP in a very simple connect/select template.But I cannot >connect to my local MySQL Server from my local PHP installation.Using >phpMyAdmin version 2.2.7-pl1, the error message is:"MySQL said: Client does >not support authentication protocol requested by server; consider upgrading >MySQL client"PHP BB gives a similar message:"Warning: mysql_connect(): >Client does not support authentication protocol requested by server; >consider upgrading MySQL client in c:\inetpub\wwwroot\phpbb2\db\mysql4.php >on line 48"Can anyone suggest how to solve this problem? I've spent the >better part of every evening for th epast week trying to get PHP and MySQL >to work...I'm at wits end.ThanksScott > > >__ >Do You Yahoo!? >Tired of spam? Yahoo! Mail has the best spam protection around >http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
[PHP-DB] Cannot connect to local MySQL -- Client does not support authentication protocol
I am trying to set up my laptop to run PHP and MySQL together.My system summary is:Win 2000 (localhost)PHP 4.3.11MySQL Server 4.1.12MySQL Client 5.0.0MySQL Admin 1.0.9I can connect to my local MySQL host using MySQL client tools.I can connect to a remote MySQL server (don't know the exact version) from PHP in a very simple connect/select template.But I cannot connect to my local MySQL Server from my local PHP installation.Using phpMyAdmin version 2.2.7-pl1, the error message is:"MySQL said: Client does not support authentication protocol requested by server; consider upgrading MySQL client"PHP BB gives a similar message:"Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in c:\inetpub\wwwroot\phpbb2\db\mysql4.php on line 48"Can anyone suggest how to solve this problem? I've spent the better part of every evening for th epast week trying to get PHP and MySQL to work...I'm at wits end.ThanksScott __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
[PHP-DB] Problem with foreach looping...
I am attempting to use a simple foreach loop on a query result, and I am only getting the first element of the array back. Here is the code... $exclude_query = "SELECT hostname FROM exclusion"; $exclude_results = mysql_query($exclude_query, $Prod); $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM); foreach ($exclude as $row) { echo "$row\n"; } I don't understand how I am just getting a single item back from this. The query actually returns all 13 entries in the exclusion table. I have tested the query via the mysql client. I also get all 13 elements back if I loop via the following. while ($test = mysql_fetch_array($results, MYSQL_NUM)) { echo "$test[0]\n"; } Is my PHP somehow broke, or am I just missing something here? Thanks. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL Subquery problems...
Yup... Thanks, I just discovered that myself. Thankfully the docs have instructions on how to write a subquery for earlier versions that don't support subqueries. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 30, 2005 9:35 AM To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net Subject: RE: [PHP-DB] MySQL Subquery problems... only mysql 4.1+ supports subqueries..if you version is lower it won;t work Bastien >From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> >To: >Subject: [PHP-DB] MySQL Subquery problems... >Date: Wed, 30 Mar 2005 09:25:36 -0600 > > I am working with one of our Oracle DBAs to have him try and >help me get a couple of queries working. The problem is that in looking >at the documentation for MySQL it seems that what we are attempting >should work. Unfortunately, it doesn't. Here is what we are trying... > >mysql> SELECT CPU_Hostname FROM AllMid_Data > -> WHERE CPU_Hostname NOT IN > -> (SELECT hostname FROM exclusion); >ERROR 1064: You have an error in your SQL syntax. Check the manual that >corresponds to your MySQL server version for the right syntax to use >near 'SELECT hostname FROM exclusion)' at line 3 > > This is an error returned from the mysql client. Any help would >be most appreciated. > >Scott Nipp >Phone: (214) 858-1289 >E-mail: [EMAIL PROTECTED] >Web: http:\\ldsa.sbcld.sbc.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
[PHP-DB] MySQL Subquery problems...
I am working with one of our Oracle DBAs to have him try and help me get a couple of queries working. The problem is that in looking at the documentation for MySQL it seems that what we are attempting should work. Unfortunately, it doesn't. Here is what we are trying... mysql> SELECT CPU_Hostname FROM AllMid_Data -> WHERE CPU_Hostname NOT IN -> (SELECT hostname FROM exclusion); ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT hostname FROM exclusion)' at line 3 This is an error returned from the mysql client. Any help would be most appreciated. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] RE: Further MySQL query problems...
OK. Maybe I am going about this in the wrong manner. Here is the SQL statement that I am starting out with. $query = "SELECT Hostname FROM Data WHERE CPU_IN_SVC = \"Y\" AND CPU_DNS = \"blah.com\" ORDER BY Hostname ASC"; This query provides me a complete list of all the systems in our organization. The following query provides me with a list of systems in an exclusion table that should not be displayed. $exclude_query = "SELECT hostname FROM exclusion"; This one is obviously quite simple and straight-forward. The next query is one that will generate a list of systems on which the user already has an account. $query2= "SELECT Data.Hostname FROM Data, acct_db WHERE Data.CPU_IN_SVC = \"Y\" AND Data.CPU_DNS = \"blah.com\" AND acct_db.key1 LIKE '$var%' AND acct_db.key1 LIKE CONCAT(\"%\", Data.Hostname) ORDER BY Hostname ASC"; This query is very much like the first, but it also looks into the acct_db table to match userids and hostnames. This is currently a separate query because this data is used to display information in a separate section of the web page. $query3= "SELECT Data.Hostname FROM Data, accounts WHERE Data.CPU_IN_SVC = \"Y\" AND Data.CPU_DNS = \"sbcld.sbc.com\" AND accounts.uid = '$var' AND accounts.system = Data.Hostname AND accounts.ctime IS NULL ORDER BY Hostname ASC"; This query is also similar to the first , but it looks into the accounts table to determine if the user has already submitted an account request for the server, AND that this account has not yet been created (ctime IS NULL). Like the query above, this is a separate query since it is used to populate a different section of the web page. I do not know if it is possible to somehow combine all 4 of these queries into a single complex query. This would be preferred in my mind as it would let the server do more work in fewer queries. What I would like to do is have a single query that would return the hostnames with some kind of key that could then be used to determine what criteria the query matched to specifically. I am guessing that this would be a numeric value that would be a secondary array element associated with the hostname. I would then write my display code to check the value of this element to determine how/where to display the data. Thanks in advance for any help in this. I have no idea if this is possible, but I am guessing that it is. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Monday, March 28, 2005 11:13 AM To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net Subject: RE: [PHP-DB] RE: Further MySQL query problems... why wouldn't you just run a query to return only the elements that you want? Bastien >From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> >To: >Subject: [PHP-DB] RE: Further MySQL query problems... >Date: Mon, 28 Mar 2005 10:49:24 -0600 > > Oops... Correction to the last line of the script. > > > Should be... > >Scott Nipp >Phone: (214) 858-1289 >E-mail: [EMAIL PROTECTED] >Web: http:\\ldsa.sbcld.sbc.com > > > > -Original Message- > > From: NIPP, SCOTT V (SBCSI) > > Sent: Monday, March 28, 2005 10:47 AM > > To: 'php-db@lists.php.net' > > Subject:Further MySQL query problems... > > > > I am having trouble in the following code. Basically, I want to > > query two separate database tables and then generate an array from > > these two queries. The first query will return a list of ALL systems. > > The second query will return a list of systems that should be > > excluded. The problem is that this is getting me nowhere. Here is > > the pertinent code... > > > > $query = "SELECT CPU_Hostname FROM AllMid_Data > > WHERE CPU_IN_SVC = \"Y\" > > AND CPU_DNS = \"sbcld.sbc.com\" > > ORDER BY CPU_Hostname ASC"; > > $results = mysql_query($query, $Prod) or die(mysql_error()); > > $system = mysql_fetch_array($results, MYSQL_NUM); > > $exclude_query = "SELECT hostname FROM exclusion"; > > $exclude_results = mysql_query($exclude_query, $Prod); > > $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM); > > $temp = array_diff($system, $exclude); > > > $sys = $blah[0];
RE: [PHP-DB] RE: Further MySQL query problems...
If I could figure out how to structure the query, I would be happy to do so. The problem is that I am working with 3 different tables for this. Additionally, I ran into a brick wall when trying to structure the query to remove/eliminate the entries in the exclusion table. The exclusion table has 13 entries currently, and the last thing I tried with the query was outputting 13 entries of every system. Here is the query that was yielding this... #$query = "SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, exclusion # WHERE AllMid_Data.CPU_IN_SVC = \"Y\" # AND AllMid_Data.CPU_DNS = \"sbcld.sbc.com\" # AND AllMid_Data.CPU_Hostname != exclusion.hostname # ORDER BY CPU_Hostname ASC"; Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Monday, March 28, 2005 11:13 AM To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net Subject: RE: [PHP-DB] RE: Further MySQL query problems... why wouldn't you just run a query to return only the elements that you want? Bastien >From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> >To: >Subject: [PHP-DB] RE: Further MySQL query problems... >Date: Mon, 28 Mar 2005 10:49:24 -0600 > > Oops... Correction to the last line of the script. > > > Should be... > >Scott Nipp >Phone: (214) 858-1289 >E-mail: [EMAIL PROTECTED] >Web: http:\\ldsa.sbcld.sbc.com > > > > -Original Message- > > From: NIPP, SCOTT V (SBCSI) > > Sent: Monday, March 28, 2005 10:47 AM > > To: 'php-db@lists.php.net' > > Subject:Further MySQL query problems... > > > > I am having trouble in the following code. Basically, I want to > > query two separate database tables and then generate an array from > > these two queries. The first query will return a list of ALL systems. > > The second query will return a list of systems that should be > > excluded. The problem is that this is getting me nowhere. Here is > > the pertinent code... > > > > $query = "SELECT CPU_Hostname FROM AllMid_Data > > WHERE CPU_IN_SVC = \"Y\" > > AND CPU_DNS = \"sbcld.sbc.com\" > > ORDER BY CPU_Hostname ASC"; > > $results = mysql_query($query, $Prod) or die(mysql_error()); > > $system = mysql_fetch_array($results, MYSQL_NUM); > > $exclude_query = "SELECT hostname FROM exclusion"; > > $exclude_results = mysql_query($exclude_query, $Prod); > > $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM); > > $temp = array_diff($system, $exclude); > > > $sys = $blah[0]; > > echo ""; ?> > > > > "; } ?> > > > > > > I have cut out a lot of extraneous stuff that I don't think is > > pertinent. Please let me know if you see something causing my > > problems. The first query table has about 900 entries and the query > > returns about 90 hostnames. The exclude table query has only 13 > > hostnames and obviously returns all. I am looking for a way to > > display the approximately 77 entries that are NOT in the exclude > > table. Thanks again. > > > > Scott Nipp > > Phone: (214) 858-1289 > > E-mail: [EMAIL PROTECTED] > > Web: http:\\ldsa.sbcld.sbc.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
[PHP-DB] RE: Further MySQL query problems...
Oops... Correction to the last line of the script. Should be... Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com > -Original Message- > From: NIPP, SCOTT V (SBCSI) > Sent: Monday, March 28, 2005 10:47 AM > To: 'php-db@lists.php.net' > Subject: Further MySQL query problems... > > I am having trouble in the following code. Basically, I want to > query two separate database tables and then generate an array from > these two queries. The first query will return a list of ALL systems. > The second query will return a list of systems that should be > excluded. The problem is that this is getting me nowhere. Here is > the pertinent code... > > $query = "SELECT CPU_Hostname FROM AllMid_Data > WHERE CPU_IN_SVC = \"Y\" > AND CPU_DNS = \"sbcld.sbc.com\" > ORDER BY CPU_Hostname ASC"; > $results = mysql_query($query, $Prod) or die(mysql_error()); > $system = mysql_fetch_array($results, MYSQL_NUM); > $exclude_query = "SELECT hostname FROM exclusion"; > $exclude_results = mysql_query($exclude_query, $Prod); > $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM); > $temp = array_diff($system, $exclude); >$sys = $blah[0]; > echo ""; ?> > > "; } ?> > > > I have cut out a lot of extraneous stuff that I don't think is > pertinent. Please let me know if you see something causing my > problems. The first query table has about 900 entries and the query > returns about 90 hostnames. The exclude table query has only 13 > hostnames and obviously returns all. I am looking for a way to > display the approximately 77 entries that are NOT in the exclude > table. Thanks again. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.com > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Further MySQL query problems...
I am having trouble in the following code. Basically, I want to query two separate database tables and then generate an array from these two queries. The first query will return a list of ALL systems. The second query will return a list of systems that should be excluded. The problem is that this is getting me nowhere. Here is the pertinent code... $query = "SELECT CPU_Hostname FROM AllMid_Data WHERE CPU_IN_SVC = \"Y\" AND CPU_DNS = \"sbcld.sbc.com\" ORDER BY CPU_Hostname ASC"; $results = mysql_query($query, $Prod) or die(mysql_error()); $system = mysql_fetch_array($results, MYSQL_NUM); $exclude_query = "SELECT hostname FROM exclusion"; $exclude_results = mysql_query($exclude_query, $Prod); $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM); $temp = array_diff($system, $exclude); "; ?> "; } ?> I have cut out a lot of extraneous stuff that I don't think is pertinent. Please let me know if you see something causing my problems. The first query table has about 900 entries and the query returns about 90 hostnames. The exclude table query has only 13 hostnames and obviously returns all. I am looking for a way to display the approximately 77 entries that are NOT in the exclude table. Thanks again. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL query problems...
OK. I think I have resolved this issue. The problem I am having now is that I have a simple table that is a list of systems to exclude from the display. I am having trouble figuring out how to structure my query to actually exclude the systems in this table. Here is what I tried, and it gives me 13 instances of every entry, 13 is the number of hostnames in the exclusion table. $query = "SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, exclusion WHERE AllMid_Data.CPU_IN_SVC = \"Y\" AND AllMid_Data.CPU_DNS = \"sbcld.sbc.com\" AND AllMid_Data.CPU_Hostname != exclusion.hostname ORDER BY CPU_Hostname ASC"; $results = mysql_query($query, $Prod) or die(mysql_error()); $system = mysql_fetch_assoc($results); Additionally, what I am actually working towards is that if a system shows up in either of the other queries it gets excluded from this one. I have not tried anything to make that happen yet. I will tackle that challenge once I can resolve this part. Thanks again. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: J. Connolly [mailto:[EMAIL PROTECTED] Sent: Thursday, March 24, 2005 7:36 AM Cc: php-db@lists.php.net Subject: Re: [PHP-DB] MySQL query problems... yeah...errora are important. I do not escape my quotation marks in a query. I use single quotes within my insert and select statements. If it says "No valis MySQL resource then you are returning 0 records which may be caused by escaping the quotations. I follow this pattern $sql ="INSERT INTO VALUES ('some value','another value','etc')"; NIPP, SCOTT V (SBCSI) wrote: > I am getting errors for the following queries. This query seems >to work fine in phpMyAdmin. > >$query2 = "SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, accounts > WHERE AllMid_Data.CPU_IN_SVC = \"Y\" > AND AllMid_Data.CPU_DNS = \"sbcld.sbc.com\" > AND accounts.sbcuid = $sbcuid > AND accounts.system = AllMid_Data.CPU_Hostname > AND accounts.ctime IS NULL > ORDER BY CPU_Hostname ASC"; >$results2 = mysql_query($query2, $Prod) or die(mysql_error()); >$system2 = mysql_fetch_assoc($results2); >$query3 = "SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, acct_db > WHERE AllMid_Data.CPU_IN_SVC = \"Y\" > AND AllMid_Data.CPU_DNS = \"sbcld.sbc.com\" > AND acct_db.key1 LIKE \"$sbcuid%\" > AND acct_db.key1 LIKE \"%\".AllMid_Data.CPU_Hostname > ORDER BY CPU_Hostname ASC"; >$results3 = mysql_query($query3, $Prod) or die(mysql_error()); >$system3 = mysql_fetch_assoc($results3); > > I am assuming that I have an issue with query3. Thanks in >advance. >Scott Nipp >Phone: (214) 858-1289 >E-mail: [EMAIL PROTECTED] >Web: http:\\ldsa.sbcld.sbc.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
[PHP-DB] MySQL query problems...
I am getting errors for the following queries. This query seems to work fine in phpMyAdmin. $query2 = "SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, accounts WHERE AllMid_Data.CPU_IN_SVC = \"Y\" AND AllMid_Data.CPU_DNS = \"sbcld.sbc.com\" AND accounts.sbcuid = $sbcuid AND accounts.system = AllMid_Data.CPU_Hostname AND accounts.ctime IS NULL ORDER BY CPU_Hostname ASC"; $results2 = mysql_query($query2, $Prod) or die(mysql_error()); $system2 = mysql_fetch_assoc($results2); $query3 = "SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, acct_db WHERE AllMid_Data.CPU_IN_SVC = \"Y\" AND AllMid_Data.CPU_DNS = \"sbcld.sbc.com\" AND acct_db.key1 LIKE \"$sbcuid%\" AND acct_db.key1 LIKE \"%\".AllMid_Data.CPU_Hostname ORDER BY CPU_Hostname ASC"; $results3 = mysql_query($query3, $Prod) or die(mysql_error()); $system3 = mysql_fetch_assoc($results3); I am assuming that I have an issue with query3. Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Working with multiple tables...
Within the same server, even the same database, just a different table. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: Micah Stevens [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 1:47 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Working with multiple tables... Seperate on another MySQL server, or seperate within the same MySQL server? On Monday 21 March 2005 11:44 am, NIPP, SCOTT V (SBCSI) wrote: > I am working on revising a web request app that I have already > developed. The app basically provides a list of system names with > checkboxes for a user to select to request accounts on the systems. One > feature I am intending to add is that the app should check a separate > database of user accounts to see if the user already has an account on > the system. I think I could get it to work by making a query of the > userid for each system, but this seems quite inefficient. I would > rather somehow have a single query that gets a list of system names and > also checks the user account database at the same time to determine if > the user already has an account. Then I would like to display ALL of > the systems, but "grey out" the ones that the user already has accounts > on. Can someone help me figure out the best way to go about this? > Thanks in advance. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.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
[PHP-DB] Working with multiple tables...
I am working on revising a web request app that I have already developed. The app basically provides a list of system names with checkboxes for a user to select to request accounts on the systems. One feature I am intending to add is that the app should check a separate database of user accounts to see if the user already has an account on the system. I think I could get it to work by making a query of the userid for each system, but this seems quite inefficient. I would rather somehow have a single query that gets a list of system names and also checks the user account database at the same time to determine if the user already has an account. Then I would like to display ALL of the systems, but "grey out" the ones that the user already has accounts on. Can someone help me figure out the best way to go about this? Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL error...
No... That is just some strange error generated by the cut and paste. The "IS NOT NU LL" that is... The other issue with 'tablename'... I simply typed 'tablename' in the e-mail because I didn't remember the exact tablename when I was typing the e-mail. It does actually provide the name of the table that the script is working with. Thanks for the feedback. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: Norland, Martin [mailto:[EMAIL PROTECTED] Sent: Friday, December 10, 2004 2:34 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL error... > -----Original Message- > From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] > I have been using a PHP page to update a database table for a long time now. > Unfortunately, I have noticed that frequently when I perform an update I get back an error > saying "Table 'tablename' doesn't exist". This is becoming more and more annoying. [snip] > $query = "SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime IS NOT NU LL AND ctime > IS NULL ORDER BY rtime ASC"; $result = mysql_query($query, $Prod) or die(mysql_error()); ?> Strange behavior, can't say I've ever heard of/seen it - however... "IS NOT NU LL" is not, strictly speaking, valid sql. If that's not just a weird line wrapping issue - that may point to part of your problem. If the error you're getting back is literally "Table 'tablename' doesn't exist" - then you're looking in the wrong code, and somewhere you have code that says "tablename" instead of "$tablename". You may want to grep for "tablename" to try to track that down. Cheers, - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- 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
[PHP-DB] MySQL error...
I have been using a PHP page to update a database table for a long time now. Unfortunately, I have noticed that frequently when I perform an update I get back an error saying "Table 'tablename' doesn't exist". This is becoming more and more annoying. The table obviously exists as the page that I hit the update button on is populated from this same page. Additionally, if I backout and reload the page most of the time it will work. Any help would be greatly appreciated. Mysql 3.23.49 PHP 4.2.3 "; $return_url = $_SERVER['PHP_SELF']; session_register("return_url"); echo "Please login now. "; exit(); } else { $sbcuid = $valid_user; } while(isset($entry[0])) { $tmp = $entry[0]; $update = "UPDATE accounts SET ctime=NOW() WHERE id_sys='".$tmp."'"; $results = mysql_query($update, $Prod) or die(mysql_error()); array_shift($entry); } mysql_select_db($database, $Prod); $query = "SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime IS NOT NU LL AND ctime IS NULL ORDER BY rtime ASC"; $result = mysql_query($query, $Prod) or die(mysql_error()); ?> SBCLD User Account Request System Administration Here are the details for the accounts approved and pending creation: Requesting User Syste m Prima ry Group D efault Shell Reque st Time C ompleted ".$sbcuid.""; echo "".$sys.""; echo "".$list['gid'].""; echo "".$list['shell']." "; echo "".$list['atime']." "; echo ""; } } while ($list = mysql_fetch_assoc($result)); ?> Placing a check in the completed box will update the databas e entry for this request with a completed time and remove this entry from this page upon clicking the Update button below. Thanks in advance. This is really beginning to bug the crap out of me. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PEAR-DB Question - Joins/design issue?
Hi All, I'm looking at data abstraction libraries, and various object wrappers for SQL interfaces. Question -- how does the PEAR DB abstraction handle JOINS, especially on updates. I've seen several abstractions that basically encapsulate one table, but what about the situation with multiple tables of related data? I'm trying to build some higher level object-oriented classes, that mask the database specifics. I have several tables that are related, for example, a player table, and a game table, and a player-game-detail table, where the player table records the unchanging aspects of a player, the game table has the game info, and the player-game-detail records that player's stats for that specific game. To get at all of this data, I use joins. Is there a good object design that or class available that could handle this situation, or am I on my own here? Any suggestions, or is there a PEAR-based module or library that can deal with this situation? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Time Field
Why would you not simply use a 'datetime' field type? This gets you exactly what you are looking for unless I am misreading what you are doing here... Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: Bomgardner, Mark A [mailto:[EMAIL PROTECTED] Sent: Thursday, October 28, 2004 10:10 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Time Field When creating a time field in MySQL, its purpose is for elapsed time, not time of day. Is it better to use this field or to combine it with the date field when looking at inserting the start date and time of an event? Mark A. Bomgardner Technology Specialist KLETC -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Auto-increment questions...
OK. The problem is I don't want the next "highest" number. There are gaps in the UID sequence. I need to find the next UNUSED number in the sequence which is rarely the "highest" number. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 12:45 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: RE: [PHP-DB] Auto-increment questions... If its an autoincrement, the next highest number will be assigned by the db. There is no need to query the db to find it. Simply insert the record and leave the id field out of the insert statement. bastien >From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Subject: [PHP-DB] Auto-increment questions... >Date: Tue, 5 Oct 2004 11:58:41 -0500 > > I am working on a database application for Unix user accounts. >I want to be able to have a system that will provide me the next >available numeric user ID. I have created a 2 column index table that >simply includes UID and user name. This field is autoincrement and the >primary key for the table. Currently this field only contains a very >small sample of users. Basically, I have numeric IDs 3000, 3001, 3008, >and 3028. My problem is that I am not sure how to query this table to >get the next available numeric ID which is 3002. If I do an insert into >this table without specifying a value for the auto_increment column it >comes up with 3029. Is there a way to query and/or insert such that it >comes up with the next unused numeric value? > >Scott Nipp >Phone: (214) 858-1289 >E-mail: [EMAIL PROTECTED] >Web: http:\\ldsa.sbcld.sbc.com > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > _ Scan and help eliminate destructive viruses from your inbound and outbound e-mail and attachments. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU =http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN(r) Premium right now and get the first two months FREE*. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Auto-increment questions...
I am working on a database application for Unix user accounts. I want to be able to have a system that will provide me the next available numeric user ID. I have created a 2 column index table that simply includes UID and user name. This field is autoincrement and the primary key for the table. Currently this field only contains a very small sample of users. Basically, I have numeric IDs 3000, 3001, 3008, and 3028. My problem is that I am not sure how to query this table to get the next available numeric ID which is 3002. If I do an insert into this table without specifying a value for the auto_increment column it comes up with 3029. Is there a way to query and/or insert such that it comes up with the next unused numeric value? Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] IBM DB2
Robert Twitty wrote: On Thu, 19 Aug 2004, Gerard Samuel wrote: Robert Twitty wrote: Hi Is anyone using PHP to connect to an IBM DB2 database? The reason why I am asking is becaouse I want to see if the odbtp extension can be used to successfully prepare and execute DB2 stored procedures. So far, ODBTP performs quite well with IBM DB2 in regards to regular queries. I've never used stored procedures before, but if you have example code on hand, I can give it a shot... Unfortunately, I do not have access to an IDM DB2 database, so I don't have any examples of my own. However, after "Googling", I have discovered that creating DB2 stored procedures is a bit more complex than that of other databases, like SQL Server and Oracle. It appears that DB2 stored procedures are implemented as external shared libraries, i.e., DLLs. The examples that I found were written in C. So, testing ODBTP with DB2 stored procedures may be beyond the call of duty. -- bob Actually, DB2 has supported SQL procedures (following the SQL standard syntax for Persistent SQL Modules or PSM) since Version 7, but until Version 8.1 FixPak 7 (aka Version 8.2) you had to have a C compiler lurking under the covers -- which occasionally wound up in a configuration problem. There are lots of simple SQL procedure samples shipped in the sqllib/samples/sqlproc/ directory, or you can view them online at http://publib.boulder.ibm.com/infocenter/db2help/topic/com.ibm.db2.udb.doc/ad/r0007623.htm With Version 8.1 FixPak 7 / Version 8.2 the requirement for a C compiler is lifted and you can simply issue a CREATE PROCEDURE statement to, well, create an SQL procedure. So testing should become a whole lot simpler. You can get a free-for-development version of DB2 Personal Developer's Edition from http://www14.software.ibm.com/webapp/download/search.jsp?rs=db2pde if you want to test it out. Registration is required, but there's no license fee involved as long as you're not using the database in a production environment. Dan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] LAST_INSERT_ID?????
OK. I know that a BUNCH of people have had this question, and I have read numerous Google threads on this, but nothing really seems to point out the resolution... I have a table with the Primary Key as an auto_increment field. Once I insert a new row of data into the table I want to direct the user to a "Submitted" page. I am trying to pull the entry number to display for the user as a "ticket number". I would assume that I should use the LAST_INSERT_ID function for this. Unfortunately, I am getting either failures or all zeroes for this output. I can't even get this function to work in a SQL query window. Please help!!! I would attach code to this, but I am not sure what to attach. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: help w/ multidementional array in mysql
X-Mailer: Sylpheed version 0.9.8claws (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 25 Feb 2004 15:39:17 -0800 Justin Patrin <[EMAIL PROTECTED]> wrote: > ;-) > > > foreach ($returned_rows as $key => $value) > { >echo "". > $value['lastname'].", > ".$value[firstname].""; > } > > ?> > > > -- > paperCrane Now how elegant is that? You da man! -- Scott -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP-DB] Re: help w/ multidementional array in mysql
Sorry, I didn't cut that right: Here it is: $value) { if ($key & 1) { echo "".$value['lastname'].", ".$value[firstname].""; } else { echo "".$value['lastname'].", ".$value[firstname].""; } } ?> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: help w/ multidementional array in mysql
On Wed, 25 Feb 2004 14:56:53 -0400 Luis M Morales C <[EMAIL PROTECTED]> wrote: Thank you so much Justin and Luis. You guys are awesome. You both helped me tremendously! BTW, I figured out a way to make the tables show the $value results in alternating colors. I just use a bitwise AND to test if the $key is odd. If so make the cell blue! Heres: the code: <<< snip-snip >>> $value) { if ($key & 1) { echo " } else { echo "
Re: [PHP-DB] help w/ multidementional array in mysql
Sorry for accidentally posting twice: I wanted to point out a typo. At the bottom I meant "advancing the array" not "table" in regards to next() On Wed, 25 Feb 2004 11:12:10 -0600 "PHELPS, SCOTT" <[EMAIL PROTECTED]> wrote: > Thanks in advance for reading this: > > I am trying to take a query based on user input and selectively output > fields to a table. > > Heres the query code: > <<< snip - snip>>> > $query_result = mysql_query($query); > while ($field = mysql_fetch_array($query_result)) > { > $returned_rows = > array( > array( > "id"=>$field['id'], > "lastname"=>$field['lastname'], > "firstname"=>$field['firstname'], > "yearhired"=>$field['yearhired'], > "yeardepart"=>$field['yeardepart'] > ) > ); > } > <<< snip - snip>>> > > Now what I want to do is put only the lastname and firstname in a > small table with alternating colors: > > Like this: > > - > | $lastname, $firstname | ---> color=blue > - > | $lastname, $firstname | ---> color=white > - > | $lastname, $firstname | ---> color=blue > - > > Heres the code: > <<< snip - snip>>> > > foreach ($returned_rows as $value) > { >printf ("%s, %s", > $value['lastname'], $value['firstname']); > >next($returned_rows); > > printf ("%s, %s", > $value['lastname'], $value['firstname']); >} > } > ?> > > <<< snip - snip>>> > > The problem is that it only prints one name. Also next() doesn't seem to be > advancing the table so > I am getting duplicates of the one name it does print to the table > > Thanks. > > -- > Scott > > > -- > Scott Phelps > Regional IT Manager > Ridgway's, LTD. > 5001 Cleveland Street > Virginia Beach, VA 23462 > 757-490-2305 > > --- > Linux: "$ su - root" --> Windows: (reboot) > > > -- > Scott Phelps > Regional IT Manager > Ridgway's, LTD. > 5001 Cleveland Street > Virginia Beach, VA 23462 > 757-490-2305 > > --- > Linux: "$ su - root" --> Windows: (reboot) > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- Scott Phelps Regional IT Manager Ridgway's, LTD. 5001 Cleveland Street Virginia Beach, VA 23462 757-490-2305 --- Linux: "$ su - root" --> Windows: (reboot) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] help w/ multidementional array in mysql
Thanks in advance for reading this: I am trying to take a query based on user input and selectively output fields to a table. Heres the query code: <<< snip - snip>>> $query_result = mysql_query($query); while ($field = mysql_fetch_array($query_result)) { $returned_rows = array( array( "id"=>$field['id'], "lastname"=>$field['lastname'], "firstname"=>$field['firstname'], "yearhired"=>$field['yearhired'], "yeardepart"=>$field['yeardepart'] ) ); } <<< snip - snip>>> Now what I want to do is put only the lastname and firstname in a small table with alternating colors: Like this: - | $lastname, $firstname | ---> color=blue - | $lastname, $firstname | ---> color=white - | $lastname, $firstname | ---> color=blue - Heres the code: <<< snip - snip>>> %s, %s", $value['lastname'], $value['firstname']); next($returned_rows); printf ("%s, %s", $value['lastname'], $value['firstname']); } } ?> <<< snip - snip>>> The problem is that it only prints one name. Also next() doesn't seem to be advancing the table so I am getting duplicates of the one name it does print to the table Thanks. -- Scott -- Scott Phelps Regional IT Manager Ridgway's, LTD. 5001 Cleveland Street Virginia Beach, VA 23462 757-490-2305 --- Linux: "$ su - root" --> Windows: (reboot) -- Scott Phelps Regional IT Manager Ridgway's, LTD. 5001 Cleveland Street Virginia Beach, VA 23462 757-490-2305 --- Linux: "$ su - root" --> Windows: (reboot) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] help w/ multidementional array in mysql
Thanks in advance for reading this: I am trying to take a query based on user input and selectively output fields to a table. Heres the query code: <<< snip - snip>>> $query_result = mysql_query($query); while ($field = mysql_fetch_array($query_result)) { $returned_rows = array( array( "id"=>$field['id'], "lastname"=>$field['lastname'], "firstname"=>$field['firstname'], "yearhired"=>$field['yearhired'], "yeardepart"=>$field['yeardepart'] ) ); } <<< snip - snip>>> Now what I want to do is put only the lastname and firstname in a small table with alternating colors: Like this: - | $lastname, $firstname | ---> color=blue - | $lastname, $firstname | ---> color=white - | $lastname, $firstname | ---> color=blue - Heres the code: <<< snip - snip>>> %s, %s", $value['lastname'], $value['firstname']); next($returned_rows); printf ("%s, %s", $value['lastname'], $value['firstname']); } } ?> <<< snip - snip>>> The problem is that it only prints one name. Also next() doesn't seem to be advancing the table so I am getting duplicates of the one name it does print to the table Thanks. -- Scott -- Scott Phelps Regional IT Manager Ridgway's, LTD. 5001 Cleveland Street Virginia Beach, VA 23462 757-490-2305 --- Linux: "$ su - root" --> Windows: (reboot) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Array sorting question...
I am trying to populate an array from a MySQL database. I think I have the code correct to populate the array, but I need to somehow sort the array eliminating duplicate values. I think I can loop through the array doing a comparison and building a new array by discarding the value if it is a duplicate, but I was not sure if there was a more efficient way of doing this. I am already looping through the database query results, and I am just thinking about efficiency here. Here is a code sample with a little more description of what I am attempting... This query pulls a value from the database that is a username-hostname value. What I am working on is building a page that has a unique list of usernames that link to a second page of user account information. There may be twenty user account on different hosts for the same username. I only want to have the username link created once on this page. I hope that makes since to everyone. Thanks in advance for any help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PG and error handling
I have been looking for a resource on how to do proper error handling with (BPostgreSQL connections and queries. In one specific case, I have a (Breferential integrity constraint on a table. When I try to delete from that (Btable, it fails, as it should, when there is something referring to the (Bentry I am trying to erase. All fine and dandy. (B (BProblem is, I don't think pg_last_error() is a proper way to notify the user (Bthat they need to revise how they are proceeding with their action. In other (Bwords, I want to first DETECT that the integrity constraint has been (Bviolated (I am most likely to know why it has happened), and then print to (Bthe user a message the user will understand. (If the user were indeed a (Bprogrammer, I supposed pg_last_error() would be fine indeed) (B (BSo, is there any resource I can look at that is not only a tutorial but also (Bprovides a complete reference as to how to handle such errors? Everywhere I (Bhave looked there is only simple stuff like "How to connect to your PG (BDatabase" or "How to get data from your database". It would be much (Bappreciated if there was some resource to be share that fully explains how (Bto do error handling on the web somewhere! (B (BYour time is much appreciated, (BJonathan (B (B-- (BPHP Database Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Parse Errors...
I keep receiving a parse error every time I try and view the page I am working on. I am developing this very simple application in DreamWeaver MX 2004. Here are lines 3-16: I am simply attempting to pull data from two separate tables in two separate databases. Every time I try to view my work, I am getting a parse error on the 'mysql_select_db($database_ProdUsers, $ProdUsers);' regardless of whether this is the first or second mysql_select_db. I imagine that I am simply doing something obviously wrong here. Please help. Thanks. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Logic Help...
Thanks for all the help. I was finally able to get this working properly by viewing the variable data as suggested. I then ran into another minor issue with session variables keeping their old values on a second pass through the application, but I resolved this by unregistering these variables before sending the user back through the application. One strange thing I noticed was that you can register multiple variables with a single session_register, but you have to unregister only a single variable at a time. Anyone know anything more about this? Am I doing something wrong, or is it this way by design? Thanks. -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 27, 2003 4:10 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Logic Help... From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> > Thanks for the feedback. This seems to have helped, but something > is still not working with the logic. Here is the updated code: > >while($cntr != 0) { > $cntr--; > if (($shell[$cntr] == "") || ($grp[$cntr] == "")) { > echo " size=\"4\">Sorry, but your request was not filled out completely. Please > resubmit this request ensuring that you have selected a Primary Group and > Default Shell."; > echo "Please > follow this href=\"http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\";>link to return > to the beginning of the request process."; > exit; > } > } > ?> > > Now, the test conditions never seem to enter into this portion of > code. I am unable to figure out why at this point. Thanks again for the > help. Okay... let's do some basic debugging now. What does print_r($shell) and print_r($grp) display? Are there any entries that are equal to an empty string? ---John Holmes... -- 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] Logic Help...
Thanks for the feedback. This seems to have helped, but something is still not working with the logic. Here is the updated code: Sorry, but your request was not filled out completely. Please resubmit this request ensuring that you have selected a Primary Group and Default Shell."; echo "Please follow this http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\";>link to return to the beginning of the request process."; exit; } } ?> Now, the test conditions never seem to enter into this portion of code. I am unable to figure out why at this point. Thanks again for the help. -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 9:15 AM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Logic Help... From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> > This isn't specifically a DB related question, but... The following > code snippet is not functioning for me. I keep receiving a parse error on > the "if" line. Basically I want to stop execution of this page if either of > the conditions in the "if" statement exist. Thanks in advance. > > > # while($cntr != 0) { > #if (($shell[$cntr] eq "") || ($grp[$cntr] eq "Primary Gr")) { Umm... you don't use 'eq' in PHP, you use == (that's two equal signs). ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Logic Help...
This isn't specifically a DB related question, but... The following code snippet is not functioning for me. I keep receiving a parse error on the "if" line. Basically I want to stop execution of this page if either of the conditions in the "if" statement exist. Thanks in advance. # while($cntr != 0) { #if (($shell[$cntr] eq "") || ($grp[$cntr] eq "Primary Gr")) { # echo "Sorry, but your request was not filled out completely. Please resubmit this request ensuring that you have selected a Primary Group and Default Shell."; # echo "Please follow this http://ldsa.sbcld.sbc.com/sa_bulletin/sa_board.htm\";>link to return to the beginning of the request process."; # exit; # } # } Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/MySQL Default Field Value...
I have a script that is going into semi-production and during this process a new problem was uncovered. I have the table a couple of table fields setup as "Not NULL" with a "Default" value. The problem is that if the user fails to select anything I get garbage in one of the fields and nothing in the other. I think this might be due to the PHP variable grabbing something, but I am not sure what. Here is the pertinent code. { Code snippet } $a = 0; $accnts = array(); $shells = array(); $grps = array(); $others = array(); mysql_select_db($database, $Prod); $shell_list = getEnumOptions('accounts','shell'); $shell_tmp = "\n"; $shell_tmp .= "Default Shell\n"; foreach ($shell_list as $item) { $shell_tmp .= "$item\n"; } $shell_tmp .= "\n"; $query_groups = "SELECT name FROM grps"; $groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error()); $grp_list = "\n"; $grp_list .= "Primary Group\n"; $grp_list .= "---\n"; while($name = mysql_fetch_row($groups_tmp)) { $grp_list .= "$name[0]\n"; } $grp_list .= "\n"; { Code snippet } ".$_POST['system'][$a].""; echo "".$shell_tmp.""; echo "".$grp_list.""; echo ""; $tmp = $sbcuid."-".$_POST['system'][$a]; $a++; array_push( $accnts, $tmp ); } ?> Thanks in advance for any help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Session help...
Thanks for the responses. I ended up resolving this by fixing the form destination. I had hard coded a location in there, and did not realize this. Once I replaced this with the PHP variable everything magically started to work. My bad on that. Thanks again for the feedback though. -Original Message- From: Ow Mun Heng [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 11:13 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: RE: Session help... As mentioned previously in this list, $_SESSION and session_register, session_is_register, is not compatible with each other. Anyway, I used your idea as inspiration for my own code.. My code works.. Try to change From: if (!session_is_registered("valid_user")) { To: if ($_SESSION['valid_user']){ //your code } Cheers, Mun Heng, Ow H/M Engineering Western Digital M'sia DID : 03-7870 5168 -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 9:19 PM To: [EMAIL PROTECTED] Subject: Session help... Sorry for the slightly off-topic post... I have a couple pages that use a login page. If the user tries to bring up one of these pages without being logged in, then the pages redirects him to the login page. After successful login, the user is directed back to the page they were attempting to originally load. For some reason, this is not working and I have been looking at this off and on for two days now without much luck. The first section of code is the snippet that directs users to the login page, and the second snippet is the code from the login page that sends users back. First code snippet... session_start(); if ($sbcuid && $passwd) { mysql_select_db($database, $Prod); $query = "select * from contacts_sa " . "where sbcuid='$sbcuid' and passwd='$passwd'"; $result = mysql_query($query, $Prod) or die(mysql_error()); # $data = mysql_fetch_assoc($result); $test = mysql_num_rows($result); if (mysql_num_rows($result) >0 ) { $valid_user = $sbcuid; $_SESSION['valid_user'] = $sbcuid; } } if (!session_is_registered("valid_user")) { $return_url = $_SERVER['PHP_SELF']; $_SESSION['return_url'] = $return_url; header('Location: http://ldsa.sbcld.sbc.com/DW/sa_login.php'); exit(); } else { $sbcuid = $valid_user; } End of first snippet... Second code snippet... session_start(); if ($sbcuid && $passwd) { if (isset($_SESSION['return_url'])) { $link = $_SESSION['return_url']; } else { $link = 'oncall_log.php'; } mysql_select_db($database, $Prod); $query = "select * from contacts_sa " . "where sbcuid='$sbcuid' and passwd='$passwd'"; $result = mysql_query($query, $Prod) or die(mysql_error()); # $data = mysql_fetch_assoc($result); $test = mysql_num_rows($result); if (mysql_num_rows($result) >0 ) { $valid_user = $sbcuid; # session_register("valid_user"); $_SESSION['valid_user'] = $sbcuid; header("Location: http://".$_SERVER['HTTP_HOST'].$link); } } End of second snippet... Thanks in advance for any help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Session help...
Sorry for the slightly off-topic post... I have a couple pages that use a login page. If the user tries to bring up one of these pages without being logged in, then the pages redirects him to the login page. After successful login, the user is directed back to the page they were attempting to originally load. For some reason, this is not working and I have been looking at this off and on for two days now without much luck. The first section of code is the snippet that directs users to the login page, and the second snippet is the code from the login page that sends users back. First code snippet... session_start(); if ($sbcuid && $passwd) { mysql_select_db($database, $Prod); $query = "select * from contacts_sa " . "where sbcuid='$sbcuid' and passwd='$passwd'"; $result = mysql_query($query, $Prod) or die(mysql_error()); # $data = mysql_fetch_assoc($result); $test = mysql_num_rows($result); if (mysql_num_rows($result) >0 ) { $valid_user = $sbcuid; $_SESSION['valid_user'] = $sbcuid; } } if (!session_is_registered("valid_user")) { $return_url = $_SERVER['PHP_SELF']; $_SESSION['return_url'] = $return_url; header('Location: http://ldsa.sbcld.sbc.com/DW/sa_login.php'); exit(); } else { $sbcuid = $valid_user; } End of first snippet... Second code snippet... session_start(); if ($sbcuid && $passwd) { if (isset($_SESSION['return_url'])) { $link = $_SESSION['return_url']; } else { $link = 'oncall_log.php'; } mysql_select_db($database, $Prod); $query = "select * from contacts_sa " . "where sbcuid='$sbcuid' and passwd='$passwd'"; $result = mysql_query($query, $Prod) or die(mysql_error()); # $data = mysql_fetch_assoc($result); $test = mysql_num_rows($result); if (mysql_num_rows($result) >0 ) { $valid_user = $sbcuid; # session_register("valid_user"); $_SESSION['valid_user'] = $sbcuid; header("Location: http://".$_SERVER['HTTP_HOST'].$link); } } End of second snippet... Thanks in advance for any help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL Date insert
I actually think I know part of this answer... I don't think you need to define a variable to insert into your "date" field. Inserting an empty value into this filed will populate the field in the database with the current time, which it appears from your code is what you are trying to do here. Try changing the field name and give that a shot. I think I am actually right here though. Scott -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: Monday, July 28, 2003 1:19 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL Date insert Don't know about your date format, but you have named your table column DATE which is a reserved keyword in MySQL. Try naming that something different and see if you still get the error. > -Original Message- > From: Andrew D. Luebke [mailto:[EMAIL PROTECTED] > Sent: Monday, July 28, 2003 2:17 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] MySQL Date insert > > > Hello, > I have the following PHP code: > > $date = date("Y-m-d H:i:s"); > $result = mysql_query("INSERT INTO Boats (Make, > Model, Serial, > Stock, Extension, Cust_Name, Store, Date) VALUES > ('$make', '$model', '$serial', '$stock', > '$extension', > '$name', '$store', '$date'") > or die("Invalid query: " . mysql_error() . > ""); > > The problem is with the Date column. It is of type DATETIME. > I get an > error on the second line of the insert statement. I assume > I'm not putting > formatting the date-time variable correctly but I've tried > everything I can > think of, so any help is very much appreciated. Thanks. > > Andrew. > -- 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
[PHP-DB] 4.2.3 session login problem...
I have an application that is currently working fine under 4.1.2, and I am in the process of upgrading to 4.2.3. The problem is that after upgrading PHP the application login no longer works. Additionally, this same application works fine on another machine running 4.2.3. The only difference in the machines is that the working one uses PHP as a static module and the broken one uses PHP as a loadable module. Anyone run into this problem before? Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP Upgrade question...
I know there is another mailing list for installation questions, but I am hoping for some help here. I get enough mail from this list alone without having to join another. Anyway, while attempting to compile version 4.3.2 I am running into the following error during the configure... checking whether byte ordering is bigendian... configure: error: can not run tes t program while cross compiling At this point the configure simply dies. I have no idea on how to proceed from this. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Datetime help in an INSERT...
Thought I was on track, but stumped again... I am now getting a completely different error that I cannot figure out how it is related. I have passed the $td variable into the function and then get it back as a POST variable from a hidden field within the function. Here is the error I am now seeing; Unknown column 'sn4265' in 'field list' This one is really throwing me at the moment as the only place the value sn4265 is stored is in the $sbcuid variable. This $sbcuid variable is not a part of the INSERT that I am performing which I think is generating this error. I am guessing that you guys will need more info to help out with this now. Just let me know what you want. Thanks again. -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 10:07 AM To: NIPP, SCOTT V (SBCSI) Subject: Re: [PHP-DB] Datetime help in an INSERT... Just pass the variable to your function. If you're using a form, then make it a hidden element. ---John Holmes... - Original Message - From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> To: "'CPT John W. Holmes'" <[EMAIL PROTECTED]> Sent: Thursday, June 05, 2003 10:53 AM Subject: RE: [PHP-DB] Datetime help in an INSERT... > Do you think URL propagation is a better option than passing another > variable into the function and then passing it back out through a hidden > form element? Here was another snippet from another suggestion on this. > > a button is being pressed? > so it is processing a form? > if its in a form just pass along the value of $td via hidden input data... > > > > jay merritt > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > -Original Message- > From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 05, 2003 9:53 AM > To: NIPP, SCOTT V (SBCSI) > Subject: Re: [PHP-DB] Datetime help in an INSERT... > > > Propagating it in the URL is probably the best method. > > ---John Holmes... > > - Original Message - > From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> > To: "'CPT John W. Holmes'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Thursday, June 05, 2003 10:44 AM > Subject: RE: [PHP-DB] Datetime help in an INSERT... > > > > OK. I guess the next question would be what is the best option for > > performance? This portion of the app currently doesn't have any session > > functionality built in. I would be setting up the session for this sole > > purpose. I haven't worked with cookies yet. I suppose the URL method > might > > work, I have just never like it because I think it looks unclean, just > > personal preference there. > > As to the $td question... This is a variable that holds the userid > > of the "Technical Director" who is the account approver. This portion of > > the app is simply an approval mechanism to an account request system that > I > > am developing. The "TD" receives an e-mail with a link back to the > approval > > page to approve the requested accounts. This approval then fires off an > > e-mail to the SA responsible for user accounts to inform him to create the > > newly approved account. > > Well, thanks again for the feedback. Hopefully I can get this going > > pretty quick. We are currently planning on rolling this app out to our > user > > community on Monday. This is the last issue I have that I am aware of. > > > > -Original Message- > > From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] > > Sent: Thursday, June 05, 2003 9:06 AM > > To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] Datetime help in an INSERT... > > > > > > > I have actually discovered that the $td value is blank. The reason > > > appears to be that the page is reloading when a button is pushed, and > that > > > is when the $td value is being lost. My question now is, how do I keep > > the > > > $td value after the page is reloaded? I would rather keep the value > from > > > the original query than perform another database query to populate this > > > value yet again. Thanks yet again for the help. > > > > Stick it in the session? cookie? URL? What is $td? > > > > ---John Holmes... > > > > -- > > 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] Datetime help in an INSERT...
I just responded to a separate but similar suggestion. The form elements, including the buttons, are all generated in a separate function. I am currently passing about 5 variables into this function and I am a little hesitant to pass any others. I am not sure about complexity, performance, etc. in passing so many variables into a function. Please let me know if anyone has any ideas on this. I doubt that this is happening, but I would really like for the code to be as easily maintainable as possible. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 9:48 AM To: NIPP, SCOTT V (SBCSI) Subject: RE: [PHP-DB] Datetime help in an INSERT... a button is being pressed? so it is processing a form? if its in a form just pass along the value of $td via hidden input data... jay merritt [EMAIL PROTECTED] [EMAIL PROTECTED] > OK. I guess the next question would be what is the best option for > performance? This portion of the app currently doesn't have any session > functionality built in. I would be setting up the session for this sole > purpose. I haven't worked with cookies yet. I suppose the URL method might > work, I have just never like it because I think it looks unclean, just > personal preference there. > As to the $td question... This is a variable that holds the userid > of the "Technical Director" who is the account approver. This portion of > the app is simply an approval mechanism to an account request system that I > am developing. The "TD" receives an e-mail with a link back to the approval > page to approve the requested accounts. This approval then fires off an > e-mail to the SA responsible for user accounts to inform him to create the > newly approved account. > Well, thanks again for the feedback. Hopefully I can get this going > pretty quick. We are currently planning on rolling this app out to our user > community on Monday. This is the last issue I have that I am aware of. > > -Original Message- > From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] > Sent: Thursday, June 05, 2003 9:06 AM > To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Datetime help in an INSERT... > > > > I have actually discovered that the $td value is blank. The reason > > appears to be that the page is reloading when a button is pushed, and that > > is when the $td value is being lost. My question now is, how do I keep > the > > $td value after the page is reloaded? I would rather keep the value from > > the original query than perform another database query to populate this > > value yet again. Thanks yet again for the help. > > Stick it in the session? cookie? URL? What is $td? > > ---John Holmes... > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Datetime help in an INSERT...
Not sure exactly how I would implement this. Currently the reload URL is being provided via the "$PHP_SELF" variable. I like using this, but suppose I could change this if truly necessary. Also, the $td is not currently being passed into the function that generates the two buttons and hence defines the reload URL. I would rather not pass any additional variables into this function as I just feel this is "unclean". Thanks again for the idea, and any additional advice or suggestions are most appreciated. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 9:01 AM To: NIPP, SCOTT V (SBCSI) Subject: RE: [PHP-DB] Datetime help in an INSERT... You could alway place it as a "GET" echo ""; Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 "Pay It Forward" mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> http://accessingram.com <http://accessingram.com> > -Original Message- > From: NIPP, SCOTT V (SBCSI) [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] > Sent: Thursday, June 05, 2003 8:57 AM > To: 'CPT John W. Holmes'; [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP-DB] Datetime help in an INSERT... > > > I have actually discovered that the $td value is blank. > The reason > appears to be that the page is reloading when a button is > pushed, and that > is when the $td value is being lost. My question now is, how > do I keep the > $td value after the page is reloaded? I would rather keep > the value from > the original query than perform another database query to > populate this > value yet again. Thanks yet again for the help. > > -Original Message- > From: CPT John W. Holmes [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] > Sent: Wednesday, June 04, 2003 2:14 PM > To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Datetime help in an INSERT... > > > > > I am stumbling across something that I thought I have done before, > > > and I am not having any luck finding an example of this. > Basically, I > am > > > wanting to timestamp the date and time into new entries > in a simple > > database > > > table. The following section is the actual code for > this, and I cannot > > > figure out how to get the date/time stamp to populate > into the database. > > > Thanks in advance for the help. I suspect this is a very > simple fix. > > > > > > $denylog = "INSERT INTO deny (account, td, date) VALUES > ($tmp, $td, > > NOW())"; > > > $denylog_result = mysql_query($denylog, $Prod) or > die(mysql_error()); > > > > The error I am receiving is: > > > > You have an error in your SQL syntax near ' NOW())' at line 1 > > Are you sure $td has a value? If it's blank, you'd get an > error like that. > > ---John Holmes... > > -- > PHP Database Mailing List ( http://www.php.net/ <http://www.php.net/> ) > To unsubscribe, visit: http://www.php.net/unsub.php <http://www.php.net/unsub.php> >
RE: [PHP-DB] Datetime help in an INSERT...
OK. I guess the next question would be what is the best option for performance? This portion of the app currently doesn't have any session functionality built in. I would be setting up the session for this sole purpose. I haven't worked with cookies yet. I suppose the URL method might work, I have just never like it because I think it looks unclean, just personal preference there. As to the $td question... This is a variable that holds the userid of the "Technical Director" who is the account approver. This portion of the app is simply an approval mechanism to an account request system that I am developing. The "TD" receives an e-mail with a link back to the approval page to approve the requested accounts. This approval then fires off an e-mail to the SA responsible for user accounts to inform him to create the newly approved account. Well, thanks again for the feedback. Hopefully I can get this going pretty quick. We are currently planning on rolling this app out to our user community on Monday. This is the last issue I have that I am aware of. -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 9:06 AM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Datetime help in an INSERT... > I have actually discovered that the $td value is blank. The reason > appears to be that the page is reloading when a button is pushed, and that > is when the $td value is being lost. My question now is, how do I keep the > $td value after the page is reloaded? I would rather keep the value from > the original query than perform another database query to populate this > value yet again. Thanks yet again for the help. Stick it in the session? cookie? URL? What is $td? ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Datetime help in an INSERT...
I have actually discovered that the $td value is blank. The reason appears to be that the page is reloading when a button is pushed, and that is when the $td value is being lost. My question now is, how do I keep the $td value after the page is reloaded? I would rather keep the value from the original query than perform another database query to populate this value yet again. Thanks yet again for the help. -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 2:14 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Datetime help in an INSERT... > > I am stumbling across something that I thought I have done before, > > and I am not having any luck finding an example of this. Basically, I am > > wanting to timestamp the date and time into new entries in a simple > database > > table. The following section is the actual code for this, and I cannot > > figure out how to get the date/time stamp to populate into the database. > > Thanks in advance for the help. I suspect this is a very simple fix. > > > > $denylog = "INSERT INTO deny (account, td, date) VALUES ($tmp, $td, > NOW())"; > > $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error()); > > The error I am receiving is: > > You have an error in your SQL syntax near ' NOW())' at line 1 Are you sure $td has a value? If it's blank, you'd get an error like that. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Datetime help in an INSERT...
I think this is the real problem. Basically, the $td variable is defined intially, but upon clicking a button the page reloads itself and I believe that at this time it is losing the $td variable. I am not quite sure how to prevent this from occurring. Thanks again for all the help so far. -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 2:14 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Datetime help in an INSERT... > > I am stumbling across something that I thought I have done before, > > and I am not having any luck finding an example of this. Basically, I am > > wanting to timestamp the date and time into new entries in a simple > database > > table. The following section is the actual code for this, and I cannot > > figure out how to get the date/time stamp to populate into the database. > > Thanks in advance for the help. I suspect this is a very simple fix. > > > > $denylog = "INSERT INTO deny (account, td, date) VALUES ($tmp, $td, > NOW())"; > > $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error()); > > The error I am receiving is: > > You have an error in your SQL syntax near ' NOW())' at line 1 Are you sure $td has a value? If it's blank, you'd get an error like that. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Datetime help in an INSERT...
No, the field is a Datetime field rather than a Timestamp field. -Original Message- From: Rankin, Randy [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:59 PM To: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Datetime help in an INSERT... Correction ( I typed this in a hurry ) ... If you are using MySql and the date field is of type timestamp, you should _not_ have to insert anything using the query. It will update automatically when the record is inserted and/or updated. ie; $denylog = "INSERT INTO deny (account, td ) VALUES ($tmp, $td )"; Randy -Original Message- From: Rankin, Randy [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:56 PM To: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Datetime help in an INSERT... If you are using MySql with the date field is of type timestamp, you should have to insert anything using the query. It will update automatically when the record is inserted and/or updated. ie; $denylog = "INSERT INTO deny (account, td ) VALUES ($tmp, $td )"; Randy -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:47 PM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Datetime help in an INSERT... The error I am receiving is: You have an error in your SQL syntax near ' NOW())' at line 1 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:45 PM To: NIPP, SCOTT V (SBCSI) Subject: Re: [PHP-DB] Datetime help in an INSERT... what kind of error are you getting? > I am stumbling across something that I thought I have done before, > and I am not having any luck finding an example of this. Basically, I am > wanting to timestamp the date and time into new entries in a simple database > table. The following section is the actual code for this, and I cannot > figure out how to get the date/time stamp to populate into the database. > Thanks in advance for the help. I suspect this is a very simple fix. > > $denylog = "INSERT INTO deny (account, td, date) VALUES ($tmp, $td, NOW())"; > $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error()); > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Datetime help in an INSERT...
The error I am receiving is: You have an error in your SQL syntax near ' NOW())' at line 1 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:45 PM To: NIPP, SCOTT V (SBCSI) Subject: Re: [PHP-DB] Datetime help in an INSERT... what kind of error are you getting? > I am stumbling across something that I thought I have done before, > and I am not having any luck finding an example of this. Basically, I am > wanting to timestamp the date and time into new entries in a simple database > table. The following section is the actual code for this, and I cannot > figure out how to get the date/time stamp to populate into the database. > Thanks in advance for the help. I suspect this is a very simple fix. > > $denylog = "INSERT INTO deny (account, td, date) VALUES ($tmp, $td, NOW())"; > $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error()); > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.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
[PHP-DB] Datetime help in an INSERT...
I am stumbling across something that I thought I have done before, and I am not having any luck finding an example of this. Basically, I am wanting to timestamp the date and time into new entries in a simple database table. The following section is the actual code for this, and I cannot figure out how to get the date/time stamp to populate into the database. Thanks in advance for the help. I suspect this is a very simple fix. $denylog = "INSERT INTO deny (account, td, date) VALUES ($tmp, $td, NOW())"; $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error()); Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Empty display loop...
OK... I moved the form tag up before the table tag and added a tr tag to the beginning of the first line of display in the loop. No difference in the output. The first line of the output loop is still a completely empty line. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 6:30 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Empty display loop... Scott V Nipp <[EMAIL PROTECTED]> wrote: >I am working on a page that displays a line of information with a > checkbox at the end. I began by getting all of the information I wanted > displayed working properly and now I am adding the checkbox. Everything is > going find with the exception that all of a sudden with the checkbox code > in I am getting an empty line and checkbox at the beginning of the loop. I > cannot figure out where this is coming from. Please let me know where I > have gone wrong. Snipping a lot so you can see the problem: > > > > Your nesting is bad. Put the tag before the table. And you don't have a in your loop. Regards... Michael -- 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
[PHP-DB] Design question...
Anyone have an links to websites that offer good tutorials on web design? I am most interested in learning about templates and how to design these for use with PHP pages. I am using DreamWeaver MX as a development environment and would really like some help with DreamWeaver templates if anyone knows of any. Any good book recommendations would be most appreciated too. Thanks, and sorry for the slightly off topic post. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Empty display loop...
I am working on a page that displays a line of information with a checkbox at the end. I began by getting all of the information I wanted displayed working properly and now I am adding the checkbox. Everything is going find with the exception that all of a sudden with the checkbox code in I am getting an empty line and checkbox at the beginning of the loop. I cannot figure out where this is coming from. Please let me know where I have gone wrong. Requesting User ID System Name Primary Group Default Shell Request Time Completed ".$sbcuid.""; echo "".$sys.""; echo "".$list['gid'].""; echo "".$list['shell'].""; echo "".$list['atime'].""; echo ""; } while ($list = mysql_fetch_assoc($result)); ?> This is the code for all of the section dealing with the data display. The rest of the page is just some extra text and formatting, as well as the actual query code. Thanks again. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] compare php and perl
In response to your bullet points... 1. Built in mysql_ functions in php (does perl have this?) Perl does not have "built in" functions for MySQL or any other database. The Perl functions are all added through modules. This is somewhat annoying as compared to PHP in that if you want to keep things current, for the sake of keeping current, you have to update not only Perl, but the DBI module and the DBD driver module also. This is not to say that you need to keep all of these individual components "current". 2. Php may be faster. This is true, more so in some situations than in others. If you are dealing with Apache, you can compile Perl directly into the web server as a module. This is very efficient. However, my understanding is that getting Perl compiled into Apache is very tricky. 3. Embedded in html - no separate cgi directory needed. Yes. The PHP code can be directly imbedded into your HTML pages, but this is not always the best way to go. Often you will want to "extract" some information like database user IDs and passwords and store these in an alternate directory location for security reasons. You can also "include" other files with commonly used functions and these may or may not reside in your regular website structure. 4. Perl is more mature - more support - more depth to language. Yes. Perl is more mature in that it has most definitely been around much longer. In fact, PHP was derived from the authors frustrations with using certain aspects of Perl. That said, remember that Perl is NOT a web scripting language, it is a multipurpose scripting language that has been extended to handle web scripting. PHP on the other hand is a dedicated web scripting language. The key thing to remember is that Perl and PHP are both tools. Some people may prefer one tool over another for their own personal reasons. Pick the tool that best suits your purpose, and the one that you feel most comfortable with. If you have a LOT of Perl CGI experience, I don't know that PHP would really offer you a great reason to go out and learn another language (thought PHP is quite similar). I would recommend PHP if you are new to web scripting though, simply because this is exactly what PHP has been developed for from the ground up. Good luck, and I hope this helps. I am sure that some of the other experts, of which I am not one, will chime in to add their opinions and correct any of my errors. One other big advantage of PHP is this mailing list. The people in this list are quite knowledgeable and extremely helpful. I honestly have not found a group this supportive and responsive for my Perl scripting. (This last may sound like sucking up, but it's the honest truth.) -Original Message- From: Mignon Hunter [mailto:[EMAIL PROTECTED] Sent: Thursday, March 20, 2003 12:43 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] compare php and perl Can anyone out there compare these two using with mysql and web apps - What I can gather so far from my limited experience with both and a little googling: 1. Built in mysql_ functions in php (does perl have this?) 2. Php may be faster. 3. Embedded in html - no separate cgi directory needed. 4. Perl is more mature - more support - more depth to language. Thx -- Mignon Hunter Web Developer Toshiba International 713.466.0277 x 3461 -- 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
[PHP-DB] Login and link back...
I am curious about what you guys may have along the lines of best practices for forwarding from a URL to a login, and then jumping back to the original URL automatically. I have several separate applications that all need to utilize the same login mechanism. I want the user to be able to enter the URL for the application and if they are not logged in it redirects them to a login screen. I already have the sessions junk setup and understand all of that portion. I am mainly interested in how people are handling the return to a URL after successful login. I have done some research on this, and discovered the $HTTP_REFERER variable however the PHP site discourages using this. I have also thought of adding code to each page to export an "origin" variable to be passed to the login page such that it can be used to return the user. I thought of this method, but I am not real clear on how to manage this. Does anyone have any suggestion on implementing this, or another alternative that I have not touched on yet? Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Easy array question...
GREAT. This does the trick for me. Thanks a lot. I am now getting the output I want, so I can now feel confident about inputting this into the actual database. -Original Message- From: Katie Evans-Young [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 11:21 AM To: NIPP, SCOTT V (SBCSI) Subject: RE: [PHP-DB] Easy array question... It's actually putting the whole of the array $other as the first element of the array $other2. You're going to have to step through the array to copy it. foreach($other as $element) { $other2[] = $element; } //end foreach -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 11:10 AM To: '[EMAIL PROTECTED]'; 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Easy array question... Here is basically what I have and what I am getting... The section of code to copy and then process the copied array: $other2 = array(); array_push($other2, $other); foreach ($other2 as $test) { if ($test == "") { echo "NOTHING".""; } else { echo $test.""; } } Basically, what I want is if the array element is nothing, then output as a test NOTHING. If the array element has some value, then output as a test that value. Currently, from this code the output I am actually getting is: Array Thanks again. -Original Message- From: Jonathan Villa [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:58 AM To: [EMAIL PROTECTED]; NIPP, SCOTT V (SBCSI); 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Easy array question... Sorry, I just reread your post $array_copy = array(); array_push($array_copy, $original_array); echo $array_copy[0];//or whatever to test ---> Jonathan -Original Message- From: Jonathan Villa [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:56 AM To: 'NIPP, SCOTT V (SBCSI)'; 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Easy array question... $array_copy = array(); array_push($array_copy, $_SESSION['original_array']); echo $array_copy[0];//or whatever to test ---> Jonathan -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:43 AM To: 'Hutchins, Richard'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Easy array question... I don't think that is the case because I am able to access the original array in this same page without having to use the session variable reference. Won't hurt to give it a try though. Thanks for the feedback. -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:40 AM To: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Easy array question... Are you using: $array2 = $_SESSION["array1"]; Not sure that will do the trick, but it was my first inclination. Rich > -Original Message- > From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 12, 2003 11:37 AM > To: '[EMAIL PROTECTED]' > Subject: [PHP-DB] Easy array question... > > > I create an array on one page and then process it on > the next page > as I have registered the array as a session variable. I need > to basically > process one of these arrays twice, so I want to make a copy > of the array. > The question is how do I do this? I have tried the following: > > $array2 = $array1; > > This doesn't seem to do the trick for me. Is this > correct and I am > just missing something elsewhere, or is there another way to > copy an array? > Thanks. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.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 -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.445 / Virus Database: 250 - Release Date: 1/21/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.445 / Virus Database: 250 - Release Date: 1/21/2003 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Easy array question...
Here is basically what I have and what I am getting... The section of code to copy and then process the copied array: $other2 = array(); array_push($other2, $other); foreach ($other2 as $test) { if ($test == "") { echo "NOTHING".""; } else { echo $test.""; } } Basically, what I want is if the array element is nothing, then output as a test NOTHING. If the array element has some value, then output as a test that value. Currently, from this code the output I am actually getting is: Array Thanks again. -Original Message- From: Jonathan Villa [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:58 AM To: [EMAIL PROTECTED]; NIPP, SCOTT V (SBCSI); 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Easy array question... Sorry, I just reread your post $array_copy = array(); array_push($array_copy, $original_array); echo $array_copy[0];//or whatever to test ---> Jonathan -Original Message- From: Jonathan Villa [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:56 AM To: 'NIPP, SCOTT V (SBCSI)'; 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Easy array question... $array_copy = array(); array_push($array_copy, $_SESSION['original_array']); echo $array_copy[0];//or whatever to test ---> Jonathan -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:43 AM To: 'Hutchins, Richard'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Easy array question... I don't think that is the case because I am able to access the original array in this same page without having to use the session variable reference. Won't hurt to give it a try though. Thanks for the feedback. -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:40 AM To: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Easy array question... Are you using: $array2 = $_SESSION["array1"]; Not sure that will do the trick, but it was my first inclination. Rich > -Original Message- > From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 12, 2003 11:37 AM > To: '[EMAIL PROTECTED]' > Subject: [PHP-DB] Easy array question... > > > I create an array on one page and then process it on > the next page > as I have registered the array as a session variable. I need > to basically > process one of these arrays twice, so I want to make a copy > of the array. > The question is how do I do this? I have tried the following: > > $array2 = $array1; > > This doesn't seem to do the trick for me. Is this > correct and I am > just missing something elsewhere, or is there another way to > copy an array? > Thanks. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.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 -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Easy array question...
I don't think that is the case because I am able to access the original array in this same page without having to use the session variable reference. Won't hurt to give it a try though. Thanks for the feedback. -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:40 AM To: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Easy array question... Are you using: $array2 = $_SESSION["array1"]; Not sure that will do the trick, but it was my first inclination. Rich > -Original Message- > From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 12, 2003 11:37 AM > To: '[EMAIL PROTECTED]' > Subject: [PHP-DB] Easy array question... > > > I create an array on one page and then process it on > the next page > as I have registered the array as a session variable. I need > to basically > process one of these arrays twice, so I want to make a copy > of the array. > The question is how do I do this? I have tried the following: > > $array2 = $array1; > > This doesn't seem to do the trick for me. Is this > correct and I am > just missing something elsewhere, or is there another way to > copy an array? > Thanks. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Easy array question...
I create an array on one page and then process it on the next page as I have registered the array as a session variable. I need to basically process one of these arrays twice, so I want to make a copy of the array. The question is how do I do this? I have tried the following: $array2 = $array1; This doesn't seem to do the trick for me. Is this correct and I am just missing something elsewhere, or is there another way to copy an array? Thanks. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Stumped again...
OK... I think I understand what you are getting at here, but I don't think this actually addresses the problem that I am having. I have, in other places, the direct value successfully passing from one page to another. In this case, what I am lacking is the selected data actually getting populated into the array in the first place. -Original Message- From: Ben Walling [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2003 1:48 PM To: NIPP, SCOTT V (SBCSI) Cc: [EMAIL PROTECTED] Subject: RE: Stumped again... Your code: while($name = mysql_fetch_row($groups_tmp)) { $grp_list .= "$name[0]\n"; } should be changed to: while($name = mysql_fetch_row($groups_tmp)) { $grp_list .= "$name[0]\n"; } The value property of the option tag is actually what gets submitted to the next page. The text that immediately follows is what is displayed to the user. So, for this (HTML) code: Thing One Thing Two The user would see a list with: Thing One Thing Two The next page would get either 1 or 2 as the value for Test. -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2003 2:43 PM To: Ben Walling; '[EMAIL PROTECTED]' Subject: RE: Stumped again... I don't really understand this suggestion. Could someone possibly expound on this further? Maybe an example? Thanks. -Original Message- From: Ben Walling [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2003 12:19 PM To: NIPP, SCOTT V (SBCSI) Subject: Re: Stumped again... You need the value parameter for the option tags: First Second "Scott V Nipp" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > OK... I have once again thought of something cool to do, and can't > quite figure out how to make it happen. I am developing a user account > request system for work. Things are coming along nicely. The user logs > into the system, kind of, selects the systems that he wants to have accounts > added on, and then the next page is where the problems begin. Once the user > selects the systems, the next page lists the systems selected along with a > dropdown for "Default Shell" and another dropdown for "Primary Group" and a > small text box for "Other Group". The dropdowns are populating fine, and > everything is displaying on the screen as expected. The problem I am having > is that the selections don't seem to work. I have this page feed a final > page that also displays the selections as a result test. I am seeing the > system names, but no shell or group information. > Here are some pertinent portions of the code with comments: > > << Above code snipped >> > $shell_list = getEnumOptions('accounts','shell'); > $shell_tmp = "\n"; > $shell_tmp .= "Default Shell\n"; > foreach ($shell_list as $item) { > $shell_tmp .= "$item\n"; > } > $shell_tmp .= "\n"; > > mysql_select_db($database, $Prod); > $query_groups = "SELECT name FROM grps"; > $groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error()); > $grp_list = "\n"; > $grp_list .= "Primary Group\n"; > $grp_list .= "---\n"; > while($name = mysql_fetch_row($groups_tmp)) { > $grp_list .= "$name[0]\n"; > } > $grp_list .= "\n"; > << Code snipped >> > > This section of code creates the "Default Shell" dropdown list and > the "Primary Group" dropdown list. One of these lists is derived from the > ENUM values of the field, the other is derived from the values of a seperate > table. > > << Code snipped >> > > >while (isset($_POST['system'][$a])) { > echo " align=\"center\">".$_POST['system'][$a].""; > echo " align=\"center\">".$shell_tmp.""; > echo " align=\"center\">".$grp_list.""; > echo " name=\"other\" value=\"\" size=\"15\">"; > $tmp = $sbcuid."-".$_POST['system'][$a]; > $a++; > array_push( $accnts, $tmp ); > array_push( $shells, $shell ); > array_push( $grps, $grp ); > array_push( $others, $other ); > } > ?> > << Code snipped >> > > This section of code actually displays one line for each system > previously selected with additional input items for "Default Shell", > "Primary Group", and "Other Group". This code also creates arrays of the > systems, shells, groups, and
[PHP-DB] RE: Stumped again...
I don't really understand this suggestion. Could someone possibly expound on this further? Maybe an example? Thanks. -Original Message- From: Ben Walling [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2003 12:19 PM To: NIPP, SCOTT V (SBCSI) Subject: Re: Stumped again... You need the value parameter for the option tags: First Second "Scott V Nipp" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > OK... I have once again thought of something cool to do, and can't > quite figure out how to make it happen. I am developing a user account > request system for work. Things are coming along nicely. The user logs > into the system, kind of, selects the systems that he wants to have accounts > added on, and then the next page is where the problems begin. Once the user > selects the systems, the next page lists the systems selected along with a > dropdown for "Default Shell" and another dropdown for "Primary Group" and a > small text box for "Other Group". The dropdowns are populating fine, and > everything is displaying on the screen as expected. The problem I am having > is that the selections don't seem to work. I have this page feed a final > page that also displays the selections as a result test. I am seeing the > system names, but no shell or group information. > Here are some pertinent portions of the code with comments: > > << Above code snipped >> > $shell_list = getEnumOptions('accounts','shell'); > $shell_tmp = "\n"; > $shell_tmp .= "Default Shell\n"; > foreach ($shell_list as $item) { > $shell_tmp .= "$item\n"; > } > $shell_tmp .= "\n"; > > mysql_select_db($database, $Prod); > $query_groups = "SELECT name FROM grps"; > $groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error()); > $grp_list = "\n"; > $grp_list .= "Primary Group\n"; > $grp_list .= "---\n"; > while($name = mysql_fetch_row($groups_tmp)) { > $grp_list .= "$name[0]\n"; > } > $grp_list .= "\n"; > << Code snipped >> > > This section of code creates the "Default Shell" dropdown list and > the "Primary Group" dropdown list. One of these lists is derived from the > ENUM values of the field, the other is derived from the values of a seperate > table. > > << Code snipped >> > > >while (isset($_POST['system'][$a])) { > echo " align=\"center\">".$_POST['system'][$a].""; > echo " align=\"center\">".$shell_tmp.""; > echo " align=\"center\">".$grp_list.""; > echo " name=\"other\" value=\"\" size=\"15\">"; > $tmp = $sbcuid."-".$_POST['system'][$a]; > $a++; > array_push( $accnts, $tmp ); > array_push( $shells, $shell ); > array_push( $grps, $grp ); > array_push( $others, $other ); > } > ?> > << Code snipped >> > > This section of code actually displays one line for each system > previously selected with additional input items for "Default Shell", > "Primary Group", and "Other Group". This code also creates arrays of the > systems, shells, groups, and others which are passed onto the next page. > This system array is used to display the results as well as populate the > database, and the system array data is the only data actually being > displayed. I do not think that the data for the other arrays is actually > getting populated. > > << Code snipped >> >session_register("accnts", "shells", "grps", "others"); > ?> > > > > > > << Code snipped >> > > This section of code simply registers the arrays for use on the next > page. > > Thanks in advance for any help. Please let me know if you need any > other information to help figure out what is wrong with this. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.com > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Stumped again...
OK... I have once again thought of something cool to do, and can't quite figure out how to make it happen. I am developing a user account request system for work. Things are coming along nicely. The user logs into the system, kind of, selects the systems that he wants to have accounts added on, and then the next page is where the problems begin. Once the user selects the systems, the next page lists the systems selected along with a dropdown for "Default Shell" and another dropdown for "Primary Group" and a small text box for "Other Group". The dropdowns are populating fine, and everything is displaying on the screen as expected. The problem I am having is that the selections don't seem to work. I have this page feed a final page that also displays the selections as a result test. I am seeing the system names, but no shell or group information. Here are some pertinent portions of the code with comments: << Above code snipped >> $shell_list = getEnumOptions('accounts','shell'); $shell_tmp = "\n"; $shell_tmp .= "Default Shell\n"; foreach ($shell_list as $item) { $shell_tmp .= "$item\n"; } $shell_tmp .= "\n"; mysql_select_db($database, $Prod); $query_groups = "SELECT name FROM grps"; $groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error()); $grp_list = "\n"; $grp_list .= "Primary Group\n"; $grp_list .= "---\n"; while($name = mysql_fetch_row($groups_tmp)) { $grp_list .= "$name[0]\n"; } $grp_list .= "\n"; << Code snipped >> This section of code creates the "Default Shell" dropdown list and the "Primary Group" dropdown list. One of these lists is derived from the ENUM values of the field, the other is derived from the values of a seperate table. << Code snipped >> ".$_POST['system'][$a].""; echo "".$shell_tmp.""; echo "".$grp_list.""; echo ""; $tmp = $sbcuid."-".$_POST['system'][$a]; $a++; array_push( $accnts, $tmp ); array_push( $shells, $shell ); array_push( $grps, $grp ); array_push( $others, $other ); } ?> << Code snipped >> This section of code actually displays one line for each system previously selected with additional input items for "Default Shell", "Primary Group", and "Other Group". This code also creates arrays of the systems, shells, groups, and others which are passed onto the next page. This system array is used to display the results as well as populate the database, and the system array data is the only data actually being displayed. I do not think that the data for the other arrays is actually getting populated. << Code snipped >> << Code snipped >> This section of code simply registers the arrays for use on the next page. Thanks in advance for any help. Please let me know if you need any other information to help figure out what is wrong with this. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Query Help...
Thanks for all the advice, I thought it might have something to do with being a reserved word. I changed the table name from group to grps, and everything works fine now. -Original Message- From: Rob Bryant [mailto:[EMAIL PROTECTED] Sent: Monday, March 10, 2003 11:39 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Query Help... - Original Message - From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 10, 2003 9:23 AM Subject: [PHP-DB] Query Help... > I am having a lot of trouble with a query that works fine from a > basic SQL command line, but fails in my web script. Here is the portion of > code including the query: > > mysql_select_db($database, $Prod); > $query_groups = "SELECT name FROM group"; > $groups = mysql_query($query_groups, $Prod) or die(mysql_error()); > > Here is the error I am receiving: > > You have an error in your SQL syntax near '"group"' at line 1 > Have you tried using backticks in your query? E.g., $query_groups = "SELECT name FROM `group`"; -- rob -- 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
[PHP-DB] Query Help...
I am having a lot of trouble with a query that works fine from a basic SQL command line, but fails in my web script. Here is the portion of code including the query: mysql_select_db($database, $Prod); $query_groups = "SELECT name FROM group"; $groups = mysql_query($query_groups, $Prod) or die(mysql_error()); Here is the error I am receiving: You have an error in your SQL syntax near '"group"' at line 1 I am wondering if for some reason group is trying to be interperetted as the "GROUP BY" MySQL function? I am running PHP 4.2.3 against a MySQL DB on an Apache 1.3.27 server. Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Code for drop down lists
I would most definitely recommend pulling them from a DB table rather than hard coding these into a page. Here is a code snippet that I use to do this on one of my pages: mysql_select_db($Prod, $Prod); $query_systems = "SELECT Name FROM systems ORDER BY Name ASC"; $systems = mysql_query($query_systems, $Prod) or die(mysql_error()); # $row_systems = mysql_fetch_assoc($systems); $totalRows_systems = mysql_num_rows($systems); $sys_list = "\n"; $sys_list .= "System Name\n"; $sys_list .= "---\n"; while($name = mysql_fetch_row($systems)) { $sys_list .= "$name[0]\n"; } $sys_list .= "\n"; << snip...HTML portion below >> System Name: << snip >> I also do this with Enum field selections using the following function that someone passed on to me: function getEnumOptions($table, $field) { global $finalResult; $finalResult = array(); if (strlen(trim($table)) < 1) return false; $query = "show columns from $table"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)){ if ($field != $row["Field"]) continue; //check if enum type if (ereg('enum.(.*).', $row['Type'], $match)) { $opts = explode(',', $match[1]); foreach ($opts as $item) $finalResult[] = substr($item, 1, strlen($item)-2); } else return false; } return $finalResult; You can then use code similar to the first example to create your dropdown list from Enum field values. I hope this helps. -Original Message- From: Roland Perez [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 11, 2003 11:03 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Code for drop down lists I am a novice to PHP and am trying toget a survey with drop down lists. I am stuck as to if I should connect to the DB (MySQL DB) to get the values from a table or do I imbed them in the php file? Thanks for any help in advance. Roland Perez [EMAIL PROTECTED] -- 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] Weird PHP behavior...
It turned out to be just a simple file permissions issue. -Original Message- From: Mohammad Saad [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 12:31 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Weird PHP behavior... Check path on this require require_once("/www/DW/prod.lib.php"); something is wrong with this - Original Message - From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, February 06, 2003 10:17 PM Subject: RE: [PHP-DB] Weird PHP behavior... > Here is the working code... > > require_once("/www/DW/prod.lib.php"); > $hr = date("G"); > if ($hr > 7) { > $sql = mysql("Calendar2","SELECT B.Title, UNIX_TIMESTAMP(A.StartDate), > UNIX_TIMESTAMP(A.StopDate) FROM `phpCalendar_Details` AS B, > `phpCalendar_Daily` AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID > AND CURDATE() BETWEEN A.StartDate AND A.StopDate") or die(mysql_error()); > $mid = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); > } else { > $sql = mysql("Calendar2","SELECT B.Title, UNIX_TIMESTAMP(A.StartDate), > UNIX_TIMESTAMP(A.StopDate) FROM `phpCalendar_Details` AS B, > `phpCalendar_Daily` AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID > AND CURDATE()-2 BETWEEN A.StartDate AND A.StopDate") or die(mysql_error()); > $sql2 = mysql("Calendar2","SELECT B.Title FROM `phpCalendar_Details` AS > B, `phpCalendar_Daily` AS A WHERE A.CalendarDetailsID = > B.CalendarDetailsID AND CURDATE() BETWEEN A.StartDate AND A.StopDate") or > die(mysql_error()); > $res2 = mysql_fetch_row($sql2); > $new = $res2[0]; > $mid = mktime (0,0,0,date("m") ,date("d")-2,date("Y")); > } > $res = mysql_fetch_row($sql); > $sa = $res[0]; > $start = $res[1]; > $stop = $res[2]; > $day1 = date("l", $start); > $date1 = date("jS", $start); > $month1 = date("F", $start); > $day3 = date("l", $stop); > $date3 = date("jS", $stop); > $month3 = date("F", $stop); > if ($day1 == "Friday") { > $day2 = date("l", $mid); > $date2 = date("jS", $mid); > $month2 = date("F", $mid); > if ($month1 != $month2) { >$line2 = "$month1 $date1, $month2 $date2 and $date3"; > } elseif ($month2 != $month3) { >$line2 = "$month1 $date1 and $date2, and $month3 $date3"; > } else { >$line2 = "$month1 $date1, $date2, and $date3"; > } > $line1 = "ONCALL SA for Friday, Saturday, and Sunday"; > } else { > if ($month1 != $month3) { >$line2 = "$month1 $date1 and $date3"; > } else { >$line2 = "$month1 $date1 and $month3 $date3"; > } > $line1 = "ONCALL SA for $day1 and $day3"; > } > > mysql_select_db($database, $Prod); > $query = "SELECT name, pager FROM contacts_sa WHERE sbcuid='$sa'"; > $said = mysql_query($query, $Prod) or die(mysql_error()); > $row = mysql_fetch_row($said); > $name = $row[0]; > $pager = $row[1]; > > if ($date3 == date("jS", $stop) && $hr < 8) { > $query2 = "SELECT name FROM contacts_sa WHERE sbcuid='$new'"; > $said2 = mysql_query($query2, $Prod) or die(mysql_error()); > $row2 = mysql_fetch_row($said2); > $name2 = $row2[0]; > $line4 = "Please be aware the On-Call turnover occurs at 8AM. The > oncoming SA after 8AM will be $name2."; > } else { > $line4 = "$name begins On-Call at 8AM on $day1."; > } > ?> > > > Untitled Document > > > > > CALL 214-741-6961 > FOR CURRENT ONCALL STATUS. > > > () >(pager lang="en-us"> > ) > > > > > > The portion of PHP code prior to the HTML is inserted at the top of the > file in the broken page. Here is how the HTML portion of the PHP is > inserted... > > > > > >id="fpAnimOu > tflyBottomRightFP1" style="position: relative !important" > onclick="dynAnimOut(th > is)" language="Javascript1.2"> > CALL 214-741-6961 > FOR CURRENT ONCALL STATUS. > > > () > (pager lang="en-us > "> > ) > > > For escalation procedures, > click here. > For restore requests call the >
RE: [PHP-DB] Weird PHP behavior...
Here is the working code... 7) { $sql = mysql("Calendar2","SELECT B.Title, UNIX_TIMESTAMP(A.StartDate), UNIX_TIMESTAMP(A.StopDate) FROM `phpCalendar_Details` AS B, `phpCalendar_Daily` AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID AND CURDATE() BETWEEN A.StartDate AND A.StopDate") or die(mysql_error()); $mid = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); } else { $sql = mysql("Calendar2","SELECT B.Title, UNIX_TIMESTAMP(A.StartDate), UNIX_TIMESTAMP(A.StopDate) FROM `phpCalendar_Details` AS B, `phpCalendar_Daily` AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID AND CURDATE()-2 BETWEEN A.StartDate AND A.StopDate") or die(mysql_error()); $sql2 = mysql("Calendar2","SELECT B.Title FROM `phpCalendar_Details` AS B, `phpCalendar_Daily` AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID AND CURDATE() BETWEEN A.StartDate AND A.StopDate") or die(mysql_error()); $res2 = mysql_fetch_row($sql2); $new = $res2[0]; $mid = mktime (0,0,0,date("m") ,date("d")-2,date("Y")); } $res = mysql_fetch_row($sql); $sa = $res[0]; $start = $res[1]; $stop = $res[2]; $day1 = date("l", $start); $date1 = date("jS", $start); $month1 = date("F", $start); $day3 = date("l", $stop); $date3 = date("jS", $stop); $month3 = date("F", $stop); if ($day1 == "Friday") { $day2 = date("l", $mid); $date2 = date("jS", $mid); $month2 = date("F", $mid); if ($month1 != $month2) { $line2 = "$month1 $date1, $month2 $date2 and $date3"; } elseif ($month2 != $month3) { $line2 = "$month1 $date1 and $date2, and $month3 $date3"; } else { $line2 = "$month1 $date1, $date2, and $date3"; } $line1 = "ONCALL SA for Friday, Saturday, and Sunday"; } else { if ($month1 != $month3) { $line2 = "$month1 $date1 and $date3"; } else { $line2 = "$month1 $date1 and $month3 $date3"; } $line1 = "ONCALL SA for $day1 and $day3"; } mysql_select_db($database, $Prod); $query = "SELECT name, pager FROM contacts_sa WHERE sbcuid='$sa'"; $said = mysql_query($query, $Prod) or die(mysql_error()); $row = mysql_fetch_row($said); $name = $row[0]; $pager = $row[1]; if ($date3 == date("jS", $stop) && $hr < 8) { $query2 = "SELECT name FROM contacts_sa WHERE sbcuid='$new'"; $said2 = mysql_query($query2, $Prod) or die(mysql_error()); $row2 = mysql_fetch_row($said2); $name2 = $row2[0]; $line4 = "Please be aware the On-Call turnover occurs at 8AM. The oncoming SA after 8AM will be $name2."; } else { $line4 = "$name begins On-Call at 8AM on $day1."; } ?> Untitled Document CALL 214-741-6961 FOR CURRENT ONCALL STATUS. () (pager ) The portion of PHP code prior to the HTML is inserted at the top of the file in the broken page. Here is how the HTML portion of the PHP is inserted... CALL 214-741-6961 FOR CURRENT ONCALL STATUS. () (pager ) For escalation procedures, click here. For restore requests call the Help Desk <...snip> -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 11:09 AM To: NIPP, SCOTT V (SBCSI) Subject: RE: [PHP-DB] Weird PHP behavior... well show the working code and then show just a portion of the code that is broken specifically where you are trying to inslucde the working code. K. "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> 02/06/2003 12:09 PM To:"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> cc: Subject:RE: [PHP-DB] Weird PHP behavior... I can show the code, but do I show the working code? If I show the broken code, it is REALLY long. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 11:06 AM To: NIPP, SCOTT V (SBCSI) Subject: Re: [PHP-DB] Weird PHP behavior... It might help if you showed the code or at least part of it to help track down your problem. khris "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> 02/06/2003 12:05 PM To:"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> cc: Subject:[PHP-DB] Weird PHP behavior... I developed some dynamic content for a larger web page, and once I pasted the code into the appropriate area of the page I am seeing the strangest error. Here is the
[PHP-DB] Weird PHP behavior...
I developed some dynamic content for a larger web page, and once I pasted the code into the appropriate area of the page I am seeing the strangest error. Here is the error: Warning: Failed opening '/www/DW/index1.htm' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0 I have tried this on 2 different servers running 2 different versions of PHP, 4.1.2 and 4.2.3. The code was developed and tested in a blank page and then inserted into a much larger page developed in FrontPage 2002. Any ideas? Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] A little JOIN help please...
Thanks... I was able to figure it out using what my book calls the old method. Here is what ended up working for me: SELECT B.Title FROM `phpCalendar_Details` AS B, `phpCalendar_Daily` AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID AND CURDATE( ) BETWEEN A.StartDate AND A.StopDate -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 1:36 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] A little JOIN help please... > SELECT 'A.Title' > FROM `phpCalendar_Daily` AS 'B' > JOIN 'phpCalendar_Details' AS 'A' ON 'A.CalendarDetailsID' = > 'B.CalendarDetailsID' > WHERE CURDATE( ) > BETWEEN 'B.StartDate' AND 'B.StopDate' Take out all of those quotes! You're making strings out of everything. WHERE CURDATE() BETWEEN 'string' AND 'anotherstring' etc... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] A little JOIN help please...
This is more of an SQL question, but I am not sure where else to turn for help. I am trying a JOIN, for the first time ever, and it is NOT working for me. The following is what I am attempting; SELECT 'A.Title' FROM `phpCalendar_Daily` AS 'B' JOIN 'phpCalendar_Details' AS 'A' ON 'A.CalendarDetailsID' = 'B.CalendarDetailsID' WHERE CURDATE( ) BETWEEN 'B.StartDate' AND 'B.StopDate' This is simply in a SQL command window in phpMyAdmin, and it is returning an error. I have tried messing around with the quotes, and everything else I can think of. Someone please let me know what I am doing wrong. Thanks. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] matching data from one table with another and displaying results?
I have a JOIN that is not working, and figured I would piggie-back on this thread to see if someone could give me a quick answer... Here is the JOIN syntax. This is my very first attempt at a JOIN statement, so I may be doing something blatantly wrong here. SELECT 'A.Title' FROM `phpCalendar_Daily` AS 'B' JOIN 'phpCalendar_Details' AS 'A' ON 'B.CalendarDetailsID' = 'A.CalendarDetailsID' WHERE CURDATE( ) BETWEEN 'StartDate' AND 'StopDate' I am attempting this from the SQL window of phpMyAdmin, so this is not embedded somewhere in a script and failing. Thanks in advance. -Original Message- From: SELPH,JASON (HP-Richardson,ex1) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:59 AM To: Aaron Wolski; [EMAIL PROTECTED] Subject: RE: [PHP-DB] matching data from one table with another and displa ying results? Seek out LEFT JOIN on mysql web site, thats what you want. Cheers Jason -Original Message- From: Aaron Wolski [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:43 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] matching data from one table with another and displaying results? Hi All, Having a problem figuring out the logic of something here and hoping someone can point me in the right direction. I have 2 tables. First table holds a listing of all Provinces and States. Here a brief of what it looks like: value label AB Alberta BC British Columbia MB Manitobia NF Newfoundland NT Northwest Territories NS Nova Scotia Second Table is an OrderTable which holds all order and customer info including the province/state. The province/state is dumped from the "value" column of the ProvinceTable. Meaning.. an order record would show the province as "AB" or "NS" instead of "Alberta" or "Nova Scotia". I am creating an order report and in this report I want to display the LABEL name of the Province/State that relates to an the province column in the OrderTable. I could simply just display all provinces/states from the ProvinceTable but then there would be entries for selection that had NO orders. Any idea on this? Thanks guys! Aaron -- 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] Date Range Question...
WOW... I have never even heard of BETWEEN before. How does this look to you? SELECT StartDate, StopDate, LocationID FROM phpCalendar_Daily WHERE CURDATE() BETWEEN StopDate AND StopDate Would the query work like this? This would mean I don't even have to care about the difference of 2 or 3 days? -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 04, 2003 10:04 AM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Date Range Question... > I am working on an app that needs to post information to a website > based on date. The tricky part for me is that the date is a range that > spans either 2 or 3 days. I want the web page to dynamically populate this > information based on a query. The query will look something like this: > mysql("Calendar2","SELECT StartDate, StopDate, LocationID FROM > phpCalendar_Daily WHERE StartDate=CURDATE() ") > > My question is say for example the StartDate is actually Jan. 1. > The page is accessed on Jan. 2 or Jan. 3... The StartDate for the next > entry is Jan. 4. How do I write this query to select the proper entry? In > doing some research, it appears that a MySQL "SELECT CASE" might do the > trick, but I have never used this before. The other option I can envision > is using PHP to handle the login and simply running the query, testing the > result, if NULL, run the query again with CURDATE(-1). > Any hints, ideas, or suggestions would be most appreciated. Thanks > in advance. If I understand you correctly, I think you could use something like this: SELECT StartDate, StopDate, LocationID FROM phpCalendar_Daily WHERE StartDate BETWEEN CURDATE() AND CURDATE() - INTERVAL $x DAY Where $x is 2 or 3, depending on your case. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date Range Question...
I am working on an app that needs to post information to a website based on date. The tricky part for me is that the date is a range that spans either 2 or 3 days. I want the web page to dynamically populate this information based on a query. The query will look something like this: mysql("Calendar2","SELECT StartDate, StopDate, LocationID FROM phpCalendar_Daily WHERE StartDate=CURDATE() ") My question is say for example the StartDate is actually Jan. 1. The page is accessed on Jan. 2 or Jan. 3... The StartDate for the next entry is Jan. 4. How do I write this query to select the proper entry? In doing some research, it appears that a MySQL "SELECT CASE" might do the trick, but I have never used this before. The other option I can envision is using PHP to handle the login and simply running the query, testing the result, if NULL, run the query again with CURDATE(-1). Any hints, ideas, or suggestions would be most appreciated. Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Duplicate keys...
Thanks once again. I finally figured this out late yesterday. I have no idea as to why whoever wrote this calendar to begin with did it this way. On suggestion I have for anyone looking at a calendar system to use or modify is to absolutely NOT use phpCommunityCalendar. This is a very poorly coded piece of software, and if I as a relative PHP newbie know this, it is really bad. -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 15, 2003 10:07 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: RE: [PHP-DB] Duplicate keys... > OK, I cannot figure out why I keep getting errors about "Duplicate > entry for key 1". Someone please come to my rescue here as this is truly > kicking my but. You have a key or unique column in your table that you're trying to insert a duplicate value into. > if ($dateDiff == 2) { > mysql("$DBName","INSERT INTO phpCalendar_Details VALUES ( > '$said','Comp day for weekend > On-Call','','','','','','','','','',2,'$CalendarDetailsID')") or > die(mysql_error()); > > mysql("$DBName","UPDATE Balances SET CompEarned=CompEarned+8, > CompTaken=CompTaken+8 WHERE said='$said'") or die(mysql_error()); > $result = mysql("$DBName","SELECT LAST_INSERT_ID() FROM > phpCalendar_Details") or die(mysql_error()); > while ($row = mysql_fetch_row($result)) { > $CalendarDetailsID = $row[0]; > } > mysql("$DBName","INSERT INTO Log VALUES( > '$entryid','$said','Comp',DATE_ADD('$StopDate',INTERVAL 1 > DAY),'Y','','Awarded for weekend On-Call','8','$CalendarDetailsID')") or > die(mysql_error()); > > mysql("$DBName","INSERT INTO phpCalendar_Daily VALUES( > DATE_ADD('$StopDate',INTERVAL 1 DAY),'',1,2,'$CalendarDetailsID')") > or die(mysql_error()); > } > > if ($dateDiff < 0) { > commonHeader($glbl_SiteTitle); > echo "Your END DATE COMES BEFORE YOUR START > DATE. Please complete the form below.\n\n"; > > } elseif ($Stop != 1) { > > if ($CalendarDetailsID) { > $CalendarDetailsID = $CalendarDetailsID + 1; > } else { > $result = mysql("$DBName","SELECT LAST_INSERT_ID() FROM > phpCalendar_Details") or die(mysql_error()); > while ($row = mysql_fetch_row($result)) { > $CalendarDetailsID = $row[0]; > } > } > > mysql("$DBName","INSERT INTO phpCalendar_Details VALUES ( > '$said','On-Call for $StartDate to > $StopDate','','','','','','','','','',1,'$CalendarDetailsID')") or > die(mysql_error()); > > mysql("$DBName","INSERT INTO phpCalendar_Daily VALUES( > '$StartDate','$StopDate','1','1','$CalendarDetailsID')") or > die(mysql_error()); > > This is the only place in the script that is attempting to enter > data into the CalendarDetailsID field. This is the auto_increment field > that is having problems, I think. The other strange part of this is that > thedata in the auto_increment field has two separate ranges (10 - 40 with > gaps, and 70 - 78 with gaps). I have been doing a lot of adding and > removing of data to test during development, but I thought an > auto_increment > field would still track and deal with this correctly. If you're trying to insert a number into an auto_increment field that's already there, you'll get this error. You should always insert a NULL value into an auto_increment column so MySQL will handle giving it the number itself. Also, don't worry about the gaps. They are irrelevant. If the gaps matter to your program, then you are coding incorrectly. The auto_increment column is there _only_ to provide a unique identifier for each row and nothing else. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Send mail with a file
Under Unix I don't know that this is possible, but hopefully someone else will know of a way. I would love to be able to e-mail some Excel files that I generate with a Perl cron job, but there does not appear to be any practical way to do this in Unix. -Original Message- From: Bruno Pereira [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 16, 2003 3:47 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] Send mail with a file How can i insert a file on a mail, with the command "mail()"? It is possible? Cumprimentos Bruno Pereira [EMAIL PROTECTED] -Original Message- From: Bruno Pereira [mailto:[EMAIL PROTECTED]] Sent: quarta-feira, 15 de Janeiro de 2003 14:48 Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Concatenate two strings How can i join two strings. My code is something like: $valor1="bruno"; $valor2="Pereira"; $valor=$valor1 + " " + $valor2 Can someone help me. Thanks. Cumprimentos Bruno Pereira [EMAIL PROTECTED] -- 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
[PHP-DB] Duplicate keys...
OK, I cannot figure out why I keep getting errors about "Duplicate entry for key 1". Someone please come to my rescue here as this is truly kicking my but. if ($dateDiff == 2) { mysql("$DBName","INSERT INTO phpCalendar_Details VALUES ( '$said','Comp day for weekend On-Call','','','','','','','','','',2,'$CalendarDetailsID')") or die(mysql_error()); mysql("$DBName","UPDATE Balances SET CompEarned=CompEarned+8, CompTaken=CompTaken+8 WHERE said='$said'") or die(mysql_error()); $result = mysql("$DBName","SELECT LAST_INSERT_ID() FROM phpCalendar_Details") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; } mysql("$DBName","INSERT INTO Log VALUES( '$entryid','$said','Comp',DATE_ADD('$StopDate',INTERVAL 1 DAY),'Y','','Awarded for weekend On-Call','8','$CalendarDetailsID')") or die(mysql_error()); mysql("$DBName","INSERT INTO phpCalendar_Daily VALUES( DATE_ADD('$StopDate',INTERVAL 1 DAY),'',1,2,'$CalendarDetailsID')") or die(mysql_error()); } if ($dateDiff < 0) { commonHeader($glbl_SiteTitle); echo "Your END DATE COMES BEFORE YOUR START DATE. Please complete the form below.\n\n"; } elseif ($Stop != 1) { if ($CalendarDetailsID) { $CalendarDetailsID = $CalendarDetailsID + 1; } else { $result = mysql("$DBName","SELECT LAST_INSERT_ID() FROM phpCalendar_Details") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; } } mysql("$DBName","INSERT INTO phpCalendar_Details VALUES ( '$said','On-Call for $StartDate to $StopDate','','','','','','','','','',1,'$CalendarDetailsID')") or die(mysql_error()); mysql("$DBName","INSERT INTO phpCalendar_Daily VALUES( '$StartDate','$StopDate','1','1','$CalendarDetailsID')") or die(mysql_error()); This is the only place in the script that is attempting to enter data into the CalendarDetailsID field. This is the auto_increment field that is having problems, I think. The other strange part of this is that thedata in the auto_increment field has two separate ranges (10 - 40 with gaps, and 70 - 78 with gaps). I have been doing a lot of adding and removing of data to test during development, but I thought an auto_increment field would still track and deal with this correctly. Thank again for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Date math functions...
Actually this is generating another error. Now, without the single quotes I am getting the following error: Column 'StartDate' cannot be null It looks like for some reason the DATE_ADD is returning a NULL value. Any more ideas? -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 15, 2003 10:32 AM To: 1LT John W. Holmes; NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Date math functions... > [snip] > > if ($dateDiff == 3) { > > mysql("$DBName","UPDATE Balances SET CompEarned=CompTaken+8 WHERE > > said='$said'") or die(mysql_error()); > > mysql("$DBName","INSERT INTO Log VALUES('DATE_ADD($StopDate, > > INTERVAL 1 DAY','',1,2,'$CalendarDetailsID')") or die(mysql_error()); > > > > My big question is about using the "DATE_ADD" MySQL function inside > > the INSERT statement. Is this allowed? If it is allowed, is it a bad > idea > > for some reason? Is there a better way of doing this? Thanks in advance. > > Sure, that's allowed. You have $StopDate in PHP, so you could do it with > some math in PHP, also, but then you'd have to worry about the end of > months, years, etc, whereas DATE_ADD will do this for you. > > ---John Holmes... Wait... just noticed your syntax error. Don't enclose the function in single quotes, otherwise you're trying to insert a string. Should be: ... VALUES (DATE_ADD($StopDate,INTERVAL 1 DAY), ... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Date math functions...
Thanks. I was noticing that it was not working. Let me give this a try and see how things go. -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 15, 2003 10:32 AM To: 1LT John W. Holmes; NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Date math functions... > [snip] > > if ($dateDiff == 3) { > > mysql("$DBName","UPDATE Balances SET CompEarned=CompTaken+8 WHERE > > said='$said'") or die(mysql_error()); > > mysql("$DBName","INSERT INTO Log VALUES('DATE_ADD($StopDate, > > INTERVAL 1 DAY','',1,2,'$CalendarDetailsID')") or die(mysql_error()); > > > > My big question is about using the "DATE_ADD" MySQL function inside > > the INSERT statement. Is this allowed? If it is allowed, is it a bad > idea > > for some reason? Is there a better way of doing this? Thanks in advance. > > Sure, that's allowed. You have $StopDate in PHP, so you could do it with > some math in PHP, also, but then you'd have to worry about the end of > months, years, etc, whereas DATE_ADD will do this for you. > > ---John Holmes... Wait... just noticed your syntax error. Don't enclose the function in single quotes, otherwise you're trying to insert a string. Should be: ... VALUES (DATE_ADD($StopDate,INTERVAL 1 DAY), ... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date math functions...
I have a question about using DATE_ADD in MySQL. I am not sure if this is the most effective way of dealing with this problem so I am asking here. The situation is that I am working on modifying a calendar system for our use. Our On-Call rotation is such that when someone is On-Call over the weekend they automatically get Monday off. I have created a page to simplify inputting the On-Call schedule into the calendar system, and now I want the Monday off to be automagically scheduled when a weekend On-Call is entered. The way that I see for doing this is adding 1 day to the end date of the weekend On-Call and using that as the input for the day off scheduling. Here is a bit of what I have at this point... if ($DailyStopYear) { $result = mysql("$DBName","SELECT (TO_DAYS('$StopDate') - TO_DAYS('$StartDate'))") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $dateDiff = $row[0]; } } else { $dateDiff = 0; } if ($dateDiff == 3) { mysql("$DBName","UPDATE Balances SET CompEarned=CompTaken+8 WHERE said='$said'") or die(mysql_error()); mysql("$DBName","INSERT INTO Log VALUES('DATE_ADD($StopDate, INTERVAL 1 DAY','',1,2,'$CalendarDetailsID')") or die(mysql_error()); My big question is about using the "DATE_ADD" MySQL function inside the INSERT statement. Is this allowed? If it is allowed, is it a bad idea for some reason? Is there a better way of doing this? Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Stumped...
The source of my problem is that in my INSERT statement I was trying to enter a new row of data and not having data for every column. Basically, my table had 7 columns but in my INSERT I only had 5 columns of data to be put in. -Original Message- From: Matthew Moldvan [mailto:[EMAIL PROTECTED]] Sent: Friday, January 10, 2003 10:06 AM To: NIPP, SCOTT V (SBCSI); 'Hutchins, Richard'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Stumped... Out of curiosity, what was the solution? It's always good to learn from someone else's mistakes ... :) Regards, Matthew Moldvan --- System Administrator Trilogy International, Inc http://www.trilogyintl.com/ecommerce/ --- -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 1:42 PM To: 'Hutchins, Richard'; '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Stumped... Nevermind. I just stumbled across the nature of my problem on Deja.com. Thanks anyway and sorry for bugging you guys about what really was a simple problem. -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 12:36 PM To: NIPP, SCOTT V (SBCSI); '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Stumped... Post your SQL statement. > -Original Message- > From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 09, 2003 1:37 PM > To: '[EMAIL PROTECTED]' > Subject: [PHP-DB] Stumped... > > > I am getting an error that is proving very difficult to > isolate and > was hoping for help. The error is: Column count doesn't > match value count > at row 1. I would include the code, but it is about 350 > lines, and I am not > sure where to narrow it down at. Any ideas? Thanks. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Stumped...
Nevermind. I just stumbled across the nature of my problem on Deja.com. Thanks anyway and sorry for bugging you guys about what really was a simple problem. -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 12:36 PM To: NIPP, SCOTT V (SBCSI); '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Stumped... Post your SQL statement. > -Original Message- > From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 09, 2003 1:37 PM > To: '[EMAIL PROTECTED]' > Subject: [PHP-DB] Stumped... > > > I am getting an error that is proving very difficult to > isolate and > was hoping for help. The error is: Column count doesn't > match value count > at row 1. I would include the code, but it is about 350 > lines, and I am not > sure where to narrow it down at. Any ideas? Thanks. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.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
[PHP-DB] Stumped...
I am getting an error that is proving very difficult to isolate and was hoping for help. The error is: Column count doesn't match value count at row 1. I would include the code, but it is about 350 lines, and I am not sure where to narrow it down at. Any ideas? Thanks. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Mouseover question...
You are correct. I have found the JS that the dLink references. Here it is if there are any JS experts out there who want to take a gander. // // expandItems() calls a javascript that replaces one string of // // text with another on mouseover (IE only) // // function expandItems() { ?> <!-- var no=0; function mover(object,text) { eval(object + '.innerText = text'); } function mout(object,text) { eval(object + '.innerText = text'); } function dLink(href,text,txet) { document.write('<a href="'+href+'" onMouseOut="mout(\'link'+no+'\',\''+txet+'\')" onMouseOver="mover(\'link'+no+'\',\''+text+'\')" id="link'+no+'" onClick=return(openSmallWindow(\''+href+'\'))>'+txet+'<\/a>'); no+=1; } //--> Thanks again. -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 11:56 AM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: RE: [PHP-DB] Mouseover question... > OK, this isn't really a DB question, but it is definitely a PHP > question. I am working on customizing a calendar application for my > group's > use and noticed that there is a function that has to do with a mouseover > effect. The problem is that this mouseover does not appear to do > anything. > Could one of you gurus take a look at this function and see if you can > spot > anything wrong? Thanks. > > > // getEvent() displays events on the calendar for IE browsers // > // This distinction is made because IE is currently the only // > // browser on which the javascript mouseover effects work.// > > function getEventIE($ID, $LinkTitle, $AbbrTitle, $Date) { > $LinkTitle =ereg_replace("'","’",$LinkTitle); > $AbbrTitle =ereg_replace("'","’",$AbbrTitle); > echo " > dLink('./event.php?ID=$ID&Date=$Date','$LinkTitle','$AbbrTitle'); > \n\n"; > } > > This function is called from another page as such: > > if ($ver >= 4) { > echo "\n"; > getEventIE($CDCI, $CDTi, "$showName", $queryDate); That function has nothing to do with mouseovers. Maybe the dLink() function does, but this is all user functions, so there's no telling what they do. Mouseovers have nothing to do with PHP. PHP can simply echo the javascript code required to create the mouseover effect. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Mouseover question...
OK, this isn't really a DB question, but it is definitely a PHP question. I am working on customizing a calendar application for my group's use and noticed that there is a function that has to do with a mouseover effect. The problem is that this mouseover does not appear to do anything. Could one of you gurus take a look at this function and see if you can spot anything wrong? Thanks. // getEvent() displays events on the calendar for IE browsers // // This distinction is made because IE is currently the only // // browser on which the javascript mouseover effects work.// function getEventIE($ID, $LinkTitle, $AbbrTitle, $Date) { $LinkTitle =ereg_replace("'","’",$LinkTitle); $AbbrTitle =ereg_replace("'","’",$AbbrTitle); echo " dLink('./event.php?ID=$ID&Date=$Date','$LinkTitle','$AbbrTitle'); \n\n"; } This function is called from another page as such: if ($ver >= 4) { echo "\n"; getEventIE($CDCI, $CDTi, "$showName", $queryDate); Thanks again. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Sore head...
My head is sore from banging my head on my desk, so I will now ask the gurus... I am trying to get a canned Calendar application working, and I am running into problems. The application is phpCommunityCalendar by AppIdeas.com. The calendar is currently semi-functional, but for some reason the approval system is not working for me. I am trying to troubleshoot why this is the case and this is where I am running into problems. The following is a bit of code that I do not understand and was hoping that someone could clear up for me. ** < Not sure exactly what this code does, especially the %% portion>** if (!$glbl_LocationID) { $glbl_LocationID = "0"; $LocQuery = "LocationID LIKE '%%'"; } else { $LocQuery = "LocationID = '$glbl_LocationID'"; } ** SNIP ** $result = mysql("$DBName","SELECT CalendarDetailsID FROM phpCalendar_Daily WHERE Active = '0'") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $ID[$i] = $row[0]; $i++; } ** SNIP ** for ($j = 0; $ID[$j]; $j++) { $query .= " OR CalendarDetailsID = '$ID[$j]'"; } $query = ereg_replace("^ OR ","",$query); if (!$query) { echo "There are no results to display"; commonFooter(); exit; ** SNIP ** $result = mysql("$DBName","SELECT * FROM phpCalendar_Details WHERE ".$LocQuery." AND (".$query.") ORDER BY Title") or die(mysql_error()); OK. I have tested the basics of the SQL in both the second section and the last section. If I manually query the database as in the second section, and then use that output in the query of the last section I am returned a record as expected. This is the reason why I am lost as to why this is not working here. Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Newbie PHP/MySQL question
I would say his problem is the IIS 5.0. Switch to some non-MS operating system running Apache as a web server and that should clear up your problems. :) -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Friday, December 20, 2002 11:24 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Newbie PHP/MySQL question On Saturday 21 December 2002 01:11, Matt Matijevich wrote: > I am just getting started with php an mysql. > > When I try to insert a record php get stuck in some kind of loop and > about 25 records are created. Any help would be greatly appreciated. > > Windows 2000 server latest service pack. > PHP 4.2.3 > MySql 3.23 > IIS 5.0 My mind reading skills aren't very good, but I think there's something wrong with line 13 of your program. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* The greatest disloyalty one can offer to great pioneers is to refuse to move an inch from where they stood. */ -- 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
[PHP-DB] FW: Oracle connectivity question...
More information on the problem... I tried including the SID in the OCILogon function and think that I may have gotten a bit further, but still not a successful logon. Here is the error I am now receiving with the SID: Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in /www/DW/oratest.php on line 11 Unable to logon to database. Thanks agian. > -Original Message- > From: NIPP, SCOTT V (SBCSI) > Sent: Wednesday, December 18, 2002 10:30 AM > To: '[EMAIL PROTECTED]' > Subject: Oracle connectivity question... > > OK. I think I now have Oracle support built into PHP/Apache. The > biggest hiccup for HP-UX seems to be that once you add Oracle support to > PHP, you CANNOT built PHP as a DSO, PHP MUST be compiled into Apache. > Once again, I think this is the case, I am still not completely sure at > this point. > > I am now receiving an error on trying to connect to the Oracle > database that I do not understand, but leads me to believe that the PHP > Oracle support is functioning. Here is the code I am attempting: > > $connection = OCILogon("userid", "password") or die ("Unable to logon to > database."); > # phpinfo(); > ?> > > Here is the error I am receiving: > > Warning: OCISessionBegin: ORA-01034: ORACLE not available in > /www/DW/oratest.php on line 10 > Unable to logon to database. > The code I am attempting is simply to verify successful connectivity > to the database. I know that this doesn't really do anything, but I am > trying this simply to test for a successful connection. Please let me > know if you have any ideas or suggestions. Thanks again. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.com > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Oracle connectivity question...
OK. I think I now have Oracle support built into PHP/Apache. The biggest hiccup for HP-UX seems to be that once you add Oracle support to PHP, you CANNOT built PHP as a DSO, PHP MUST be compiled into Apache. Once again, I think this is the case, I am still not completely sure at this point. I am now receiving an error on trying to connect to the Oracle database that I do not understand, but leads me to believe that the PHP Oracle support is functioning. Here is the code I am attempting: Here is the error I am receiving: Warning: OCISessionBegin: ORA-01034: ORACLE not available in /www/DW/oratest.php on line 10 Unable to logon to database. The code I am attempting is simply to verify successful connectivity to the database. I know that this doesn't really do anything, but I am trying this simply to test for a successful connection. Please let me know if you have any ideas or suggestions. Thanks again. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] FW: PHP/Oracle Install questions...
More information for someone to hopefully come to my rescue on this... root@torvalds:/usr/local/apache/bin> ./apachectl startssl /usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage: /us r/lib/libcl.2 /usr/lib/dld.sl: Exec format error Syntax error on line 207 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: Exec format error ./apachectl startssl: httpd could not be started This is what I get when I attempt to start Apache once I think I have compiled the new PHP module properly. > -Original Message- > From: NIPP, SCOTT V (SBCSI) > Sent: Tuesday, December 17, 2002 9:56 AM > To: '[EMAIL PROTECTED]' > Subject: PHP/Oracle Install questions... > > I am attempting to recompile PHP 4.2.3 on HP-UX 11.00 for > connectivity to both a MySQL and a remote Oracle server. I am not having > much luck with this right now. Currently I am getting a couple of > different errors that are of concern for me. First of all, in the Apache > error log I am seeing the following entry every time I start the Apache > server: > > [Tue Dec 17 09:42:39 2002] [warn] module php4_module is already > loaded, skipping > > I am not sure as to why I am receiving this error. I know that PHP > is only compiled as a module, because it does not show up in a httpd -l. > I am wondering if this is a result of some kind of syntax error in my > httpd.conf file. > > The big problem though is getting PHP to compile completely again. > I know that on HP there is an issue with the extension on the php library. > It has something to do with .sl as opposed to .so, but I cannot remember > exactly what it is and for some reason I can't seem to find the > documentation on it this time around. Any help in the right direction > here would be most appreciated. > > Scott Nipp > Phone: (214) 858-1289 > E-mail: [EMAIL PROTECTED] > Web: http:\\ldsa.sbcld.sbc.com > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/Oracle Install questions...
I am attempting to recompile PHP 4.2.3 on HP-UX 11.00 for connectivity to both a MySQL and a remote Oracle server. I am not having much luck with this right now. Currently I am getting a couple of different errors that are of concern for me. First of all, in the Apache error log I am seeing the following entry every time I start the Apache server: [Tue Dec 17 09:42:39 2002] [warn] module php4_module is already loaded, skipping I am not sure as to why I am receiving this error. I know that PHP is only compiled as a module, because it does not show up in a httpd -l. I am wondering if this is a result of some kind of syntax error in my httpd.conf file. The big problem though is getting PHP to compile completely again. I know that on HP there is an issue with the extension on the php library. It has something to do with .sl as opposed to .so, but I cannot remember exactly what it is and for some reason I can't seem to find the documentation on it this time around. Any help in the right direction here would be most appreciated. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Oracle/PHP question...
I am running Oracle 8.0.6.3. Do I need both --with-oracle and --with-oci8? I was under the impression that I only needed the option --with-oci8. Thanks. -Original Message- From: Andrey Hristov [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 17, 2002 8:46 AM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: Re: [PHP-DB] Oracle/PHP question... As Anthony Carlos said - compile your php with oracle and oci support. Then you will have all the functions from the modules. The next thing to do after the compile (and web server restart). You said that you configured the SID and the HOME so that's fine. Just compile new binary Regards, Andrey - Original Message - From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> To: "'Andrey Hristov'" <[EMAIL PROTECTED]>; "xxx " <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, December 17, 2002 4:37 PM Subject: RE: [PHP-DB] Oracle/PHP question... > Correct. I am working on Unix, specifically HP-UX 11.00. > > -Original Message- > From: Andrey Hristov [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, December 17, 2002 8:38 AM > To: xxx ; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Oracle/PHP question... > > > AFAIK he uses *nix, not windows. > (.so-s are possible sollution but prebuilt ones are not shipped with php). > > Andrey > > > - Original Message - > From: "xxx " <[EMAIL PROTECTED]> > To: "Anthony Carlos" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, December 17, 2002 4:32 PM > Subject: Re: [PHP-DB] Oracle/PHP question... > > > > Hy, > > in php.ini you have to uncomment the > > ;extension=php_oci8.dll > > ;extension=php_oracle.dll > > > > ; is a comment > > > > and restart the server > > cybercop78 > > > > > > > > > > On Tue, 17 Dec 2002 08:29:36 -0500, Anthony Carlos wrote > > > Yes, you need to recompile PHP: > ./configure --with-oci8=[your_oracle_home] > > > > > > -Original Message- > > > From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] > > > Sent: Monday, December 16, 2002 1:58 PM > > > To: '[EMAIL PROTECTED]' > > > Subject: [PHP-DB] Oracle/PHP question... > > > > > > I am now trying to setup connectivity to a remote Oracle database > > > for my PHP/Apache web server. I am attempting to verify > > > connectivity to the database by: > > > > > > > > $connection = OCILogon("user", "password") or die ("Unable to logon > > > to database."); ?> > > > > > > I have installed the Oracle client on the system, and I have also > > > setup the ORACLE_HOME and ORACLE_SID environment variables. > Unfortunately > > > at this point I am not even able to make a successful connection to the > > > Oracle database. I am currently receiving the following error: > > > > > > Fatal error: Call to undefined function: ocilogon() in > /www/DW/oratest.php > > > on line 10 > > > > > > Do I need to recompile PHP to be Oracle aware or something? > > > What is it I am missing at this point? Thanks in advance. Scott > > > Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: > http:\\ldsa.sbcld.sbc.com > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > http://www.idilis.ro - Stiri, e-mail gratuit, download, > > SMS, server de counter-strike, hosting gratuit, servicii internet... > > Fii cu un pas inaintea celorlati! > > > > > > -- > > 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 > > -- > 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] Oracle/PHP question...
Correct. I am working on Unix, specifically HP-UX 11.00. -Original Message- From: Andrey Hristov [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 17, 2002 8:38 AM To: xxx ; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Oracle/PHP question... AFAIK he uses *nix, not windows. (.so-s are possible sollution but prebuilt ones are not shipped with php). Andrey - Original Message - From: "xxx " <[EMAIL PROTECTED]> To: "Anthony Carlos" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, December 17, 2002 4:32 PM Subject: Re: [PHP-DB] Oracle/PHP question... > Hy, > in php.ini you have to uncomment the > ;extension=php_oci8.dll > ;extension=php_oracle.dll > > ; is a comment > > and restart the server > cybercop78 > > > > > On Tue, 17 Dec 2002 08:29:36 -0500, Anthony Carlos wrote > > Yes, you need to recompile PHP: ./configure --with-oci8=[your_oracle_home] > > > > -Original Message- > > From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] > > Sent: Monday, December 16, 2002 1:58 PM > > To: '[EMAIL PROTECTED]' > > Subject: [PHP-DB] Oracle/PHP question... > > > > I am now trying to setup connectivity to a remote Oracle database > > for my PHP/Apache web server. I am attempting to verify > > connectivity to the database by: > > > > > $connection = OCILogon("user", "password") or die ("Unable to logon > > to database."); ?> > > > > I have installed the Oracle client on the system, and I have also > > setup the ORACLE_HOME and ORACLE_SID environment variables. Unfortunately > > at this point I am not even able to make a successful connection to the > > Oracle database. I am currently receiving the following error: > > > > Fatal error: Call to undefined function: ocilogon() in /www/DW/oratest.php > > on line 10 > > > > Do I need to recompile PHP to be Oracle aware or something? > > What is it I am missing at this point? Thanks in advance. Scott > > Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > http://www.idilis.ro - Stiri, e-mail gratuit, download, > SMS, server de counter-strike, hosting gratuit, servicii internet... > Fii cu un pas inaintea celorlati! > > > -- > 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Oracle/PHP question...
Figuring how shouldn't be too tough. Compiling software for the most part is a breeze. My concern was whether I needed to recompile or not. I am now trying that, and hopefully this will address the problem for me. As to the recompiling with every release, that is no big deal either as the recompile is all of 4 entries on the command line. Putting this together in a shell script is simplicity in itself, and requires no polishing up even though most of my system scripting I do in Perl. It is nice to see though that you are not trying to tell me how Win-blows is better than Unix. Sure Windows is nice in that virtually everything is simple enough for a 3rd grader to do stuff on it, but I like to think I have a little more intelligence than your average 3rd grader. Oh well, I don't want this to degenerate any further so we can agree to disagree about platforms or you can admit to possibly being a closet Unix fan. :) -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 3:19 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Oracle/PHP question... BTW... I'm not the one stuck trying to figure out how to recompile my current version of PHP to include the oci functions... haha! And guess what, with every release you get to do it all over again... so polish up on the shell scripting unless you want to reinvent the wheel every month or two. :-D <>< Ryan -Original Message- From: Ryan Jameson (USA) Sent: Monday, December 16, 2002 2:15 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Oracle/PHP question... :-) ... Windows is the best at running the C# .NET applications I have to build to make everyone happy that we are "industry standard" ... when big brother is not looking I use PHP for everything I can get away with. I'm actually very impressed with how easily PHP integrates into an IIS / MSSQL environment (in CGI mode that is) ... it has been quite stable and believe it or not upgrades don't require a reboot!!! I have even called the php parser directly from sql server dts packages & agent jobs... PHP is much more powerful then anything m$ offers. <>< Ryan -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 2:08 PM To: Ryan Jameson (USA); [EMAIL PROTECTED] Subject: RE: [PHP-DB] Oracle/PHP question... Thanks, but my web server is HP-UX. Didn't anyone ever tell you Win-blows sucks? :) -Original Message- From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 3:07 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Oracle/PHP question... If your webserver is win32 then you need to uncomment the line in php.ini that says : ;extension=php_oci8.dll if it is unix based I am not sure what you need to do. <>< Ryan -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: Monday, December 16, 2002 1:58 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Oracle/PHP question... I am now trying to setup connectivity to a remote Oracle database for my PHP/Apache web server. I am attempting to verify connectivity to the database by: I have installed the Oracle client on the system, and I have also setup the ORACLE_HOME and ORACLE_SID environment variables. Unfortunately at this point I am not even able to make a successful connection to the Oracle database. I am currently receiving the following error: Fatal error: Call to undefined function: ocilogon() in /www/DW/oratest.php on line 10 Do I need to recompile PHP to be Oracle aware or something? What is it I am missing at this point? Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.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 -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php