[PHP-DB] find a value in entire table...
I need to search an entire table for a value, and then report back what field it was found in... how on earth do I do that? I've a list of departments, as field names. whenever a user interacts with that Dpet, I wanna add thier id No to the appropriate field. so I'll be left with a table that looks like this: | Accounts | HR | Support | Marketing | | 23 | | | | | | 17 | | | | | | 17 | | | 19 | | | | | | | | 4 | So User 17 has dealt with HR and Support, and user 23 has dealt with only Accounts. So I wanna input an user ID no, and then get told what Dpets have been accessed... I need to learn this, as I know it's simple, but I've never had to do it before! Tris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] find a value in entire table...
that's a fine idea! I'll hve a play... Cheers... Martin Norland [EMAIL PROTECTED] 06/04/2005 14:51 Please respond to php-db@lists.php.net To php-db@lists.php.net cc Subject Re: [PHP-DB] find a value in entire table... [EMAIL PROTECTED] wrote: I need to search an entire table for a value, and then report back what field it was found in... how on earth do I do that? I've a list of departments, as field names. whenever a user interacts with that Dpet, I wanna add thier id No to the appropriate field. [snip] So I wanna input an user ID no, and then get told what Dpets have been accessed... I need to learn this, as I know it's simple, but I've never had to do it before! You'll be better off storing a single row for each user/department interaction. In fact, break them straight out into id's and just have it as a linking table user_department_interactions | user_id | department_id | then have a table for the departments information departments | department_id | department_name | more fields... | a simple join in your query will tell you the department name select distinct department_name from user_department_interactions where user_id=3 AND user_department_interactions.department_id = departments.department_id; the above will return a list of department names that user_id 3 interacted with. Whenever they interact with a department you just insert a single row into the user_department_interactions table, if you only ever want to store whether they interacted at all, you can set constraints and catch the error on insert, or search before inserting. cheers, -- - Martin Norland, Sys Admin / 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-DB] PHP and JOIN... (I know.. it's easy!)
Hi all, long time no post... I've rebuilt a download tracking system my company uses. I built the original, and thought that a restructure would be a doddle! Ooops! ;-) Anyhoo... I used to capture each download in it's own row, replicating user data each time. (Eg: if a user downloaded 5 files, I'd capture their address, email etc, 5 times) For the redesign, I've got several tables. a file list table, a user list table, and a capture list table. I'm built 90% of the front end, and it works great! However, I'm having trouble getting my head round the reporting side of things. (probably need to stop thinking about it for a while, but I don't have that luxury) My admin users, will come in, and select a file ID to view who's downloaded it. So with a file ID No, I need to also get the following: 1. Get the file info from the file table 2. go to the captures table, get all the fields where the file id is the same as theonce requested 3. count each user that has downloaded it 4. get thier data from the users table Now I could do this with 4 seperate queries, and a few for loops etc... But I'm trying to figure out JOIN... as I'm told I can do it all in one query, and make a temp fake table? I've googled for a decent tutorial, but perhaps I'm just panicing, but they all seem over my head... (My flatmate is a PHP developer too, and she says that it's easy!.. so I hope I'm just stressed) Anyhoo, does anyone know of a decent site, that'll really dumb it down for me, or could talk me through what I'm after? Sorry for the long winded E-mail.. but I'm pulling my hair out here.. :-( Tris... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP and JOIN... (I know.. it's easy!)
Cool. cheers for the quick responce... Well, my flatmate is one of two, I live with a lesbian couple in London... One is a falsh guru, sho recently got into PHP (she's a REAL brain box, and picsk stuff up sooo much quick than us mere mortals!) Hard life init ;-) Anyhoo, my prob, in more detail, with table structures (at the bottom!)... An admin user should be able to: Select one (or more, though I'm fine with looping, once I get this first one done) file ID number to see who's downloaded it, and see detailed info on them. So I'm listing a list of all file id No's on page 1. when the user selects the ID they wanna report on, the MYSQL query should read something like: 1. Get, and count user_id from table captures. 2. get all user info from table users, based on above user_id. I'll then make a page that looks like this: file name: User(s) 12.doc [EMAIL PROTECTED] (12 times) [EMAIL PROTECTED] (1 times) [EMAIL PROTECTED] (2 times) etc.. I'll make the email addresses/file name links to detailed info, but I'm fine with doing that... Once I see a few Joins in action based on what I'm trying to do, I'll get it.. I'm self taught (as most of us are right?) and learn better from real life example than books... Please find my table structure below... === // stores only file id, user id and date etc... CREATE TABLE `captures` ( `id` int(11) NOT NULL auto_increment, `user_id` int(11) NOT NULL default '0', `date` date NOT NULL default '-00-00', `file_id` int(8) NOT NULL default '0', `page_id` int(11) NOT NULL default '0', `ip` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=22 ; // all data pertainign to the file CREATE TABLE `files` ( `file_master_bu` varchar(255) NOT NULL default '', `id` int(8) NOT NULL auto_increment, `uploaded_by` varchar(255) NOT NULL default '', `uploaded_date` date NOT NULL default '-00-00', `edited_by` varchar(255) NOT NULL default '', `edited_date` date NOT NULL default '-00-00', `file_title` varchar(255) NOT NULL default '', `file_name` varchar(255) NOT NULL default '', `file_cat` varchar(255) NOT NULL default '', `file_type` varchar(255) NOT NULL default '', `file_desc` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ; // the users who fill out forms, are put here. I do a search each download to see if they're in the database already, based on email address... but that's kinda irrelevent here... ;-) CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `salutation` varchar(255) NOT NULL default '', `forename` varchar(255) NOT NULL default '', `surname` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '', `tel` varchar(255) NOT NULL default '', `fax` varchar(255) NOT NULL default '', `company` varchar(255) NOT NULL default '', `job_title` varchar(255) NOT NULL default '', `street` varchar(255) NOT NULL default '', `street2` varchar(255) NOT NULL default '', `city` varchar(255) NOT NULL default '', `zip` varchar(255) NOT NULL default '', `state` varchar(255) NOT NULL default '', `country` varchar(255) NOT NULL default '', `hear` varchar(255) NOT NULL default '', `us_opt` varchar(255) NOT NULL default '', `eu_opt` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ; | Jochem Maas [EMAIL PROTECTED] 08/03/2005 10:21 To cc php-db@lists.php.net Subject Re: [PHP-DB] PHP and JOIN... (I know.. it's easy!) [EMAIL PROTECTED] wrote: Hi all, long time no post... I've rebuilt a download tracking system my company uses. I built the original, and thought that a restructure would be a doddle! Ooops! ;-) Anyhoo... I used to capture each download in it's own row, replicating user data each time. (Eg: if a user downloaded 5 files, I'd capture their address, email etc, 5 times) For the redesign, I've got several tables. a file list table, a user list table, and a capture list table. I'm built 90% of the front end, and it works great! However, I'm having trouble getting my head round the reporting side of things. (probably need to stop thinking about it for a while, but I don't have that luxury) My admin users, will come in, and select a file ID to view who's downloaded it. So with a file ID No, I need to also get the following: 1. Get the file info from the file table 2. go to the captures table, get all the fields where the file id is the same as theonce requested the admin user can specify multiple files simultaneously to inspect? 3. count each user that has downloaded it 4. get thier data from the users table Now I could do this with 4 seperate queries, and a few for loops etc... But I'm trying to figure out JOIN... as I'm told I can do it all in one
Re: [PHP-DB] PHP and JOIN... (I know.. it's easy!)
All good... I've beenm chattingto the people who will be using the system, and think I'm gonna do a phase 1, then 2 etc.. with phase 1, being just a simple search option, and add mor elater... Keeps the masses happy, and gives me more time... still need to sort out my prob though :-( CHeers for trying!!! Jochem Maas [EMAIL PROTECTED] 08/03/2005 17:05 To cc php-db@lists.php.net Subject Re: [PHP-DB] PHP and JOIN... (I know.. it's easy!) [EMAIL PROTECTED] wrote: Cool. cheers for the quick responce... Well, my flatmate is one of two, I live with a lesbian couple in London... One is a falsh guru, sho recently got into PHP (she's a REAL brain box, and picsk stuff up sooo much quick than us mere mortals!) Hard life init ;-) shucks. :-) Anyhoo, my prob, in more detail, with table structures (at the bottom!)... An admin user should be able to: Select one (or more, though I'm fine with looping, once I get this first one done) file ID number to see who's downloaded it, and see detailed info on them. So I'm listing a list of all file id No's on page 1. when the user selects the ID they wanna report on, the MYSQL query should read something like: 1. Get, and count user_id from table captures. 2. get all user info from table users, based on above user_id. I'll then make a page that looks like this: file name: User(s) 12.doc [EMAIL PROTECTED] (12 times) [EMAIL PROTECTED] (1 times) [EMAIL PROTECTED] (2 times) etc.. I'll make the email addresses/file name links to detailed info, but I'm fine with doing that... Once I see a few Joins in action based on what I'm trying to do, I'll get it.. I'm self taught (as most of us are right?) and learn better from real :-) life example than books... some books are worth their weight in gold. some not. Please find my table structure below... very good :-). I so *(*^* busy that I haven't got time to get my head into mySQL mode. so to other listers with some JOIN foo: I've extracted sufficient info from the OP, any care to finalize? :-) (sorry tristan) === // stores only file id, user id and date etc... CREATE TABLE `captures` ( `id` int(11) NOT NULL auto_increment, `user_id` int(11) NOT NULL default '0', `date` date NOT NULL default '-00-00', `file_id` int(8) NOT NULL default '0', `page_id` int(11) NOT NULL default '0', `ip` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=22 ; // all data pertainign to the file CREATE TABLE `files` ( `file_master_bu` varchar(255) NOT NULL default '', `id` int(8) NOT NULL auto_increment, `uploaded_by` varchar(255) NOT NULL default '', `uploaded_date` date NOT NULL default '-00-00', `edited_by` varchar(255) NOT NULL default '', `edited_date` date NOT NULL default '-00-00', `file_title` varchar(255) NOT NULL default '', `file_name` varchar(255) NOT NULL default '', `file_cat` varchar(255) NOT NULL default '', `file_type` varchar(255) NOT NULL default '', `file_desc` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ; // the users who fill out forms, are put here. I do a search each download to see if they're in the database already, based on email address... but that's kinda irrelevent here... ;-) CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `salutation` varchar(255) NOT NULL default '', `forename` varchar(255) NOT NULL default '', `surname` varchar(255) NOT NULL default '', `email` varchar(255) NOT NULL default '', `tel` varchar(255) NOT NULL default '', `fax` varchar(255) NOT NULL default '', `company` varchar(255) NOT NULL default '', `job_title` varchar(255) NOT NULL default '', `street` varchar(255) NOT NULL default '', `street2` varchar(255) NOT NULL default '', `city` varchar(255) NOT NULL default '', `zip` varchar(255) NOT NULL default '', `state` varchar(255) NOT NULL default '', `country` varchar(255) NOT NULL default '', `hear` varchar(255) NOT NULL default '', `us_opt` varchar(255) NOT NULL default '', `eu_opt` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ; | ... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Job interview test - I give up...
I recently saw a job that I thought I'd be good for, so they sent me a test... All good.. but I realised that I couldn't do it.. I got sooo damned close, but could not finish... :-( Anyhoo, here's the test: http://www.beertastic.co.uk/test_problem.zip And the test parameters are below If anyone can tell me the answer, I'd appreciate it, then I can de-engineer it, and hopefully learn something. I've already mailed them and said thanks, but I give up ;-) I my prob was in gettin ga distict list of all DVD categories, from within the final results page... Hmmm, any takers? TASK:- Modify the test.php file (attached) so a list of categories and the number of DVDs in each category are displayed when the script is called in a browser. (See resultspage.html for the EXACT output required) You must complete the getNumDvdsInCategories() function to query the database and return a multidimensional array in the required format. You may use the PHP and MySQL manuals available online. RESTRICTIONS:- You may only make ONE select query to the database. Do not edit code outside the getNumDvdsInCategories() function. The results in the table must be in alphabetical order (category name). The Drama category MUST appear even though there are no DVDs in the category. Categories beginning with the letter T must not be displayed. Values in the database cannot be hardcoded anywhere in the script. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Job interview test - I give up...
No offence taken! I've never had to use JOIN before... and the test was supposed to take an hour.. I didn;t wanna cheat... and it took me ages to even realise what I was supposed to be doing... (Plus [EMAIL PROTECTED] hungover :-( ) Anyhoo, I'll try what you've suggested... Cheers.. we live, we learn... Brent Baisley [EMAIL PROTECTED] 01/12/2004 13:44 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] Job interview test - I give up... OK. No offense, but that seems fairly easy. Here's one possible answer: select categories.*,count(dv_id) from categories left join dvds on dv_caid=ca_id group by ca_name having ca_name not like 'T%'; On Dec 1, 2004, at 8:13 AM, [EMAIL PROTECTED] wrote: I recently saw a job that I thought I'd be good for, so they sent me a test... All good.. but I realised that I couldn't do it.. I got sooo damned close, but could not finish... :-( Anyhoo, here's the test: http://www.beertastic.co.uk/test_problem.zip And the test parameters are below If anyone can tell me the answer, I'd appreciate it, then I can de-engineer it, and hopefully learn something. I've already mailed them and said thanks, but I give up ;-) I my prob was in gettin ga distict list of all DVD categories, from within the final results page... Hmmm, any takers? TASK:- Modify the test.php file (attached) so a list of categories and the number of DVDs in each category are displayed when the script is called in a browser. (See resultspage.html for the EXACT output required) You must complete the getNumDvdsInCategories() function to query the database and return a multidimensional array in the required format. You may use the PHP and MySQL manuals available online. RESTRICTIONS:- You may only make ONE select query to the database. Do not edit code outside the getNumDvdsInCategories() function. The results in the table must be in alphabetical order (category name). The Drama category MUST appear even though there are no DVDs in the category. Categories beginning with the letter T must not be displayed. Values in the database cannot be hardcoded anywhere in the script. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- 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] Job interview test - I give up...
Right Not married... Not as great a PHP/MySQL developer as I though... Alot of nots today... :-( I'll take a read or that link... This time next year, I'll be a professional...! (what, I don;t know..) Brent Baisley [EMAIL PROTECTED] 01/12/2004 15:10 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] Job interview test - I give up... I code much better with drink than after drink. You never had to use JOIN before? Obviously you are not married. Although marriage tends to be a left join or right join as opposed to a straight join, which allows you to force an order. http://dev.mysql.com/doc/mysql/en/LEFT_JOIN_optimization.html On Dec 1, 2004, at 9:02 AM, [EMAIL PROTECTED] wrote: No offence taken! I've never had to use JOIN before... and the test was supposed to take an hour.. I didn;t wanna cheat... and it took me ages to even realise what I was supposed to be doing... (Plus [EMAIL PROTECTED] hungover :-( ) Anyhoo, I'll try what you've suggested... Cheers.. we live, we learn... Brent Baisley [EMAIL PROTECTED] 01/12/2004 13:44 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] Job interview test - I give up... OK. No offense, but that seems fairly easy. Here's one possible answer: select categories.*,count(dv_id) from categories left join dvds on dv_caid=ca_id group by ca_name having ca_name not like 'T%'; On Dec 1, 2004, at 8:13 AM, [EMAIL PROTECTED] wrote: I recently saw a job that I thought I'd be good for, so they sent me a test... All good.. but I realised that I couldn't do it.. I got sooo damned close, but could not finish... :-( Anyhoo, here's the test: http://www.beertastic.co.uk/test_problem.zip And the test parameters are below If anyone can tell me the answer, I'd appreciate it, then I can de-engineer it, and hopefully learn something. I've already mailed them and said thanks, but I give up ;-) I my prob was in gettin ga distict list of all DVD categories, from within the final results page... Hmmm, any takers? TASK:- Modify the test.php file (attached) so a list of categories and the number of DVDs in each category are displayed when the script is called in a browser. (See resultspage.html for the EXACT output required) You must complete the getNumDvdsInCategories() function to query the database and return a multidimensional array in the required format. You may use the PHP and MySQL manuals available online. RESTRICTIONS:- You may only make ONE select query to the database. Do not edit code outside the getNumDvdsInCategories() function. The results in the table must be in alphabetical order (category name). The Drama category MUST appear even though there are no DVDs in the category. Categories beginning with the letter T must not be displayed. Values in the database cannot be hardcoded anywhere in the script. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Basic JOIN tutorial - RE: [PHP-DB] Job interview test - I give up...
Bloody marvelous...!!! Many thanks.. I'll set myself a few challenges, and see what happens...! Cheers, Tris... Gryffyn, Trevor [EMAIL PROTECTED] 01/12/2004 15:47 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject [PHP-DB] Basic JOIN tutorial - RE: [PHP-DB] Job interview test - I give up... Looks like you got a lot of good responses. I downloaded the zip file but then got slammed with some priority stuff and havn't had a chance to take a look at this. So in the interest of not forgetting and of closing this reply window :) just a quicky response. I had a lot of trouble initially wrapping my brain around JOINs conceptually but they're really rather easy. Here's my 2 cent tour (because most of the documentation I read didn't really put it in plain english). Someone please correct me or add to what I've said if it's not accurate: Inner Join - This is when you have two tables and the items in the ON clause need to exist in both tables for you to get a row returned. Doing a a INNER JOIN b ON somecriteria is functionally the same as doing from a, b where somecriteria Maybe there's a performance difference, maybe only on certain database systems, not sure. They should return the same output: SELECT trucks.truckid, crates.crateid FROM trucks INNER JOIN crates ON trucks.truckid = crates.truckid Should be the same as... SELECT trucks.truckid, crates.crateid FROM trucks, crates WHERE trucks.truckid = crates.truckid This will return all trucks that have crates on them. If a truck is empty, it doesn't show up on the list. Outer Joins - This is where you know you have items in one table, but may or may not have items in another table. SELECT trucks.truckid, crates.crateid FROM trucks LEFT JOIN creates ON trucks.truckid = crates.truckid This should give you a list of all trucks, even empty ones, and their associated crates (if there are any.. If no crates are on the trucks, then an empty cell is returned for 'crateid'. SELECT trucks.truckid, crates.crateid FROM creates RIGHT JOIN trucks ON trucks.truckid = crates.truckid This should return the same thing. The LEFT or RIGHT points to the table that definitely has rows, the other table will show empty (NULL) cells if there are no matches. I believe there's a join that will show NULLs in either column if there's no match, but I don't know what it is off the top of my head. Anyone know this one? Also, some systems like Oracle, let you do shorthand like: SELECT trucks.truckid, crates.crateid FROM creates, trucks WHERE trucks.truckid = crates.truckid(+) (this syntax is probably wrong). It uses a (+) in the WHERE clause to indicate the join. Microsoft SQL-Server has some kind of shorthand way to do this as well, but it's documented as never having worked properly so I'd recommend not using it. To me, the Oracle shorthand is much more intuitive, but once you get the hang of the LEFT JOIN type syntax, it's not too bad. One last note, you can JOIN on multiple tables, you just need to wrap everything in parentheses. It gets a little sticky, but work from the inside out and keep an image in your head of what's going to be returned by each layer and join accordingly. If you have Microsoft Access or something else that graphically lets you create queries, you might try building a query that you know works and returns what you need, then looking at the SQL VIEW to see how the syntax goes. It can help you understand how to do the raw SQL yourself. Good luck! -TG -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 8:14 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Job interview test - I give up... I recently saw a job that I thought I'd be good for, so they sent me a test... All good.. but I realised that I couldn't do it.. I got sooo damned close, but could not finish... :-( Anyhoo, here's the test: http://www.beertastic.co.uk/test_problem.zip And the test parameters are below If anyone can tell me the answer, I'd appreciate it, then I can de-engineer it, and hopefully learn something. I've already mailed them and said thanks, but I give up ;-) I my prob was in gettin ga distict list of all DVD categories, from within the final results page... Hmmm, any takers? TASK:- Modify the test.php file (attached) so a list of categories and the number of DVDs in each category are displayed when the script is called in a browser. (See resultspage.html for the EXACT output required) You must complete the getNumDvdsInCategories() function to query the database and return a multidimensional array in the required format. You may use the PHP and MySQL manuals available online. RESTRICTIONS:- You may only make ONE select
[PHP-DB] MySQL '!=' ???
Hi there... I'm trying to select all records from a MySQL database, and exclude those from certain countries... I've posted a copy of an SQL statement I've got that I'm using in PHPMyADMIN. And as you can see, I've said not to pick Argentina, but there it is??? What first year mistake am I making? See image below: http://www.risk.sungard.com/sql.gif Tris... * 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
[PHP-DB] MySQL query, using DISTINCT...
I have a system that tracks downloads, capturing loadsa info, but of interest here, is email and filename. Simply put, I wanna show all results where file name AND email are unique. (so if email '[EMAIL PROTECTED]' has filename 'word.doc' 5 times in a table, I want to only see it once.) What am I doing wrong...? SELECT DISTINCT(file_name, email) FROM `completed_downloads` WHERE `bu` = 'reech' AND date BETWEEN '2004-06-01' AND '2004-06-30' Tris... * 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] Re: MySQL query, using DISTINCT...
I have a system that tracks downloads, capturing loadsa info, but of interest here, is email and filename. Simply put, I wanna show all results where file name AND email are unique. (so if email '[EMAIL PROTECTED]' has filename 'word.doc' 5 times in a table, I want to only see it once.) What am I doing wrong...? SELECT DISTINCT(file_name, email) FROM `completed_downloads` WHERE `bu` = 'reech' AND date BETWEEN '2004-06-01' AND '2004-06-30' Tris... Hi Tristan, I'm not an MySQL expert but DISTINCT removes duplicate *rows* from your result set. As you select email AND file_name you will always have a unique row (combination of email and file_name). Try without specifying file_name: SELECT DISTINCT email FROM `completed_downloads` WHERE `bu` = 'reech' AND date BETWEEN '2004-06-01' AND '2004-06-30' Regards, Torsten Roehr Ah... But if the user has downloaded 3 files, I need to know that. distinct email alone, wouldn't pick that up... Cheers for your help though, I'm getting there...! Any other ideas? * 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
[PHP-DB] DISTINCT and multiple results...
Hi there... I'm trying to create a MYSQL query that does the following... I've a table that lists ALL downloads from our site. so I may have the same user many times, but different files, or infact, same user, same file. What my boss wants to see is: If a user downloaded a file 3 times, she doesn't care, she just wants to see that it was downloaded. So I tried using DISTINCT(email), but then I loose the data about the other files that they've downloaded How can I create a query, where I can list only one instance of email, per multiple instatnces of a file name. Does that make sence? I'm reallyu stumped... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DISTINCT and multiple results...
It really is that simple?!?!?! Wow... I need to do a MySQL course... Jonathan Haddad [EMAIL PROTECTED] 07/06/2004 13:39 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] DISTINCT and multiple results... select distinct email, username from table On Jun 7, 2004, at 8:19 AM, [EMAIL PROTECTED] wrote: Hi there... I'm trying to create a MYSQL query that does the following... I've a table that lists ALL downloads from our site. so I may have the same user many times, but different files, or infact, same user, same file. What my boss wants to see is: If a user downloaded a file 3 times, she doesn't care, she just wants to see that it was downloaded. So I tried using DISTINCT(email), but then I loose the data about the other files that they've downloaded How can I create a query, where I can list only one instance of email, per multiple instatnces of a file name. Does that make sence? I'm reallyu stumped... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jonathan Haddad [EMAIL PROTECTED] http://www.superwebstuff.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DISTINCT and multiple results...
Ah, but then how can I select other info from the same table (title, first name, company etc...) Jonathan Haddad [EMAIL PROTECTED] 07/06/2004 13:39 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] DISTINCT and multiple results... select distinct email, username from table On Jun 7, 2004, at 8:19 AM, [EMAIL PROTECTED] wrote: Hi there... I'm trying to create a MYSQL query that does the following... I've a table that lists ALL downloads from our site. so I may have the same user many times, but different files, or infact, same user, same file. What my boss wants to see is: If a user downloaded a file 3 times, she doesn't care, she just wants to see that it was downloaded. So I tried using DISTINCT(email), but then I loose the data about the other files that they've downloaded How can I create a query, where I can list only one instance of email, per multiple instatnces of a file name. Does that make sence? I'm reallyu stumped... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jonathan Haddad [EMAIL PROTECTED] http://www.superwebstuff.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Multiple SQL queries...? - SOLVED
Finally got it! Cheers for all your help... it was the group by Emial that was the clincher... I didn't know that it acted like distinct() Live and learn...! Cheers everyone! Gavin Amm [EMAIL PROTECTED] 04/06/2004 00:16 To [EMAIL PROTECTED] cc Subject RE: [PHP-DB] Multiple SQL queries...? Have you tried - GROUP BY email - ? Nope... HHmmm, this is really getting to me... I can do distinct, I can count, but I can't combine the two? Can't be that hard ;-) -- 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] Multiple SQL queries...?
Right, todays fun dilema... ;-) I've a user capture system set up for downloads on our site. Each time a user downloads a file, their info is captured (so we'll have multiple entries for each email address). Also in the table, is a field to state if the result has been viewed by my boss. (Just a 1/0 value) So, what my boss wants me to do now, is to show her, the total No of people captured, and how many she's viewed. Using the 'email' field, from the table, I've done a distinct() sort in MySQL to ensure that I have a list of emails(users) and no duplicates. My prob is this: I want to take each email, and see if at any point, there's a '1' in the viewed field. if there is, I want to add one to the total of $row1 So I can output the num_rows from the distinct request, and then show the total of $row1... So I'll have total No of users, and total No of viewed... as I've mentioned above. What am I doing wrong? ? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { $row1++; } } ? ?=$row1 ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple SQL queries...?
Kinda, but I just wanna count how many views in total... Hence my $row1++; bit... I'll have a play with your code though...! Cheers, Tris... Daniel Clark [EMAIL PROTECTED] 03/06/2004 14:28 Please respond to Daniel Clark [EMAIL PROTECTED] To [EMAIL PROTECTED] [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Multiple SQL queries...? Is this what you want ?? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { echo 'Viewed' ; } else { echo '' ; } } echo $row1 ; Right, todays fun dilema... ;-) I've a user capture system set up for downloads on our site. Each time a user downloads a file, their info is captured (so we'll have multiple entries for each email address). Also in the table, is a field to state if the result has been viewed by my boss. (Just a 1/0 value) So, what my boss wants me to do now, is to show her, the total No of people captured, and how many she's viewed. Using the 'email' field, from the table, I've done a distinct() sort in MySQL to ensure that I have a list of emails(users) and no duplicates. My prob is this: I want to take each email, and see if at any point, there's a '1' in the viewed field. if there is, I want to add one to the total of $row1 So I can output the num_rows from the distinct request, and then show the total of $row1... So I'll have total No of users, and total No of viewed... as I've mentioned above. What am I doing wrong? ? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { $row1++; } } ? ?=$row1 ? -- 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] Multiple SQL queries...?
Nope... HHmmm, this is really getting to me... I can do distinct, I can count, but I can't combine the two? Can't be that hard ;-) Daniel Clark [EMAIL PROTECTED] 03/06/2004 16:49 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc Daniel Clark [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] Subject Re: [PHP-DB] Multiple SQL queries...? OK, how about this? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); echo ' ' . mysql_num_rows($result1) ; } echo $row1 ; Kinda, but I just wanna count how many views in total... Hence my $row1++; bit... I'll have a play with your code though...! Cheers, Tris... -- 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] explode() and a database call...?
Already doing that, and it works: (I have checked the overall value of TPrsc $row[bands] and it does contain 1, 4, 12, 32) Really bugging me now (no pun intended)! Any other ideas? It's gotta be simple..! Torsten Roehr [EMAIL PROTECTED] 18/05/2004 18:24 To [EMAIL PROTECTED] cc Subject Re: [PHP-DB] explode() and a database call...? Tristan Pretty [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] . com... HH, didn't work...? Please echo out $row['bands'] and post the contents. Regards, Torsten Mikhail U. Petrov [EMAIL PROTECTED] 18/05/2004 16:20 Please respond to Mikhail U. Petrov [EMAIL PROTECTED] To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] explode() and a database call...? Hi! You should use $row[bands]. But maybe it's only typing error. I use such methos and have no errors. Tuesday, May 18, 2004, 7:02:34 PM, Tristan wrote: TPrsc I'm trying to split up a field from a database that contains a list of TPrsc No's (Eg:1, 4, 12, 32) TPrsc If I do: TPrsc $bands_array = explode(,, 1, 4, 12, 32); TPrsc I get the following array: TPrsc $bands_array[0] = 1 TPrsc $bands_array[1] = 4 TPrsc $bands_array[2] = 12 TPrsc $bands_array[3] = 32 TPrsc All good! TPrsc However... TPrsc Calling froma database... TPrsc $bands_array = explode(',', $row[bands]); TPrsc I get no values in the array, (I have checked the overall value of TPrsc $row[bands] and it does contain 1, 4, 12, 32) TPrsc os my question is: why is the database call, changing how explode works? TPrsc Tris...? TPrsc * TPrsc The information contained in this e-mail message is intended only for TPrsc the personal and confidential use of the recipient(s) named above. TPrsc If the reader of this message is not the intended recipient or an agent TPrsc responsible for delivering it to the intended recipient, you are hereby TPrsc notified that you have received this document in error and that any TPrsc review, dissemination, distribution, or copying of this message is TPrsc strictly prohibited. If you have received this communication in error, TPrsc please notify us immediately by e-mail, and delete the original message. TPrsc *** -- Best regards, Mikhail U. Petrov mailto:[EMAIL PROTECTED] -- 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 * 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
[PHP-DB] explode() and a database call...?
I'm trying to split up a field from a database that contains a list of No's (Eg:1, 4, 12, 32) If I do: $bands_array = explode(,, 1, 4, 12, 32); I get the following array: $bands_array[0] = 1 $bands_array[1] = 4 $bands_array[2] = 12 $bands_array[3] = 32 All good! However... Calling froma database... $bands_array = explode(',', $row[bands]); I get no values in the array, (I have checked the overall value of $row[bands] and it does contain 1, 4, 12, 32) os my question is: why is the database call, changing how explode works? Tris...? * 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] explode() and a database call...?
HH, didn't work...? Mikhail U. Petrov [EMAIL PROTECTED] 18/05/2004 16:20 Please respond to Mikhail U. Petrov [EMAIL PROTECTED] To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] explode() and a database call...? Hi! You should use $row[bands]. But maybe it's only typing error. I use such methos and have no errors. Tuesday, May 18, 2004, 7:02:34 PM, Tristan wrote: TPrsc I'm trying to split up a field from a database that contains a list of TPrsc No's (Eg:1, 4, 12, 32) TPrsc If I do: TPrsc $bands_array = explode(,, 1, 4, 12, 32); TPrsc I get the following array: TPrsc $bands_array[0] = 1 TPrsc $bands_array[1] = 4 TPrsc $bands_array[2] = 12 TPrsc $bands_array[3] = 32 TPrsc All good! TPrsc However... TPrsc Calling froma database... TPrsc $bands_array = explode(',', $row[bands]); TPrsc I get no values in the array, (I have checked the overall value of TPrsc $row[bands] and it does contain 1, 4, 12, 32) TPrsc os my question is: why is the database call, changing how explode works? TPrsc Tris...? TPrsc * TPrsc The information contained in this e-mail message is intended only for TPrsc the personal and confidential use of the recipient(s) named above. TPrsc If the reader of this message is not the intended recipient or an agent TPrsc responsible for delivering it to the intended recipient, you are hereby TPrsc notified that you have received this document in error and that any TPrsc review, dissemination, distribution, or copying of this message is TPrsc strictly prohibited. If you have received this communication in error, TPrsc please notify us immediately by e-mail, and delete the original message. TPrsc *** -- Best regards, Mikhail U. Petrov mailto:[EMAIL PROTECTED] -- 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
[PHP-DB] From mysql to mssql...
I use PHP/MySQL daily.. love it, live it breath it... However, I've been given a one page project to do, that needs to add the contecnt of a form to an mssql database... I'm fine with doing all the page, apart from talking to mssql... how drasitally does this differ from the standard mysql functions tha tI use..? (Also, I nearly ahd to do it in asp... I'd never used it before, but after lookign at it, it made me damned happy that I use PHP.. way more user friendly!!) * 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] scrolling drop down menu
Cause I care, here's a suggestion... On any drop downs, add an onmouseout event in javascript. I put together a really simple example, I'm sure you could change it to be more usefull for multiple scoll boxes..? http://www.beertastic.co.uk/matthew.html Good luck...! Tris... matthew perry [EMAIL PROTECTED] 28/04/2004 05:18 To [EMAIL PROTECTED] cc Subject [PHP-DB] scrolling drop down menu Then I withdraw the question. Thank you for your time. John W. Holmes wrote: matthew perry wrote: When my users choose an option in the drop down menu, they sometimes accidentally change what they have chosen when the move the center scrolling button of their mouse. I was giving a presentation in front of my company's owner and did this myself. 5 or so index fingers instantly pointed at me saying See you do that to! Wh! Is there a way to stop a menu from scrolling with the center scrolling mouse button? Your questions have nothing to do with PHP. And absolutely nothing to do with DB... * 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] Forms and more forms?
Cheers, I'll swing by php.net to learn about these functions... Tris... Jason Wong [EMAIL PROTECTED] 05/03/2004 10:42 To [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Forms and more forms? On Friday 05 March 2004 17:10, [EMAIL PROTECTED] wrote: TO enable multiple deletions, I must place the whole table in another form. What happens is that no matter how many deletions I select, it only picks up the one at the top of the page, or none, if the top one isn't selected. print_r() or var_dump() every significant variable. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Planet Claire has pink hair. All the trees are red. No one ever dies there. No one has a head */ -- 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
[PHP-DB] only showing partial info of a field in mysql...
You know in PHPmyADMIN... if you hav a large field, and hit browse, you only see some fo the text... is this a PHP thing, or a MySQL thing... more improtantly, how can I do that?? Cheers, Tris... * 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] only showing partial info of a field in mysql...
Perfect! Cheers...! Richard Davey [EMAIL PROTECTED] 04/03/2004 10:50 Please respond to Richard Davey [EMAIL PROTECTED] To [EMAIL PROTECTED] cc Subject Re: [PHP-DB] only showing partial info of a field in mysql... Hello Tristan, Thursday, March 4, 2004, 10:27:34 AM, you wrote: TPrsc You know in PHPmyADMIN... TPrsc if you hav a large field, and hit browse, you only see some fo the text... TPrsc is this a PHP thing, or a MySQL thing... more improtantly, how can I do TPrsc that?? I don't know how PHPmyAdmin does it, but you can do this in SQL directly without having to do it in PHP. Look at the SQL functions: LEFT(), MID(), RIGHT() and SUBSTRING(). I.e. SELECT LEFT(longfield, 100) FROM table This will bring back the first 100 characters from the longfield column (assuming it has 100 characters in it). -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- 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
[PHP-DB] Multiple deletes and updates...
I simply can't get my head round this today Probably easy, but I've been chocka, and brain is melting... Anyhoo... If I have a table, with say, id(unique, auto inc), name, email, membership_type I've listed them on a PHP page... I want to add a checkbox to each row, so that I can select 1 or all, and then perform an action on ALL selected (Either Delete, or change membership_type) I can do this with ease one by one, but I cant get my head round to more than one with one submit button...? Can anyone nudge me in the right direction? I've seen this on the list before, but couldn't find it in the archive (I may have imagined it?) cheers, Tris... * 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] Multiple deletes and updates...
wow, easy when you know how!!! I've gone back to loads of old sites I've done, and added this... I always freaked out before, but my current boss was stressing... I guess presure works! Cheers Mustafa...! mustafa ocak [EMAIL PROTECTED] 04/03/2004 13:52 To [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Multiple deletes and updates... You can use checkboxes to do it : input type=checkbox name=delrec[] value=?=$recid? and in the code foreach($_POST[delrec] as $ccc) { $res=mysql_query(delete from table_name where id= $ccc); } HTH Mustafa - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 3:36 PM Subject: [PHP-DB] Multiple deletes and updates... I simply can't get my head round this today Probably easy, but I've been chocka, and brain is melting... Anyhoo... If I have a table, with say, id(unique, auto inc), name, email, membership_type I've listed them on a PHP page... I want to add a checkbox to each row, so that I can select 1 or all, and then perform an action on ALL selected (Either Delete, or change membership_type) I can do this with ease one by one, but I cant get my head round to more than one with one submit button...? Can anyone nudge me in the right direction? I've seen this on the list before, but couldn't find it in the archive (I may have imagined it?) cheers, Tris... * 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 -- 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
[PHP-DB] Re: Embedded forms, or multiple postings to an external site....
Forget it!!! I had a LIMIT 1 in my code from an earlier test... I AM A MONKEY!! Laters... Man, it just aint my day... I have a page, that lists all entries from my MySQL database. I've used the multiple delete script Mustafa gave me earlier, but one one site, I think it may not work.. My page is laid out like this: form delete button based on select input checkbox select[] formPost other data to other site, in new window/form input checkbox select[] formPost other data to other site, in new window/form input checkbox select[] formPost other data to other site, in new window/form /form However, I'm running into probs... only one entry can be deleted at a time, and sometimes, I'll select a box, but am told none are selected...? Would the embedded forms stop me from processing the multiple deletion in PHP? My other option, is to add the individual posts to the master form, but then how could I submit multiple sets of data, to an external site, withough opening loads of new windows...? So my questions are: 1. Can I embed forms, and are there any issues associtated with it? 2. Can I post to external sites, multiple times, on the same page (kinda like header(Location: http:www.site.com), but many times? Perhaps I'm off on the wrong curve, but it seems the most obvious answer...? Any ideas? Tris... * 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
[PHP-DB] MySQL query... count?
This problem pertains to a system that records all downloads from our site: I have a field in my DB, that states which business unit owns the download that was recorded... What I need to do for a new report, is say how many downloads were recorded for each Business unit? I can select the Business units using Distinct, but hhow can I then count them? I've tried: SELECT DISTINCT(bu)buname, COUNT(buname)bucount FROM $table_name But it doesn't work.. am I being dumb on this cold Monday morning? Tris... * 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] MySQL query... count?
Perfect... I finally used.. SELECT DISTINCT(bu), COUNT(bu) FROM $table_name WHERE date BETWEEN '$date1' AND '$date2' group by bu (I added the Distinct(bu) bit, to label the results correctly... god I love this list) Have a great day! Jason Wong [EMAIL PROTECTED] 01/03/2004 11:03 To [EMAIL PROTECTED] cc Subject Re: [PHP-DB] MySQL query... count? On Monday 01 March 2004 18:53, [EMAIL PROTECTED] wrote: What I need to do for a new report, is say how many downloads were recorded for each Business unit? I can select the Business units using Distinct, but hhow can I then count them? I've tried: SELECT DISTINCT(bu)buname, COUNT(buname)bucount FROM $table_name But it doesn't work.. am I being dumb on this cold Monday morning? Don't use DISTINCT, use GROUP BY. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* One thought driven home is better than three left on base. */ -- 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
[PHP-DB] Connecting, and interacting with Lotus Notes databases...
I did a search on Google, and turned up a few links, but they all seemed to be on about mail databases... however, I need to talk to other databases... I'm hoping that it'll be as easy as it is to talk to MySQL... anyone got any experience in that? Tris... * 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] Connecting, and interacting with Lotus Notes databases...
Sadly, no... I'm totaly new to Notes, and all I know is... 1. There is a databse, that stores our events 2. I need to add/delete/edit etc these events via our web site (run with PHP) I take it I should totter off, and find out exactly how the database is structured first? I don't know squat about notes... Am I gonna get over my head very quickly? J. Kevin C. Burton [EMAIL PROTECTED] 11/02/2004 14:09 To [EMAIL PROTECTED] cc Subject RE: [PHP-DB] Connecting, and interacting with Lotus Notes databases... Can you be more specific about your question, If you want to talk to multiple database with minimal changes, use Adodb or I am using php 5 - DBX functions for ODBC and MySQL. Kevin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 8:58 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Connecting, and interacting with Lotus Notes databases... I did a search on Google, and turned up a few links, but they all seemed to be on about mail databases... however, I need to talk to other databases... I'm hoping that it'll be as easy as it is to talk to MySQL... anyone got any experience in that? Tris... * 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 * 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] Drop down box NOT populated
Jsut a guess... Your row has a capital 'A' in the SQL statement, and a lower case 'a' in teh $row[] call.. does that matter? Larry Sandwick [EMAIL PROTECTED] 22/01/2004 15:46 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc Subject [PHP-DB] Drop down box NOT populated Can anyone tell me what I am missing here, The Select statement does not populate my drop down window? My drop down box is empty ! [snip] ? include '../db.php'; $how = mysql_query(SELECT count(distinct(account)) from Backlog) or die (Something bad happened: . mysql_error()); $how_many = mysql_result($how, 0); echo h3$how_many Accounts to pick from !!!/h3; $sql = mysql_query(SELECT distinct(Account) FROM Backlog)or die (Something bad happened here: . mysql_error()) ; echo select name=\account\\n; echo option\n; while ($row = mysql_fetch_array($sql)) { echo ' option value='.$row[account].''.$row[account]./option\n; } echo /select\n; ? [end snip] Larry Sandwick Sarreid, Ltd. Network/System Administrator phone: (252) 291-1414 x223 fax : (252) 237-1592 * 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-DB] Unsubscribe (mailign lsits in general) question...
I've been told by my boss, that the law has changed in relation to 'Opt out' options on mailing lists etc... she tells me that I have to now change all my forms to conform. She claims that now, each time the user must click the 'remain subscribed' link, or we have to remove them from our mailing lists. Thus changing opt out, to opt in, EACH TIME? Is this true? She seems quite sure. We deal with both European and US clients (world wide to be honest, but most other countries don'e care about this.. do they?) Anyone heard of this before? Tris... * 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] Unsubscribe (mailign lsits in general) question...
Sorry, forgot to put the[OT] bit in the subject line... CPT John W. Holmes [EMAIL PROTECTED] 20/01/2004 14:27 Please respond to CPT John W. Holmes [EMAIL PROTECTED] To [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Unsubscribe (mailign lsits in general) question... What's this got to do with databases (PHP-DB list)? It's barely related to PHP to begin with. Think about where your sending your messages before you click the button. ---John Holmes... - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 9:11 AM Subject: [PHP-DB] Unsubscribe (mailign lsits in general) question... I've been told by my boss, that the law has changed in relation to 'Opt out' options on mailing lists etc... she tells me that I have to now change all my forms to conform. She claims that now, each time the user must click the 'remain subscribed' link, or we have to remove them from our mailing lists. Thus changing opt out, to opt in, EACH TIME? Is this true? She seems quite sure. We deal with both European and US clients (world wide to be honest, but most other countries don'e care about this.. do they?) Anyone heard of this before? Tris... -- 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-DB] MySQL general Question...
What's teh diffence between 'LIKE' '=' EG: SELECT FROM my_table WHERE 'email' LIKE '[EMAIL PROTECTED]' I've just purchased an E-mail marketing piece of software, and was peakign in the code... Found that... Never seen it before (Have I been living in a box?) Cheers, Tris... * 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-DB] SQL query...
SELECT DISTINCT(file_name), Count(file_name) FROM $table_name WHERE date BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by ??? desc In the above sql statement, I'm trying to achieve: 1. select all file names, between two dates. 2. list them, and order by the highest number of occurences of count() Basically, it's for a download tool we have, and my boss wants to easily be able to see the top downloaded files. It all works, but not the 'order by' bit... what do I have to order by... it's not 'file_name', and 'order by count(file_name0' causes an error... thoughts? Cheers, Tris... * 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] SQL query...
Ah... you can name the count().. live and learn, cheers dude... brett king [EMAIL PROTECTED] 15/01/2004 11:17 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject RE: [PHP-DB] SQL query... SELECT DISTINCT(file_name), Count(file_name) FROM $table_name WHERE date BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by ??? desc In the above sql statement, I'm trying to achieve: 1. select all file names, between two dates. 2. list them, and order by the highest number of occurences of count() Basically, it's for a download tool we have, and my boss wants to easily be able to see the top downloaded files. It all works, but not the 'order by' bit... what do I have to order by... it's not 'file_name', and 'order by count(file_name0' causes an error... thoughts? Cheers, Tris... - can you not do this? SELECT DISTINCT(file_name), Count(file_name)fcount FROM $table_name WHERE date BETWEEN '2003-10-01' AND '2003-12-31' group by file_name order by fcount desc Please note that I have named count(file_name) fcount in the sql statement Hope this helps? Brett -- 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-DB] csv export...?
Google is not my friend today... I have a reportng tool on a database i have, and I want to be able to exort the selected results (I've saved the SQL query as a session variable for ease of use) and save that data as a csv file... with headers if possible... Now I have found loadsa sites that let me upload a csv file, but not the other way around... Anyone care to help? * 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] csv export...?
Cheers for prompt reply... But.. what? I need to take an SQL query, and export teh results to a csv file... Are you really sure that simply pointing to a non existant csv file does that? I don't see it somehow...? I'm sorry if I'm wrong... Viorel Dragomir [EMAIL PROTECTED] 09/01/2004 15:50 To [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject Re: [PHP-DB] csv export...? You didn't try to hard isn't it! :) If you want to save a file as csv just save the vars like this 1,2,3 4,5,6 ... 0,0,0 If you want to link a csv file for download put a href='file.csv'download/a. It's not so hard after all. :) Or I didn't get your message. Anyway, good luck! - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 09, 2004 17:35 Subject: [PHP-DB] csv export...? Google is not my friend today... I have a reportng tool on a database i have, and I want to be able to exort the selected results (I've saved the SQL query as a session variable for ease of use) and save that data as a csv file... with headers if possible... Now I have found loadsa sites that let me upload a csv file, but not the other way around... Anyone care to help? * 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 * 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] csv export...?
Getting there... That did indeed output my results to the screen... Next steo is to output that same data to a new file... I've done downloads on my site elsewhere, using header(), but with existing files... I guess I need to learn how to use fwrite? Viorel Dragomir [EMAIL PROTECTED] 09/01/2004 16:09 To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] csv export...? It looks like is not so simple. But is not difficult at all.. Try to make something like: ?php header(Content-type: text/csv); $query = SELECT * FROM tables; $result = mysql_query($query); while($row = mysql_fetch_row($result)){ print implode(,, $row); } mysql_free_result($result); ? Check if functions like implode has the correct arguments. Anyway hopes it gives you a clue about what is going on. Don't forget to connect to database first of all. - Original Message - From: [EMAIL PROTECTED] To: Viorel Dragomir [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, January 09, 2004 17:52 Subject: Re: [PHP-DB] csv export...? Cheers for prompt reply... But.. what? I need to take an SQL query, and export teh results to a csv file... Are you really sure that simply pointing to a non existant csv file does that? I don't see it somehow...? I'm sorry if I'm wrong... Viorel Dragomir [EMAIL PROTECTED] 09/01/2004 15:50 To [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject Re: [PHP-DB] csv export...? You didn't try to hard isn't it! :) If you want to save a file as csv just save the vars like this 1,2,3 4,5,6 ... 0,0,0 If you want to link a csv file for download put a href='file.csv'download/a. It's not so hard after all. :) Or I didn't get your message. Anyway, good luck! - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 09, 2004 17:35 Subject: [PHP-DB] csv export...? Google is not my friend today... I have a reportng tool on a database i have, and I want to be able to exort the selected results (I've saved the SQL query as a session variable for ease of use) and save that data as a csv file... with headers if possible... Now I have found loadsa sites that let me upload a csv file, but not the other way around... Anyone care to help? * 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 * 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 * 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] csv export...?
On the users computer... When my bosses look at the reporting tool I built. They are gonna hit the export link, and get directed to a page that let's them save the data as a csv file, for use in excel. That's the code I'm working on here today... ho hum... is it the weekend yet ;-) David T-G [EMAIL PROTECTED] 09/01/2004 16:33 To PHP DB list [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] csv export...? Tristan -- ...and then [EMAIL PROTECTED] said... % % Getting there... % That did indeed output my results to the screen... Yay! % Next steo is to output that same data to a new file... A file on the surfer's computer or a file on your server? % % I've done downloads on my site elsewhere, using header(), but with % existing files... % I guess I need to learn how to use fwrite? Only if you plan to store the result file on your server, and since you have the DB there I don't see why you would. HTH HAND HNY :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! * 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] csv export...?
Google works!!! just found this, and it works: On the other side it may be better and easier to create a csv file on the fly. Create a page, say csv-export.php, and link to it using a href="" This way the user's browser is tricked that the link points to a CSV file, if it does not honor the content-type it sends (see below). David T-G [EMAIL PROTECTED] 09/01/2004 16:42 To PHP DB list [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] csv export...? Tristan -- ...and then [EMAIL PROTECTED] said... % % On the users computer... OK; that's what I figured. % When my bosses look at the reporting tool I built. % They are gonna hit the export link, and get directed to a page that let's % them save the data as a csv file, for use in excel. Yep. % That's the code I'm working on here today... Look at the header() lines in my reply outside of this subthread. % % ho hum... is it the weekend yet ;-) Not quite, but you're closer :-) HTH HAND HNY :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! * 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] get a total comment listing
i want to be able to tally up how many comments there are for each particular article on a page SELECT COUNT(row_name) from your_table so that you can tell which ones have had new comments and which havent $today = date(Y-d-m); SELECT COUNT(row_name) from your_table WHERE date = '$today' Jsut a few rambling thoughts... Did you want each user to see what was unread JUST by them, or just those comments in teh past week etc? js [EMAIL PROTECTED] 08/01/2004 09:13 To [EMAIL PROTECTED] cc Subject [PHP-DB] get a total comment listing im making a website where visitors can comment on essays that they read. i have a table that contains every comment written and each comment has its own ID for primary key and articleid column for which essay it is written for. now, i want to be able to tally up how many comments there are for each particular article on a page that sums up all of the essays for a user, so that you can tell which ones have had new comments and which havent. its quite basic, but im stuck as far as what to do. any help would be great, thanks. -james * 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....
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....
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. ***
[PHP-DB] Remove all instances of a character....
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. I'll run along to google now, and mysql.org, but it's xmas eve, and I'm feeling lazy.. ;-) Cheers, Tris... * 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-DB] Age old - Sort between two dates...
Hi all... I've searched on google without luck, and so far, no luck... I have a date field in my database, and want to select all entries in the database from date 1 -- date 2 I'll let the user decide what dates... Can anyone point me in the right direction as to what command I need? Sorry to be a dunce, but I can't find this one... Tris... * 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] Age old - Sort between two dates...
Ah... MySQL Version 4.0.15 I've since found this... MySQL supports the between operator for the DATE field. SELECT * FROM Appointments WHERE Moment BETWEEN StartTime AND EndTime ORDER BY StartTime; but that doesn't appear to work? Well confused now...? Sai Hertz And Control Systems [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 22/12/2003 17:25 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc [EMAIL PROTECTED] Subject Re: [PHP-DB] Age old - Sort between two dates... Dear Tristan Pretty, I have a date field in my database, and want to select all entries in the database from date 1 -- date 2 I'll let the user decide what dates... What Database are you using and its version this will give you replies not google searches Can anyone point me in the right direction as to what command I need? Sorry to be a dunce, but I can't find this one... Tris... * 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 * 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-DB] Updating multilple tables?
I have scattered around about 100 tables a block of text... I wasn to serach through ALL my tables, and ALL my rows for this text, adn repalce it with another block of text. I've searched n google for mysql multiple table update But have yet to find an answer.. anyone know an easy way to do this? All the tables are on the same database, so I just need to say, search ALL tables within database Tris...? * 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] Updating multilple tables?
All good, I've got a loop based on all my tables... (cheers for that) however, I still wanna look within an entry for a smaller entry.. EG: the quick brown frog jumped over the lazy dog I want to find and repace frog with fox but do this happens with text all over my database. I'll get there...! ;-) Ignatius Reilly [EMAIL PROTECTED] 27/11/2003 15:02 To PHP DB list [EMAIL PROTECTED], [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Updating multilple tables? One possible reason you did not google back anything is that what you are asking can't be done in SQL. In SQL you can update only one table at a time. Why not write a PHP function that does the job successively on each table? To list tables in MySQL: SHOW TABLES FROM database name HTH Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: PHP DB list [EMAIL PROTECTED] Sent: Thursday, November 27, 2003 15:31 Subject: [PHP-DB] Updating multilple tables? I have scattered around about 100 tables a block of text... I wasn to serach through ALL my tables, and ALL my rows for this text, adn repalce it with another block of text. I've searched n google for mysql multiple table update But have yet to find an answer.. anyone know an easy way to do this? All the tables are on the same database, so I just need to say, search ALL tables within database Tris...? * 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 * 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-DB] Tristan Pretty is out of the office.
I will be out of the office starting 23/10/2003 and will not return until 11/11/2003. I will respond to your message when I return. Please contact Fiona or Alan for any issues. * 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
[PHP-DB] Tristan Pretty is out of the office.
I will be out of the office starting 23/10/2003 and will not return until 11/11/2003. I will respond to your message when I return. Please contact Fiona or Alan for any issues. * 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
[PHP-DB] Out OF OFFICE...
How do I unsubscribe? I'm going away, and have set myout of office... I don't wanna bombard you guys every time I get a posting... * 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-DB] Sessions and MySQL?
Not sure if this is a MySQL Q. or a PHP one, but here goes... I'm just learning sessions... And I'm trying to add a session variable to a MySQL database. I've done this page that takes the results from a previous form... But I get this error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' On line 83 Which is the line that relates to the line: \$_SESSION['salutation'];\, I've tried removing the ';' but it change nothing...? Can anyone see my error? = ? session_start(); header(Cache-control: private); $_SESSION['salutation'] = $_POST['salutation']; //MySQL connection stuff mysql_query(INSERT INTO $table ( salutation, name, city } VALUES { \$_SESSION['salutation'];\, \$_SESSION['name'];\, \$_SESSION['city'];\ } ? //Rest of page... thanks etc... = * 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] Sessions and MySQL?
Cheers to everyone... the curly brackets was me not thinking after a boozy lunch, and trying to recreate code, on an E-mail.. anyhoo... I thought the best idea, and the simplest for me, was to remove the ' from the session recall Turning $_SESSION['salutation'] -- INTO -- $_SESSION[salutation] Cheers all... it's clear as day now... aint it always the way eh? Tris... George Patterson [EMAIL PROTECTED] wrote on 16/10/2003 14:15:54: On Thu, 16 Oct 2003 13:33:28 +0100 [EMAIL PROTECTED] wrote: Not sure if this is a MySQL Q. or a PHP one, but here goes... I'm just learning sessions... And I'm trying to add a session variable to a MySQL database. I've done this page that takes the results from a previous form... But I get this error: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' On line 83 Which is the line that relates to the line: \$_SESSION['salutation'];\, I've tried removing the ';' but it change nothing...? Can anyone see my error? Tristan, yes, You are alternating between curly braces {} and parenethes () (spelling??). Also you forgot to the closing double quotes when completeing the mysql_query statement. You could also put the insert statement into a vairable and echo that to the screen. That way if you can't see the error, paste the query text into the mysql command line client. See my alterations to you code below.. Regards George Patterson = ? session_start(); header(Cache-control: private); $_SESSION['salutation'] = $_POST['salutation']; //MySQL connection stuff mysql_query(INSERT INTO $table ( salutation, name, city ) VALUES ( \$_SESSION['salutation'];\, \$_SESSION['name'];\, \$_SESSION['city'];\ ); ? //Rest of page... thanks etc... -- 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-DB] My SQL update one table, using reference from another...
I've been asked to add a field to a download capture sstem I've got. I've two tables, one that contains all the individual files info ('single_file'), and one that records the downloads ('completed_downloads'). All good... I've been asked to add a file_category (article, brochure, exe etc...) And I've gone through the 'single_file' table and added the field 'file_cat' and populated all entries with data. I've also added a field called 'file_cat' to 'completed_downloads' but they are all blank. Both tables share a common field, called 'file_name' What I'd like to do is: Update all entries 'file_cat' on 'completed_downloads' taking the value of 'file_cat' from 'single_file' where 'single_file.file_name' = 'completed_downloads.filename' Make sence? Well, I've come up with this... UPDATE completed_downloads SET file_cat = 'brochure' WHERE single_file.file_name = completed_downloads.file_name but this will simply update ALL 'file_cat' to brochure, which is not what I want... (In fact the Query above does nothing, it doesn't work) Now, the picture version... I need to populate file_cat. Hope it all makes sence? * 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-DB] My SQL update one table, using reference from another...
I've been asked to add a field to a download capture sstem I've got. I've two tables, one that contains all the individual files info ('single_file'), and one that records the downloads ('completed_downloads'). All good... I've been asked to add a file_category (article, brochure, exe etc...) And I've gone through the 'single_file' table and added the field 'file_cat' and populated all entries with data. I've also added a field called 'file_cat' to 'completed_downloads' but they are all blank. Both tables share a common field, called 'file_name' What I'd like to do is: Update all entries 'file_cat' on 'completed_downloads' taking the value of 'file_cat' from 'single_file' where 'single_file.file_name' = 'completed_downloads.filename' Make sence? Well, I've come up with this... UPDATE completed_downloads SET file_cat = 'brochure' WHERE single_file.file_name = completed_downloads.file_name but this will simply update ALL 'file_cat' to brochure, which is not what I want... (In fact the Query above does nothing, it doesn't work) Now, the picture version... I need to populate file_cat. Hope it all makes sence? Can anyone help? single_file file_name file_cat Id Splash text Locked 123.pdf Brochure 101 Blah blah 1 Abc.pdf Article 245 Blah blah 0 Runit.exe Program 234 Blah blah 1 Completed_downloads File_name Date_downloaded File_cat User Country http_referer Users_ip 123.pdf 10/10/03 Bob Uk Random url 1.1.1.1 123.pdf 01/01/99 Sally USA URL 2.2.2.2 Abc.pdf 12/04/01 Pete Usa URL 3.3.3.3 123.pdf 12/04/01 Pete Usa URL 3.3.3.3 Runit.exe 24/11/02 John Aus URL 4.4.4.4 123.pdf 24/11/02 John Aus URL 4.4.4.4 123.pdf 11/07/01 Greg Poland URL 8.8.8.8 Runit.exe 11/07/01 Greg Poland URL 8.8.8.8 123.pdf 12/07/01 Greg Poland URL 8.8.8.8 = * 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-DB] E-mail marketing tool?
Hi there, I've been trolling through hotscripts.com etc, looking for a tool that I can buy/download to use as a email marketing tool. My company has requested the ability to allow users to sign up for certian offers, news items etc, and need the following functionality: Multiple lists, and each user can subcribe to all/none of these. Opt out E-mail links Option for HTML E-mail Option for attachments Status checker (to make suer we don't duplicate E-mails) Progress reports etc... There are many of packages that do this, most for under $100, but before I spend the cash, has anyone got experiance with this kinda thing, I'n in the deepend here. (To be honest, I'd love to build my own, but we don't have the time) * 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-DB] View all results between date 'a' and date 'b'
Probably a simple query, but gogle has turned up good, but not specific info... I have a data capture form, that I wanna view the results of. All good, I've built a results page, that fitlers by many different catagories etc... what I'd like to do now, is have two date fields to sort by, and then only get the entries that fall between those two dates... I've used the mysql 'date' field on the field in the table I'm using... How can it be done...? * 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-DB] Dynamic sites, to appear static...?
I've been building web sites that use a database backend for some time now. I typically use the format. http://www.mysite.com/index.php?page=contact http://www.mysite.com/index.php?page=home http://www.mysite.com/index.php?page=aboutus etc My most recent job wants to use differnt pages, so the search engines will pick up the url's as clearly defined, and not dynamic, as I normally do... They way id do things is great (normally) as it allows the Admin person to add as many pages as they like, without having to pay me to create it for them. But now if my most recent client wants to create a new page, I'll have to do it for them... Is there a way I can still admin the pages, and allow my client to add/delete pages, but use static links , without '?page=home' etc... I hope I've made sence... I've discused this with my client, and he said a friend of his claimed 'that webserver software should have a module or plugin that will do this' I've never heard of that, have I been living under a rock? * 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-DB] Simple field replace...?
Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * 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] Simple field replace...?
Sorry, I'll specify... I have one column, in a row of perhaps 4 fields. I want to remove the first 32 characters from onlt one field EG: My DB: namedateurl ip bob 1/2/99 http:// 1.1.1.1. sue 4/6/01 http:// 2.2.2.2 If I wanted to remove just the http bit and leave :// I'd have to remove the first 4 characters from all the 'url' column. this is what I wanna do, jsut 100+ times over. but the first 32 characters. Ignatius Reilly [EMAIL PROTECTED] 28/08/2003 11:04 To: [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Simple field replace...? hundreds of what? rows or columns? Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * 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. *** * 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] Simple field replace...?
Was just an examle date column ;-) Anyhoo, jsut a note to say, it's sorted..(I did the mass replace by hand :-( but at least it's done... I've also sorted anotehr prob too, so all in all, a productive morning... I jsut wish I could remember all this stuff for next time! Ignatius Reilly [EMAIL PROTECTED] 28/08/2003 11:29 To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject:Re: [PHP-DB] Simple field replace...? Then a simple substring will do: UPDATE mytable SET url = SUBSTRING( url FROM 5 ) btw your date column looks pretty awful. HTH Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: Ignatius Reilly [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 12:06 PM Subject: Re: [PHP-DB] Simple field replace...? Sorry, I'll specify... I have one column, in a row of perhaps 4 fields. I want to remove the first 32 characters from onlt one field EG: My DB: namedateurl ip bob 1/2/99 http:// 1.1.1.1. sue 4/6/01 http:// 2.2.2.2 If I wanted to remove just the http bit and leave :// I'd have to remove the first 4 characters from all the 'url' column. this is what I wanna do, jsut 100+ times over. but the first 32 characters. Ignatius Reilly [EMAIL PROTECTED] 28/08/2003 11:04 To: [EMAIL PROTECTED], [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Simple field replace...? hundreds of what? rows or columns? Ignatius _ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 11:35 AM Subject: [PHP-DB] Simple field replace...? Hi there, I need to take a field in my database, and remove the first 32 characters from each entry... There are 100's, and I know there's gotta be an easy way... I've looked up string replace, and it only appears to work one at a time... Can anyone tell me how to make it accross the whole table...? * 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. *** * 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 * 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-DB] Saving MySQL data as an Excel Spreadsheet...?
I've just done a search on goolge for this, and found several products that do it, but I'm convinced there's gotta be an open source option? Anyone able to point me in the right direction with this? * 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-DB] Host check?
http://www.beamhost.co.uk/hosting.html I'm moving hosts with our site at work... I found these guys and am very impressed. Has anyone had any dealings with them? Know if they are any good? Tris... * 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-DB] Breaking down a table field....
I have a table, wth many entries. Each entry has been asigned a unit to belong to. I want to list all the units dynamically. How can I display all the units, without displaying each instance of the unit? EG: Unititem breakfast cereal breakfast toast lunch salad lunch sandwich dinner steak dinner pie lunch soup dinner lasagne and so on.. I'd wanna get a list of: breafast lunch dinner not several instances of each... how can I do this? * 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] Breaking down a table field....
My word, easy when you know how...! Cheers mate!!! [EMAIL PROTECTED] 07/08/2003 14:42 To: [EMAIL PROTECTED] cc: [EMAIL PROTECTED] Subject:Re: [PHP-DB] Breaking down a table field SELECT DISTINCT(Unit) from TABLE_NAME; [EMAIL PROTECTED] sungard.com To: [EMAIL PROTECTED] cc: 08/07/2003 09:37 AM Subject: [PHP-DB] Breaking down a table field I have a table, wth many entries. Each entry has been asigned a unit to belong to. I want to list all the units dynamically. How can I display all the units, without displaying each instance of the unit? EG: Unititem breakfast cereal breakfast toast lunch salad lunch sandwich dinner steak dinner pie lunch soup dinner lasagne and so on.. I'd wanna get a list of: breafast lunch dinner not several instances of each... how can I do this? * 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 * 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-DB] Hackers?
Now I am not an Apache guru, and my PHP/MySQL experience is all based around the coding side, not the instilation, security etc... So when I arrived at work yesterday, and discovered that several databases had been deleted, and a random database called 'sanij' has been created, My gut was to suspect hackers. None of my web site pages are unaffected, and the web site runs just fine, apart from those pages that need a MySQL database for content. This morning I come to work and ALL the databases have been deleted. As I said, I really don't know where to begin looking for evidence of hackers. While I'm curious to know who did this, I guess my priority os to recover the lost data... is this possible...? I'm working off a RAQ4, hosted by NetBenefit... Any advise, ideas are gonna be apperciated at this point. I've got backups of alot of the databases, but several were created in the past few weeks, and I didn't back them up yet... I know I know... stupid man I am, but I'll slap myself later, for now... a solution is required Help! Tris... * 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] Hackers?
I know... live and learn... and learn I have... Good advise there... We're gonna be moving hosts in a few weeks anyway, to relieve the burden on little me in these kinda areas... Passwords are being changed, and patches are being checked for updates etc... I have full backups of the site, and most of the databases, so it's not a major crisis, but it is a major pain in the arse... I just LOVE data entry...! ;-) I think I've still got a job, so that's good... but I'll listen to the advise I've been given today and act on it... Roll on Friday... Tris... Jason Wong [EMAIL PROTECTED] 22/07/2003 12:52 Please respond to php-db To: [EMAIL PROTECTED] cc: Subject:Re: [PHP-DB] Hackers? On Tuesday 22 July 2003 18:14, [EMAIL PROTECTED] wrote: Now I am not an Apache guru, and my PHP/MySQL experience is all based around the coding side, not the instilation, security etc... So when I arrived at work yesterday, and discovered that several databases had been deleted, and a random database called 'sanij' has been created, My gut was to suspect hackers. None of my web site pages are unaffected, and the web site runs just fine, apart from those pages that need a MySQL database for content. Hmm, you have several databases missing, you suspect hackers, yet you continue to run the server so that ... This morning I come to work and ALL the databases have been deleted. As I said, I really don't know where to begin looking for evidence of hackers. ... they can delete ALL your databases? The golden rule is, at the first sign of any suspicious activity (yes having several databases deleted does count as suspicious activity!), take the server off-line, backup all your important data, and investigate. While I'm curious to know who did this, I think a better question to be asking is *how* they did this. Knowing that would stand you in good stead to prevent it from happenning in the future. Depending on the ability of the 'hacker' the logs may be a source of info. I guess my priority os to recover the lost data... is this possible...? See what you can salvage from the directory where MySQL keeps the databases. If there's nothing there then your only salvation are in the backups. I'm working off a RAQ4, hosted by NetBenefit... Any advise, ideas are gonna be apperciated at this point. I've got backups of alot of the databases, but several were created in the past few weeks, and I didn't back them up yet... I know I know... stupid man I am, but I'll slap myself later, for now... a solution is required 1) The RAQs and its siblings seems to be notoriously insecure. You really need to keep up with any new security updates. 2) A default installation of MySQL is also insecure in that you do not need a password to use the root account. As with all break-ins or suspected break-ins, to be on the safe side you should recover any data that you can (making sure that they haven't been tainted) then format the hard-disk (or better still, put in a new hard-disk, keeping the old one for analysis) and re-install. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Cats are intended to teach us that not everything in nature has a function. -- Garrison Keillor */ -- 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-DB] File upload...
Just been asked for a 'quick' job... A mate needs a system that can upload a file, and place it in a specific directory... Via FTP he says, but I know there's other ways Has anyone directions to a tutorial, or script, that can get this out of my inbox on this hot, stuffy Friday afternoon? Cheers guys, happy weekend! * 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-DB] date, and time?
Cheers for the help on my last auto inc prob.. I checked out phpmyadmin, and I'm loving it...! cheers all Anyway, I want to know how to store a date like this in a MySQL database: date(F j, Y, g:i a); Resulting in: July 10, 2003, 3:39 am But what do I need to set my database table to, to capture the full data. I can use text, but then I can't sort by date later on Ideas? Cheers list... * 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-DB] Auto inc in MySQL
I know I'll get flamed for askign such a simple question, but here goes... I have a MySQL DB and wanna increment a field 'id_number' by one each time, to avoid creating duplicates... I've done it before, but can't remember how... Any ideas? Tris... * 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-DB] Backing up entire database...
I wanna back up my MySQL database in preperation for this: == http://www.securityfocus.com/news/6219 http://www.counterpane.com/alert-t20030702-001.html http://news.ists.dartmouth.edu/todaysnews.html#internal10656 SANS (http://isc.incidents.org/) says on site http://isc.sans.org/diary.html = I use phpmyadmin, and have about 15 databases, with multiple tables in each... I wanna be able to back up everything, as I can do individually when in the specific database view... But just do the whole thing in one go... I know by the tme I get an answer, I could've just done each one anyway, but I'm curious... ;-) Is this possible? * 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] Anybody out there?
I hear ya. [EMAIL PROTECTED] 03/04/2003 17:02 To: [EMAIL PROTECTED] cc: Subject:[PHP-DB] Anybody out there? Is the list active? I've seen nothing all day. Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 Pay It Forward mailto:[EMAIL PROTECTED] http://accessingram.com *** 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] reading a URL...
I am a newbie, so I gotta admit that most of that went over my head, hit a brick wall, and is now residing in the big server in the sky. If you go to: http://www.pcformat.co.uk Select news, and then any article, and if you look at the URL, you'll see the result I'm trying to achieve. They've done it in ASP, but the result is what I want... Any ideas? Tris... Hello Try to use this one with mysql_fetch_object... printf ("TD WIDTH=80a href=\"%s?Art_Job_Number=%s\"%s %s/a\n","list.php", $data-Art_Job_Number, "BEdit/B", "BView/B"); Then on the list.php do a select statement like this query = "SELECT * FROM Table1 WHERE Art_Job_Number = $Art_Job_Number"; Then echo the result and you should then have what you want... Unless I'm missing the whole point!! Dan 'ello, Is it Possible, in PHP to read a URL? What I am trying to do is this... I have many news stories in a database, and a single static news page, that calls the story, and the corresponding headline. I have looked about on-line, and seen a common URL,... http://www.arandomsite.com/news_story.php?id=123 I have adopted this method, and it only displays the top most story in my database, no matter what news ID I use. Can I get the ID number from the URL?, and then pass that to the SQL statement? I cannot find a tutorial or similar on-line anywhere. Hope you can help, Tris... P.S, after getting this all set up, my boss asked me to turn everything into .jsp pages. SO, I am off to buy a "JSP in 20 seconds" Type books, any ideas? ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. ** -- 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] ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. ** -- 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] reading a URL...
'ello, Is it Possible, in PHP to read a URL? What I am trying to do is this... I have many news stories in a database, and a single static news page, that calls the story, and the corresponding headline. I have looked about on-line, and seen a common URL,... http://www.arandomsite.com/news_story.php?id=123 I have adopted this method, and it only displays the top most story in my database, no matter what news ID I use. Can I get the ID number from the URL?, and then pass that to the SQL statement? I cannot find a tutorial or similar on-line anywhere. Hope you can help, Tris... P.S, after getting this all set up, my boss asked me to turn everything into .jsp pages. SO, I am off to buy a "JSP in 20 seconds" Type books, any ideas? ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. ** -- 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] Using selected fields
Hi there, Firstly a big thanks to those who pointed me in the direction of 'PHP-fast and easy web development'. it was/is a great book, and I have learnt loads on the past week. Anyhoo... I have a php page and included the line: $sql = "SELECT * FROM $table_name WHERE member = \"$member\" AND pw = \"$pw\" "; Now I have a third column called 'userlevel'. I have a cookie that activates on successfully matching the member and pw fields from a form on the previous page. make sense? How can I tell the page to use the userlevel colunm too? Here is the relevent section to my code... can anyone point me in teh rigth direction please??? $sql = "SELECT * FROM $table_name WHERE member = \"$member\" AND pw = \"$pw\" "; $result = mysql_query($sql) or die ("Can't execute query."); $num = mysql_numrows($result); if (($num != 0) ($userlevel == 1)) { $cookie_name = "auth"; $cookie_value = "ok"; $cookie_expire = ""; $cookie_domain =""; setcookie($cookie_name, $cookie_value, $cookie_expire, "/", $cookie_domain, 0); $display_block =" pBSecret area:/B UL LIa href=\"secreta.php\"secret page a/A LIa href=\"secretb.php\"secret page b/A LIa href=\"secretc.php\"secret page c/A LIa href=\"secretd.php\"secret page d/A LIa href=\"secreteb.php\"secret page e/A /UL "; } else { header("Location: http://www.mypage.com"); exit; } = Thanks guys... Tris... ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. ** -- 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]