RE: [PHP-DB] Date Format
Hi CK, I always fetch the Date like SELECT UNIX_TIMESTAMP(Timestamp) AS Timestamp so you can manipulate it with all the PHP Date- and Timefunctions like date(). So you can display the date the way you asked with: $Timestamp = ; // fetch the Timestamp the way you like =8) echo date( d-m-Y, $Timestamp ); Thats it. Hope this helps. Greetinx, Mike Michael Rudel - Web-Development, Systemadministration - Besuchen Sie uns am 20. und 21. August 2001 auf der online-marketing-düsseldorf in Halle 1 Stand E 16 ___ Suchtreffer AG Bleicherstraße 20 D-78467 Konstanz Germany fon: +49-(0)7531-89207-17 fax: +49-(0)7531-89207-13 e-mail: mailto:[EMAIL PROTECTED] internet: http://www.suchtreffer.de ___ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of system Sent: Saturday, July 14, 2001 5:17 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Date Format Friends, I have a design, up and running scripts connected to MySQL. How do I retrieve date formats and have it displayed as dd-mm- ? I store them as DATE. CK Raju -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Persistent connection: Yes or Not?
Recently i have faced the following issue: I have a site running Apache 1.3.19 under Windows 2000 pro/PHP 4.0.6./Oracle 8i After a little load Apache crashes with ORA-00020 error - maximum number of Ora connections exceeded. This problem seems to be faced very often by other people. Limit in ora.reg is 50, but the other told me that even value of 300 does not resolve the issue. After i started to use OCILogon() function instead of OCIPLogon() the problem was solved and the site speed is not affected in any way. But is this the correct way or...? -- Ventsyslav Vassilev Comel Soft Multimedia Sofia, Bulgaria ICQ UIN: 11199819 e-mail: [EMAIL PROTECTED] Visit http://www.comelsoft.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] PASSWORD('xxxxx') and PHP
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is there a way to encode a string in PHP exactly like MySQL does it in its PASSWORD() Function? Reason being Is I have a table with PASSWORD() encoded fields that I need to compare from PHP. just include PASSWORD() in your query ie. SELECT * FROM wherever WHERE password_field=PASSWORD('secretpassword') HTH M@ -BEGIN PGP SIGNATURE- Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com iQA/AwUBO1fywqW0/zC+QxWwEQJyYACgjjRSID3QJimCM/yjCiEW+jMbR3EAn1OV gr7RzYMqC766L7q92EopaEIp =G01U -END PGP SIGNATURE- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Sybase Mailing List?
Sorry to ask this here, but I don´t know where to ask else ... Does someone know a good mailinglist about specific sybase questions? I have some questions about BCP ... MfG Marcel Walter Dresdner Kleinwort Wasserstein Foreign Exchange Money Market Address:Jürgen-Ponto-Platz 1, 60301 Frankfurt/Main * mailto:[EMAIL PROTECTED] * (0 69)-263-12730 If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Persistent connection: Yes or Not?
This is only a guess but for Windows 2000, is there a file in your oracle directory called init.ora? The x's would be the instance name. You might have a maximum number of users defined in that file which is limiting your persistent connections. Check license max users (license_max_users) and license max sessions (license_max_sessions). You can also set license session warning (license_sessions_warning) which will give you a warning message when the number of connections is reached before a failure message is generated. If you dont' have this file, then check your oracle.reg file. In actuality, Oracle should not crash when it hits the max users. It should only return an error message. You might want to open up a problem report with Oracle or search their site for possible fixes. I haven't dealt with Windows 2000. My experience is with Solaris so I'm not sure if the setup is the same. I assume it is. Good luck! -Original Message- From: Ventsyslav Vassilev [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Friday, July 20, 2001 3:55 AM Subject: [PHP-DB] Persistent connection: Yes or Not? Recently i have faced the following issue: I have a site running Apache 1.3.19 under Windows 2000 pro/PHP 4.0.6./Oracle 8i After a little load Apache crashes with ORA-00020 error - maximum number of Ora connections exceeded. This problem seems to be faced very often by other people. Limit in ora.reg is 50, but the other told me that even value of 300 does not resolve the issue. After i started to use OCILogon() function instead of OCIPLogon() the problem was solved and the site speed is not affected in any way. But is this the correct way or...? -- Ventsyslav Vassilev Comel Soft Multimedia Sofia, Bulgaria ICQ UIN: 11199819 e-mail: [EMAIL PROTECTED] Visit http://www.comelsoft.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Best foot forward?
Hi folks, I have a requirement to show records in a certain standard format from a database. This requires first/previous/ next/last buttons, sorting on the column name, searching and filtering using text entered into a text box etc etc. This page would be continuously calling itself when asked to sort or filter etc. and I wanted to use it as a generic display and search/sort page by passing in an sql command or something along those lines. This is getting too messy, i.e. using post and get, trying to work with multiple subnmit buttons (anyone have any example code here?), having multiple variables passed between pages or back into the same page. Can anyone tell me the best way to structure this? Should I always be using either post or get only, what's the best way to pass variables in this manner to ensure ease of maintenance and not letting it get messy (for example, should I be using an array of variables)? Is there an easier way? If anyone of you has come across this before, could you please point a newbie in the right direction? Thanks. Best Regards, Colum Hickey Mail2Web - Check your email from the web at http://www.mail2web.com/ . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: special characters in odbc-queries
Hey I'm kinda rookie here, but i rekon you'd have to double escape the escape char like: 'select * from $table where primary-key=\'1\\' ' and maybe replace the single quotes ' ' with double quotes I couldn't test this because I got my web/php server down. Markus Wagner wrote: Hi there, can anyone tell me, how I have to handle special characters in an odbc-query? for example: 'select * from $table where primary-key=\'1\' ' doesn't work because of the dash in primary-key Thx Kobi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] 'ORA-12203: TNS:unable to connect to destination' error
Thx Stathis, I get the same response as before: Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in c:\program files\apache group\apache\htdocs\dna\dna_oci_sys_list.php on line 20 Anything else I can try? Barry Rouvas Stathis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Barry Prentiss wrote: Hi All, I finally got past the php_oci8.dll problem by moving it to the same directory as php.exe and changing the php.ini extensions_dir back to './'. Now I am getting the following error: Warning: _oci_open_server: ORA-12203: TNS:unable to connect to destination in c:\program files\apache group\apache\htdocs\dna\dna_oci_sys_list.php on line 20 which occurs at the $conn line below: error_reporting (E_ALL); putenv('ORACLE_HOME=C:\orant'); putenv('TNS_ADMIN=C:\orant\NET80\ADMIN'); putenv('ORACLE_SID=SLAC'); putenv('TWO_TASK=SLAC_TCP'); $conn = ociLogon(user,password); Try, OciLogon(user,pass,'SLAC'). What do you get? -Stathis. This implies that I am reaching the Net8 oci client libraries (right?). My environment: PHP 4.0.5, Apache 1.3.19, W2K, Net8 8.0.6.0.0, remote Oracle 8.1.6 on Solaris. I can connect through SQL*Plus, tests OK through Net8 assistant, tnsnames.ora is in proper place (as defined in TNS_ADMIN above). What am I doing wrong? Thx in advance, Barry Prentiss -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] 'ORA-12203: TNS:unable to connect to destination' error
This is saying that your request to connect to Oracle via php and apache is failing because it cannot find the tnsnames.ora file. Is apache setup correctly to access Oracle? Also, if you want detailed information on an error message from Oracle, logon to the Oracle server with owner id of oracle and type in oerr ora 12154. This works for any Oracle error message. -Original Message- From: Barry Prentiss [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Friday, July 20, 2001 2:02 PM Subject: Re: [PHP-DB] 'ORA-12203: TNS:unable to connect to destination' error Thx Stathis, I get the same response as before: Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in c:\program files\apache group\apache\htdocs\dna\dna_oci_sys_list.php on line 20 Anything else I can try? Barry Rouvas Stathis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Barry Prentiss wrote: Hi All, I finally got past the php_oci8.dll problem by moving it to the same directory as php.exe and changing the php.ini extensions_dir back to './'. Now I am getting the following error: Warning: _oci_open_server: ORA-12203: TNS:unable to connect to destination in c:\program files\apache group\apache\htdocs\dna\dna_oci_sys_list.php on line 20 which occurs at the $conn line below: error_reporting (E_ALL); putenv('ORACLE_HOME=C:\orant'); putenv('TNS_ADMIN=C:\orant\NET80\ADMIN'); putenv('ORACLE_SID=SLAC'); putenv('TWO_TASK=SLAC_TCP'); $conn = ociLogon(user,password); Try, OciLogon(user,pass,'SLAC'). What do you get? -Stathis. This implies that I am reaching the Net8 oci client libraries (right?). My environment: PHP 4.0.5, Apache 1.3.19, W2K, Net8 8.0.6.0.0, remote Oracle 8.1.6 on Solaris. I can connect through SQL*Plus, tests OK through Net8 assistant, tnsnames.ora is in proper place (as defined in TNS_ADMIN above). What am I doing wrong? Thx in advance, Barry Prentiss -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Converting MS Access to MySQL
The best tool is MS Access. It has an export facility to ODBC data source. Export to a MySQL odbc dsn. Regards, John Taylor Cody Fletcher [EMAIL PROTECTED] wrote in message 001401c11098$25cf98c0$[EMAIL PROTECTED]">news:001401c11098$25cf98c0$[EMAIL PROTECTED]... yeah, cut and paste, jk, im curious too - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 19, 2001 2:15 PM Subject: [PHP-DB] Converting MS Access to MySQL Can anyone suggest a good utility for converting database from MS Access to MySQL? Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] 'ORA-12203: TNS:unable to connect to destination' error
Thx Peter, I have spent some time on the oracle site. They focus on troubleshooting the Net8 connection, which works fine. I am not sure what you mean when you ask if apache is setup correctly to access Oracle. When running a phpinfo() environment query it shows that oci8 is enabled. Is ther more I need to do? Thx, Barry Peter J. Krawetzky [EMAIL PROTECTED] wrote in message 001201c11147$66dc0510$[EMAIL PROTECTED]">news:001201c11147$66dc0510$[EMAIL PROTECTED]... This is saying that your request to connect to Oracle via php and apache is failing because it cannot find the tnsnames.ora file. Is apache setup correctly to access Oracle? Also, if you want detailed information on an error message from Oracle, logon to the Oracle server with owner id of oracle and type in oerr ora 12154. This works for any Oracle error message. -Original Message- From: Barry Prentiss [EMAIL PROTECTED] To: [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Friday, July 20, 2001 2:02 PM Subject: Re: [PHP-DB] 'ORA-12203: TNS:unable to connect to destination' error Thx Stathis, I get the same response as before: Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in c:\program files\apache group\apache\htdocs\dna\dna_oci_sys_list.php on line 20 Anything else I can try? Barry Rouvas Stathis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Barry Prentiss wrote: Hi All, I finally got past the php_oci8.dll problem by moving it to the same directory as php.exe and changing the php.ini extensions_dir back to './'. Now I am getting the following error: Warning: _oci_open_server: ORA-12203: TNS:unable to connect to destination in c:\program files\apache group\apache\htdocs\dna\dna_oci_sys_list.php on line 20 which occurs at the $conn line below: error_reporting (E_ALL); putenv('ORACLE_HOME=C:\orant'); putenv('TNS_ADMIN=C:\orant\NET80\ADMIN'); putenv('ORACLE_SID=SLAC'); putenv('TWO_TASK=SLAC_TCP'); $conn = ociLogon(user,password); Try, OciLogon(user,pass,'SLAC'). What do you get? -Stathis. This implies that I am reaching the Net8 oci client libraries (right?). My environment: PHP 4.0.5, Apache 1.3.19, W2K, Net8 8.0.6.0.0, remote Oracle 8.1.6 on Solaris. I can connect through SQL*Plus, tests OK through Net8 assistant, tnsnames.ora is in proper place (as defined in TNS_ADMIN above). What am I doing wrong? Thx in advance, Barry Prentiss -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Unexplained MySQL Error..
Hello, I'm hoping that this error is clear to someone who is familiar with MySQL errors (cause it sure doesn't make sense to me): Database error: Invalid SQL: UPDATE WLPbib, WLPpublisher,WLPprofile,WLPbib2profile SET WLPprofile.firstName = 'asdf', WLPprofile.middleName = '', WLPprofile.lastName = 'asdfasdf', WLPbib.title = 'asdf', WLPbib.publisherID = '', WLPpublisher.publisherID = '' WHERE bibID = '32' AND WLPbib2profile.bibID = WLPbib.bibID AND WLPbib2profile.profileID = WLPbib.profileID AND WLPbib.publisherID = WLPbib.publisherID MySQL Error: 1064 (You have an error in your SQL syntax near ' WLPpublisher,WLPprofile,WLPbib2profile SET WLPprofile.firstName = ' at line 3) Please contact the webmaster and report the exact error message. Session halted. Which in the code looks like: $q = UPDATE WLPbib, WLPpublisher,WLPprofile,WLPbib2profile SET WLPprofile.firstName = '$ary[firstName]', WLPprofile.middleName = '$ary[middleName]', WLPprofile.lastName = '$ary[lastName]', WLPbib.title = '$ary[title]', WLPbib.publisherID = '$ary[publisherID]', WLPpublisher.publisherID = '$ary[publisherID]' WHERE bibID = '$ary[bibID]' AND WLPbib2profile.bibID = WLPbib.bibID AND WLPbib2profile.profileID = WLPbib.profileID AND WLPbib.publisherID = WLPbib.publisherID; And in the DB looks like: CREATE TABLE WLPbib ( bibID mediumint(9) NOT NULL, languageID varchar(5), publisherID mediumint(9), categoryID smallint(6), type varchar(55), title varchar(255), pageNumber varchar(55), source_bibID varchar(55), publicationDate varchar(5), dateAdded date, publishedLanguage varchar(5), URL varchar(100), status varchar(5), PRIMARY KEY (bibID) ); CREATE TABLE WLPpublisher ( publisherID mediumint(9) NOT NULL, languageID varchar(5), addressID mediumint(9), name varchar(255), alias4publisherID mediumint(9), PRIMARY KEY (publisherID) ); CREATE TABLE WLPprofile ( profileID mediumint(9) NOT NULL, languageID varchar(5), addressID mediumint(9), firstName varchar(255), middleName varchar(255), lastName varchar(255), organization varchar(255), nationality varchar(255), professionID smallint(3), bio text, status varchar(5), PRIMARY KEY (profileID) ); CREATE TABLE WLPbib2profile ( bibID mediumint(9), profileID mediumint(9) ); What the heck am I missing? Any help would be appreciated. Mike ps. I fixed the duplication error I was getting previously (and brought to the list at that point) with the following: $q = SELECT WLPbib.bibID, WLPbib.title, WLPbib.publicationDate, WLPpublisher.name, WLPaddress.city, WLPaddress.state, WLPcountry.name, WLPprofile.firstName, WLPprofile.middleName, WLPprofile.lastName, WLPprofile.organization ; $q .= FROM WLPbib LEFT JOIN WLPpublisher USING(publisherID), WLPaddress LEFT JOIN WLPcountry USING(countryID), WLPprofile LEFT JOIN WLPbib2profile USING(profileID) ; $q .= WHERE WLPpublisher.addressID = WLPaddress.addressID AND WLPbib2profile.bibID = WLPbib.bibID ; Seems to be working so far. -- Mike Gifford, OpenConcept Consulting, http://openconcept.ca Offering everything your organization needs for an effective web site. Abolish Nuclear Weapons Now!: http://pgs.ca/petition/ It is a miracle that curiosity survives formal education. - A Einstein -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Unexplained MySQL Error..
UPDATE WLPbib, WLPpublisher,WLPprofile,WLPbib2profile I think you can only update one table at a time... I could be wrong, though... Chris
Re: [PHP-DB] Unexplained MySQL Error..
Chris: The MySQL documentation would make you think so... UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1, [col_name2=expr2, ...] [WHERE where_definition] [LIMIT #] Note there isn't a tbl_name [, tbl_name2, ...]. It's just tbl_name... Cheers! My 2 ¢ John Pickett http://www.bvstudios.com/ Co-Author: Inside Dreamweaver 4 http://www.amazon.com/exec/obidos/ASIN/0735710848/xtremist - Original Message - From: Boget, Chris [EMAIL PROTECTED] To: 'Mike Gifford' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, July 20, 2001 2:25 PM Subject: RE: [PHP-DB] Unexplained MySQL Error.. UPDATE WLPbib, WLPpublisher,WLPprofile,WLPbib2profile I think you can only update one table at a time... I could be wrong, though... Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Unexplained MySQL Error..
Chris: The MySQL documentation would make you think so... I don't think so UPDATE [LOW_PRIORITY] [IGNORE] tbl_name Note there isn't a tbl_name [, tbl_name2, ...]. It's just tbl_name... Right... that means just *one* table. Your query is updating 4 tables. Chris
Re: [PHP-DB] Monitoring No. OF CLICKS for a link
write a small script that you can include on each page. this script will update the field that holds the record for that page: update page_count_table set page_count=page_count+1 where url=$url_visited; Pranot Kokate wrote: Hi friends, I am using PHP - MySQL. I need a button which is basicaly a link to some page. So I want to track how many users click on the button or link, to view the page. Also how can I get the details about the person - like where is he located (country). Please help!!! regards, Pranot -- Leo G. Divinagracia III [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Unexplained MySQL Error..
Chris, My first sentance was in response to your I think you can only update one table at a time... statement, not I could be wrong, though... Supported by the example I gave. Sorry for the confusion... My 2 ¢ John Pickett http://www.bvstudios.com/ Co-Author: Inside Dreamweaver 4 http://www.amazon.com/exec/obidos/ASIN/0735710848/xtremist - Original Message - From: Boget, Chris [EMAIL PROTECTED] To: 'John Pickett' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, July 20, 2001 2:35 PM Subject: RE: [PHP-DB] Unexplained MySQL Error.. Chris: The MySQL documentation would make you think so... I don't think so UPDATE [LOW_PRIORITY] [IGNORE] tbl_name Note there isn't a tbl_name [, tbl_name2, ...]. It's just tbl_name... Right... that means just *one* table. Your query is updating 4 tables. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] RE: Best foot forward?
Hi, I created a searchable members directory that probably dealt with some of the issues you're dealing with ... though from your email I can't really tell what exactly your application is for. I'm not sure how professional or maintainable mine is, but here are some basics of how I laid it out... a) html form using post that is used to get the user's search parameters. The user hits the submit button to submit their search parameters. The html form uses post to call itself (ie the PHP page the form is on). You could use GET, but all the values entered by the user would display as part of the URL. The main issue might be that there is a limit to how long your URL could be. If the user adds too many search parameters the URL might become to long and you'd have a problem. b) First the php script checks to see if search parameters have been submitted. If yes, then an SQL statement is used to search a MySQL database. For example, if the user wants to find all members with the last name lee, then the SQL statement looks for all members with the last name lee and returns them sorted by one of the columns (in my case the column containing the full name last, first) c) I create a two dimensional array of members that contains just their member number. I want to display the members returned in pages of 10 entries, so the first dimension of the array contains the page number, and the second dimension contains the item number on that page...here's the code, I hope it makes sense... // create array of members numbers returned by search // note: first dimension is page number // second dimension is page entry (up to 10 items per page) $pageNum = 1; $itemNum = 1; $totalNum = 0; while ($fieldsdirectory = mysql_fetch_array($resultdirectory)) { $directoryresults[$pageNum][$itemNum] = $fieldsdirectory[dir_addresses_memberid]; $itemNum++; $totalNum++; if (($itemNum-1) == 10) { $pageNum++; $itemNum = 1; } } // if the number of items is divisible by 10 we will have an extra page if (($totalNum % 10) == 0) { $pageNum--; } If you are displaying items one at a time, just create a one-dimensional array -- much easier than the mess above! d) When I display the results, I display the search form so the user can put in another search, and below it the results. For mine, I don't use first/last/prev/next, I just display links to the various pages in the result set and add the variables needed to display those pages to the URL in the html link (which calls itself). In your case, you would probably have a variable that keeps track of the current entry. Knowing the current entry, you would be easily be able to get the previous item and the next item (since it is an array). The first item would be at index=0, and for the last item you could keep track of the total number of items (or use a function to get the total number of items the array). If you think it might be useful, I can send you more of the code. I don't however separate the PHP from the HTML which makes it a bit confusing and I'm not sure how close this is to what you're looking for. This is pretty much a one-person shop and keeping all the code together is probably less confusing! Rita. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, July 20, 2001 5:50 AM To: [EMAIL PROTECTED] Subject: Best foot forward? Hi folks, I have a requirement to show records in a certain standard format from a database. This requires first/previous/ next/last buttons, sorting on the column name, searching and filtering using text entered into a text box etc etc. This page would be continuously calling itself when asked to sort or filter etc. and I wanted to use it as a generic display and search/sort page by passing in an sql command or something along those lines. This is getting too messy, i.e. using post and get, trying to work with multiple subnmit buttons (anyone have any example code here?), having multiple variables passed between pages or back into the same page. Can anyone tell me the best way to structure this? Should I always be using either post or get only, what's the best way to pass variables in this manner to ensure ease of maintenance and not letting it get messy (for example, should I be using an array of variables)? Is there an easier way? If anyone of you has come across this before, could you please point a newbie in the right direction? Thanks. Best Regards, Colum Hickey Mail2Web - Check your email from the web at http://www.mail2web.com/ . -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the
Re: [PHP-DB] Unexplained MySQL Error..
Hi Chris, I think you are onto something here.. However, this has produced another problem. Boget, Chris wrote: UPDATE WLPbib, WLPpublisher,WLPprofile,WLPbib2profile I think you can only update one table at a time... I could be wrong, though... I seperated this out into 3 update commands. However, the WHERE statement is hanging now: Database error: Invalid SQL: UPDATE WLPpublisher SET WLPpublisher.publisherID = '' WHERE WLPbib.bibID = '32' AND WLPbib.publisherID = WLPpublisher.publisherID MySQL Error: 1109 (Unknown table 'WLPbib' in where clause) Please contact the webmaster and report the exact error message. Session halted. I can understand that MySQL is getting a bit upset because I am referring to fields like WLPbib.bibID when the table hasn't been specifically referenced in the query. So how how do I work bibID (which isn't defined in WLPpublisher) into the following query: $q = UPDATE WLPpublisher SET WLPpublisher.publisherID = '$ary[publisherID]' WHERE WLPbib.bibID = '$ary[bibID]' AND WLPbib.publisherID = WLPpublisher.publisherID; I'm going to run into a similar problem in the next query: $q = UPDATE WLPprofile SET WLPprofile.firstName = '$ary[firstName]', WLPprofile.middleName = '$ary[middleName]', WLPprofile.lastName = '$ary[lastName]' WHERE bibID = '$ary[bibID]' AND WLPbib2profile.bibID = WLPbib.bibID AND WLPbib2profile.profileID = WLPbib.profileID; so any sugestions to get over this next hurdle would be great. Mike -- Mike Gifford, OpenConcept Consulting, http://openconcept.ca Offering everything your organization needs for an effective web site. Abolish Nuclear Weapons Now!: http://pgs.ca/petition/ It is a miracle that curiosity survives formal education. - A Einstein -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Help!!! Can anybody help me with my script?
Tony pressed the little lettered thingies in this order... I am trying to figure out how to read data base(Mysql) with rows of item number (item) and quantity, so that when item number was given, it searched for the quantity of the item number. If the quantity number is 0 or less, it will show Out of Stock, else will show In Stock on my web page. Here is part of language that I wrote and didn't work. Please help me what to do, There are two common methods. One uses PHP and the other uses MySQL. The one that is most efficient depends largely on the design and size of the table and the desired output. See below... $result = mysql_query(SELECT * FROM inventory,$link); Here are the two queries that will work. The first with PHP: $result = mysql_query(SELECT * FROM inventory WHERE item = '$itemx',$link); $num = mysql_num_rows($result); if ($num 1) { echo Out of stock; } else { echo In stock; } This would be very inneficient because it requires MySQL to do a full retrieval from the table. The only reason you would want to do it this way is if you wanted to relace the In stock above with actual results from the query. If you just wanted to say In stock it would be more efficient to use MySQL's built-in COUNT(*) function: $result = mysql_query(SELECT COUNT(*) FROM inventory WHERE item = '$itemx',$link); while ($row = mysql_fetch_row($result)) { $num = $row[0]; } if ($num 1) { echo Out of stock; } else { echo In stock; } Note that if you use mysql_num_rows() on the second query, you will always get a result of one (1) because the number of rows that MySQL returns with this query will always be one (it returns how many records matched your query as its one row return), assuming that there are no errors. In either case, you can echo $num to display the number of records returned. Good luck... Christopher Ostmo a.k.a. [EMAIL PROTECTED] AppIdeas.com Innovative Application Ideas Meeting cutting edge dynamic web site needs since the dawn of Internet time (1995) Business Applications: http://www.AppIdeas.com/ Open Source Applications: http://open.AppIdeas.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Unexplained MySQL Error..
Mike Gifford pressed the little lettered thingies in this order... Hi Chris, I think you are onto something here.. However, this has produced another problem. Boget, Chris wrote: UPDATE WLPbib, WLPpublisher,WLPprofile,WLPbib2profile I think you can only update one table at a time... I could be wrong, though... I seperated this out into 3 update commands. However, the WHERE statement is hanging now: Database error: Invalid SQL: UPDATE WLPpublisher SET WLPpublisher.publisherID = '' WHERE WLPbib.bibID = '32' AND WLPbib.publisherID = WLPpublisher.publisherID MySQL Error: 1109 (Unknown table 'WLPbib' in where clause) Please contact the webmaster and report the exact error message. Session halted. I can understand that MySQL is getting a bit upset because I am referring to fields like WLPbib.bibID when the table hasn't been specifically referenced in the query. If you do not list a table in the UPDATE parameter, you cannot reference that table from anywhere else within your query. The same is true of SELECT statements - you cannot reference a table that is not listed in the FROM clause. The same is true of UPDATE and many other commands. There's a table selection parameter for most SQL queries (at least those that actually query), and you cannot point to tables later in your query that are not listed. In other words, you cannot tell it to update table1 where table2 = ... If you haven't told it to do an action (update in this case) on table2, it's going to wonder what the heck those tables have to do with each other and exit with an error. This is an oversimplification of what really happens, but this message is way too short to go into that in any detail. You should either pour through the documentation section at mysql.com or get the book MySQL by Paul DuBois. The docs may be difficult to get through for newbies, but they are precise and contain a lot of info. The book on the otherhand starts at the beginning and holds your hand into the more difficult aspects. The book even goes into details about how MySQL works that makes it so that you can't do what you are attempting above. Christopher Ostmo a.k.a. [EMAIL PROTECTED] AppIdeas.com Innovative Application Ideas Meeting cutting edge dynamic web site needs since the dawn of Internet time (1995) Business Applications: http://www.AppIdeas.com/ Open Source Applications: http://open.AppIdeas.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Unexplained MySQL Error..
Thanks for your attention to this matter Christopher, Christopher Ostmo wrote: If you do not list a table in the UPDATE parameter, you cannot reference that table from anywhere else within your query. The same is true of SELECT statements - you cannot reference a table that is not listed in the FROM clause. The same is true of UPDATE and many other commands. There's a table selection parameter for most SQL queries (at least those that actually query), and you cannot point to tables later in your query that are not listed. Good explaination, thanks! But can you UPDATE or INSERT into multiple tables using the same query? You can SELECT multiple fields FROM multiple tables, but I ran into an error when I tried to use UPDATE with this same logic. In other words, you cannot tell it to update table1 where table2 = ... If you haven't told it to do an action (update in this case) on table2, it's going to wonder what the heck those tables have to do with each other and exit with an error. This is an oversimplification of what really happens, but this message is way too short to go into that in any detail. You've given lots of detail, and I just want the script to work, rather than learning what really happens. :) You should either pour through the documentation section at mysql.com or get the book MySQL by Paul DuBois. The docs may be difficult to get through for newbies, but they are precise and contain a lot of info. The book on the otherhand starts at the beginning and holds your hand into the more difficult aspects. The book even goes into details about how MySQL works that makes it so that you can't do what you are attempting above. I'll look for the book. I've found a number of MySQL Tutorials online that have been useful. However I keep running into these gaps in my understanding. I will look for Paul's book. Likely tomorrow. Thanks for the led. Open Source Applications: http://open.AppIdeas.com/ I think I've email you a about your calendar script. Thanks again for your help! Mike -- Mike Gifford, OpenConcept Consulting, http://openconcept.ca Offering everything your organization needs for an effective web site. Abolish Nuclear Weapons Now!: http://pgs.ca/petition/ It is a miracle that curiosity survives formal education. - A Einstein -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] PHP, Apache PostgreSQL
When I execute a pg_connect() in a .php file, I get an error indicating that the function is not defined... That's because, in the Apache error log I'm getting the following: PHP Warning: Unable to load dynamic library '/usr/lib/pgsql.so' - libpq.so.2.0: cannot open shared object file: No such file or directory in Unknown on line 0 I have confirmed that my pgsql.so and libpq.so.* files are in my directory specified in the php.ini file. And that the exention for pgsql.so exists in the php.ini also. Would anyone know what I missed here? Thanks, Sean McCoy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP, Apache PostgreSQL
Results for 200.197.121.100: This IP has been verified clean within the last 15 days. It will not be checked again until this period expires and another check request is made. Results for 216.92.131.4: This IP is already in queue for checking. Results for 65.101.35.140: This IP has been added to the queue for checking. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Help!!! Can anybody help me with my script?
Thanks for your quick respond and your help. This is great. I have one more favor to ask you. As you know I am a beginner of PHP Mysql, do I put that language on all my product pages? It seems to be too much work. Is there way that I can save main language that you wrote in to one file as stock.php3, and point a link from product html page with known item number for itemx? And, print the result back to product html page with Out of Stock or In Stock. I will appreciate your help. Thanks again for your help. Tony Christopher Ostmo [EMAIL PROTECTED] wrote in message 3B5858C3.22011.4C90352@localhost">news:3B5858C3.22011.4C90352@localhost... Tony pressed the little lettered thingies in this order... I am trying to figure out how to read data base(Mysql) with rows of item number (item) and quantity, so that when item number was given, it searched for the quantity of the item number. If the quantity number is 0 or less, it will show Out of Stock, else will show In Stock on my web page. Here is part of language that I wrote and didn't work. Please help me what to do, There are two common methods. One uses PHP and the other uses MySQL. The one that is most efficient depends largely on the design and size of the table and the desired output. See below... $result = mysql_query(SELECT * FROM inventory,$link); Here are the two queries that will work. The first with PHP: $result = mysql_query(SELECT * FROM inventory WHERE item = '$itemx',$link); $num = mysql_num_rows($result); if ($num 1) { echo Out of stock; } else { echo In stock; } This would be very inneficient because it requires MySQL to do a full retrieval from the table. The only reason you would want to do it this way is if you wanted to relace the In stock above with actual results from the query. If you just wanted to say In stock it would be more efficient to use MySQL's built-in COUNT(*) function: $result = mysql_query(SELECT COUNT(*) FROM inventory WHERE item = '$itemx',$link); while ($row = mysql_fetch_row($result)) { $num = $row[0]; } if ($num 1) { echo Out of stock; } else { echo In stock; } Note that if you use mysql_num_rows() on the second query, you will always get a result of one (1) because the number of rows that MySQL returns with this query will always be one (it returns how many records matched your query as its one row return), assuming that there are no errors. In either case, you can echo $num to display the number of records returned. Good luck... Christopher Ostmo a.k.a. [EMAIL PROTECTED] AppIdeas.com Innovative Application Ideas Meeting cutting edge dynamic web site needs since the dawn of Internet time (1995) Business Applications: http://www.AppIdeas.com/ Open Source Applications: http://open.AppIdeas.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Help!!! Can anybody help me with my script?
Tony pressed the little lettered thingies in this order... Thanks for your quick respond and your help. This is great. I have one more favor to ask you. As you know I am a beginner of PHP Mysql, do I put that language on all my product pages? It seems to be too much work. Is there way that I can save main language that you wrote in to one file as stock.php3, and point a link from product html page with known item number for itemx? And, print the result back to product html page with Out of Stock or In Stock. I will appreciate your help. Thanks again for your help. Tony Take a look at function() http://php.he.net/manual/en/functions.php and require: http://php.he.net/manual/en/function.require.php Define the code in the file you are requiring: function inStock($itemx) { ...do query here... ...echo result here... } And in your regular pages: require(file_with_functions.php); inStock($itemx); That's about it. Good luck... Christopher Ostmo a.k.a. [EMAIL PROTECTED] AppIdeas.com Innovative Application Ideas Meeting cutting edge dynamic web site needs since the dawn of Internet time (1995) For a good time, http://www.AppIdeas.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]