Re: [PHP-DB] Remove all instances of a character....
Tried that but I got an error when using PHPMyAdmin... UPDATE risk_corpdatacapture email = REPLACE(email,';','') just don't work??? Wll confused now, cuase that's what I tried before I posted to the list... and you guys say it should work too... Any other ideas? = Error SQL-query : UPDATE risk_corpdatacapture email = REPLACE ( email, ';', '' ) MySQL said: 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 '= REPLACE ( email, ';', '' )' at line 1 == CPT John W. Holmes [EMAIL PROTECTED] 24/12/2003 13:27 Please respond to CPT John W. Holmes [EMAIL PROTECTED] To [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Remove all instances of a character From: [EMAIL PROTECTED] I have a MySQL database, with around 500 entries in one table... I've noticed that many entries have an erroneous ';' in the one of the fields. What I need to do, is tell MySQL to go through the ENTIRE table and find any instances of ' ; ' and them delete them... leaving the rest of the data intact. UPDATE TABLE SET column = REPLACE(column,' ; ','') Reminder: This is a PHP list... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
RE: [PHP-DB] Remove all instances of a character....
Does the ; need a backslash? UPDATE risk_corpdatacapture email = REPLACE(email,'\;','') Not sure but might be worth a try (back it up first!!) Peter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 29 December 2003 10:17 To: CPT John W. Holmes Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Remove all instances of a character Tried that but I got an error when using PHPMyAdmin... UPDATE risk_corpdatacapture email = REPLACE(email,';','') just don't work??? Wll confused now, cuase that's what I tried before I posted to the list... and you guys say it should work too... Any other ideas? = Error SQL-query : UPDATE risk_corpdatacapture email = REPLACE ( email, ';', '' ) MySQL said: 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 '= REPLACE ( email, ';', '' )' at line 1 == CPT John W. Holmes [EMAIL PROTECTED] 24/12/2003 13:27 Please respond to CPT John W. Holmes [EMAIL PROTECTED] To [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Remove all instances of a character From: [EMAIL PROTECTED] I have a MySQL database, with around 500 entries in one table... I've noticed that many entries have an erroneous ';' in the one of the fields. What I need to do, is tell MySQL to go through the ENTIRE table and find any instances of ' ; ' and them delete them... leaving the rest of the data intact. UPDATE TABLE SET column = REPLACE(column,' ; ','') Reminder: This is a PHP list... ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Remove all instances of a character....
[EMAIL PROTECTED] wrote: Tried that but I got an error when using PHPMyAdmin... UPDATE risk_corpdatacapture email = REPLACE(email,';','') just don't work??? You're missing SET... UPDATE risk_corpdatacapture SET email = REPLACE(email,';',''); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Remove all instances of a character....
THAT'S IT!!! Sweet... Xmas hangover be damned... got there in the end..! Cheers everyone, happy new year!!! John W. Holmes [EMAIL PROTECTED] 29/12/2003 13:11 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] Remove all instances of a character [EMAIL PROTECTED] wrote: Tried that but I got an error when using PHPMyAdmin... UPDATE risk_corpdatacapture email = REPLACE(email,';','') just don't work??? You're missing SET... UPDATE risk_corpdatacapture SET email = REPLACE(email,';',''); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
RE: [PHP-DB] PHP export to CSV
You should try this: Header(Content-Type: text/plain); Header(Content-Disposition: attachment; filename=file.csv); Then output the text you want to send. Make sure you double-quote it so that the newlines work! $eol = \n; echo Field 1,Field 2,$field_variable,$eol .. This sends a stream of info WHEN THE USER DECIDES what to do with it. That means if they click cancel, the file is not created, and you have no cleanup Works great! -Original Message- From: John Greco [mailto:[EMAIL PROTECTED] Sent: Monday, December 22, 2003 9:20 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP export to CSV Anyone ever get some code to select from the DB and drop into a CSV file? -- 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] Serious Errors in ODBC Result Sets
I have a PHP problem with the ODBC interface returning TRUNCATED result sets on Linux. Environment: PHP: 4.3.3 Web server: Apache 2.0.47 OS: Linux Redhat 9.0 Host database: IBM AS/400 (now known as iSeries) ODBC Driver: IBM Client Access for Linux ODBC library: unixODBC 2.2.6 I have a query that should return around 3000 rows. *Most* of the time it does. Unfortunately about 40% of the time it returns less than that with no indications of any errors. When not all rows are returned, the number of records seems to be essentially random (I have seen anything from 90 rows up to just a few records short). If I do a command-line test using isql (unixODBC's query tool), I get the right record count every time. Therefore, the problem appears to be within PHP. I am developing this project on a Windoze 2000 box and deploying into the Linux environment for the production system. The problem does not show up in the Win2000 environment. I haven't supplied any of the actual query details because without your own AS/400, it will be impossible to duplicate my results. However, if someone familiar with the PHP core wants to take a detailed look at this I would be happy to discuss the details off list. Right now our short-term kludge is to first get the true result set size with a count(*) query, then repeat the full query until we get the right number of records. This is clearly not an acceptable production solution. In the absence of a fix, we'll have to move the production system to a Windoze box -- please save me from this horrid fate! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] table structure question
Hi everyone, I would like to set up the following two tables inside a db for a soccer league, but wanted to run their structure by you guys first. Here it is: dbname: soccer_stats tables: teams, players teams -- name | captain | division | paid | pmnt_notes | win | loss | tie | goals_for | goals_against players -- lname | fname | team_name | dob | address | telephone | email | sex | yellow | red | disc_notes | goals_scored | own goals I've never split the info over multiple tables, but this way made sense to me for some reason. I've been thinking, and if, for example, I want to (using mysql) pull the captain of a specific player, how would I do that? Is this a good table design in the first place? Comments and criticisms are welcome! Thanks - Kirk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] table structure question
I would do it a little bit different: 1. I would add ID's for each of the tables. 2. I would split teams in 2 tables; the captain stuff would be in a separate table (captain_team let's say), simply because I would have different players as captains in different games. If you keep the structure as it is now, you'll have a lot of duplication. So, I would do it like this: teams --- IDteam | name | ... teams_captain --- IDteam| IDplayer| Game (this could be date format) players IDplayer |... Then, if you want to see the players who were captains for a given team, you can write smth. like: select distinct p.lname from players p, teams_captain t, teams tt where p.IDplayer=t.IDplayer and t.IDteam=tt.IDteam and tt.name like 'Real Madrid' Check also the normalization forms of a database, which you can find in any database book, simply because you'll have complications if you record more than 1 season and some teams can move in different leagues. Hope this helps. Mihai On Mon, 29 Dec 2003, Kirk Babb wrote: Hi everyone, I would like to set up the following two tables inside a db for a soccer league, but wanted to run their structure by you guys first. Here it is: dbname: soccer_stats tables: teams, players teams -- name | captain | division | paid | pmnt_notes | win | loss | tie | goals_for | goals_against players -- lname | fname | team_name | dob | address | telephone | email | sex | yellow | red | disc_notes | goals_scored | own goals I've never split the info over multiple tables, but this way made sense to me for some reason. I've been thinking, and if, for example, I want to (using mysql) pull the captain of a specific player, how would I do that? Is this a good table design in the first place? Comments and criticisms are welcome! Thanks - Kirk -- 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] table structure question
Hi Kirt, Your tables look ok to me... As for your question, if I were using your example, I would link the field teams.name to players.team_name. For example, I would set another column in the teams table to be auto incrementing. As you add the team information, the team will get a number automatically. Then when you add the players information you can use the value ID from the teams table as the value you enter in the players.team_name column. I do this with an html form that has a drop down list that is generated by pulling the team name and ID from the teams table. Something like this: $sql_teams = mysql_query(SELECT ID, name FROM teams ORDER BY name); Then I create a drop down list in my html form like this: select name=team ? // Creates the list of teams from the teams Table while ($LST = mysql_fetch_array($sql_teams)) { $TeamID = $LST[ID]; $team_name = htmlspecialchars($LST[Name]); echo(option value='$TeamID'$team_name/option\n); } ? /select Hope I did not gunk up your question with an answer you did not need... Anyway, hope this helps... Aleks -Original Message- From: Kirk Babb [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 4:31 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] table structure question Hi everyone, I would like to set up the following two tables inside a db for a soccer league, but wanted to run their structure by you guys first. Here it is: dbname: soccer_stats tables: teams, players teams -- name | captain | division | paid | pmnt_notes | win | loss | tie | goals_for | goals_against players -- lname | fname | team_name | dob | address | telephone | email | sex | yellow | red | disc_notes | goals_scored | own goals I've never split the info over multiple tables, but this way made sense to me for some reason. I've been thinking, and if, for example, I want to (using mysql) pull the captain of a specific player, how would I do that? Is this a good table design in the first place? Comments and criticisms are welcome! Thanks - Kirk -- 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] Selecting between using letters
How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. http://www.phreshdesign.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP] Selecting between using letters
How about the following; SELECT DISTINCT left( name, 1 ) AS idx, count( * ) FROM users GROUP BY idx produces a count of the names found for each letter, then you can make decisions about your range of letters, like a max of 250 between letters, or some such number. Warren Vail -Original Message- From: Doug Parker [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 2:18 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] Selecting between using letters How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. http://www.phreshdesign.com -- PHP General 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] objects names limit in mysql
Hi, can any body tell me the maximum character length of mysql table name, column name, etc. Saqi
Re: [PHP-DB] what happened to php_oci8.dll in PHP5 windows distribution?
Jed wrote: Hello All, I'm new to PHP but was able to get some simple sample programs working accessing a local Oracle database using the php_oci8.dll extension provided with the php 4.3.4 distribution. I installed the PHP5 beta version but there is no php_oci8.dll provided, only php_oracle.dll which apparently is the older Oracle libraries. Does anyone know if there will be a version of the Oracle oci libraries included with the production version of PHP5? Any info would be greatly appreciated. I expect this is a build glitch. Let's track http://bugs.php.net/bug.php?id=26744 and see what the official PHP response is. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php