Re: [PHP-DB] Passing form values with quotes, to itself
Hi - I actually got this to work for me - if you remember, I wasn't having problems writing values w/ double or single quotes to the database - it was passing the form values from page to page, inside text boxes, etc. What I had to do was use: Then if a user editted a field, clicked a button to preview it, editted it again, previewed it again, etc. 10 times before they saved it to the db, they wouldn't get slashes before single and double quotes. What we do for end-users -- Faye Keesic Computer Programmer Analyst/Web Page Design > From: "Peter Lovatt" <[EMAIL PROTECTED]> > Date: Thu, 14 Feb 2002 21:50:25 - > To: "Jim Lucas [php]" <[EMAIL PROTECTED]>, "William Fong" > <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: RE: [PHP-DB] Passing form values with quotes, to itself > > Hi > > I spent ages trying to get it to work. Echoing the " always closes the text > area in an input box, so any data after the quotes isn't displayed. Its > fundamental to the HTML, so adding slashes is irrelevant. > > What I did in the end was to swap double quotes " for two single quotes '' > using ereg_replace. It looks a little odd sometimes, but it works. You swap > it back again when you insert or update the data and addslashes to make sure > it inserts safely. > > Not sure if there are more elegant answers > > email me offlist if you would like the code > > HTH > > Peter > > --- > Excellence in internet and open source software > --- > Sunmaia > www.sunmaia.net > [EMAIL PROTECTED] > tel. 0121-242-1473 > --- > >> -Original Message- >> From: Jim Lucas [php] [mailto:[EMAIL PROTECTED]] >> Sent: 14 February 2002 18:34 >> To: William Fong; [EMAIL PROTECTED] >> Subject: Re: [PHP-DB] Passing form values with quotes, to itself >> >> >> it is called magic quotes and it can be enabled through the php.ini file. >> >> Jim Lucas >> - Original Message - >> From: "William Fong" <[EMAIL PROTECTED]> >> To: <[EMAIL PROTECTED]> >> Sent: Wednesday, February 13, 2002 10:36 AM >> Subject: Re: [PHP-DB] Passing form values with quotes, to itself >> >> >>> Doesn't PHP have something that will automatically do this? I can't >>> remember, but I think you had to enable it in php.ini or when >> you compile. >>> >>> (just like to know for future reference). >>> >>> thx. >>> >>> -w >>> >>> -- >>> William Fong - [EMAIL PROTECTED] >>> Phone: 626.968.6424 x210 | Fax: 626.968.6877 >>> Wireless #: 805.490.7732| Wireless E-mail: >> [EMAIL PROTECTED] >>> >>> >>> >>> >>> - Original Message - >>> From: "David Fudge" <[EMAIL PROTECTED]> >>> To: <[EMAIL PROTECTED]> >>> Sent: Wednesday, February 13, 2002 10:12 AM >>> Subject: Re: [PHP-DB] Passing form values with quotes, to itself >>> >>> >>> : before you submit to the db, you have to escape the quotes like this: >>> : >>> : $Body = addslashes($Body); >>> : all " " will show up as \" \" >>> : and ' ' will be \' \' >>> : >>> : when you pull the info from the db, you'll have to use >> "stripslashes()" >> to >>> : remove those you put in. >>> : $Body = stripslashes($Body_from_db); >>> : >>> : - Original Message - >>> : From: "Faye Keesic" <[EMAIL PROTECTED]> >>> : To: <[EMAIL PROTECTED]> >>> : Sent: Wednesday, February 13, 2002 1:02 PM >>> : Subject: [PHP-DB] Passing form values with quotes, to itself >>> : >>> : >>> : > Hi there. >>> : > >>> : > I have a form that contains several fields w/ text info >> (which may or >>> may >>> : > not contain single and double quotes). >>> : > >>> : > When the user clicks Preview, the form's action is set to >> call itself >>> : > ($PHP_SELF), and the info is displayed nicely so they can read it >> over, >>> : and >>> : > verify it before saving to the db. >>> : > >>> : > What I'm having problems with is that when the data has quotes, the >> text >>> : > data cuts off. >>> : > >>> : > If I use: >>> : > then double quotes are cut off. >>> : > >>> : > If I use: >>> : > then single quotes are cut off. >>> : > >>> : > I want nothing cut off! I've tried addslashes()..still cuts off. >>> : > >>> : > I hope that all made sense... >>> : > -- >>> : > Faye >>> : > >>> : > >>> : > -- >>> : > PHP Database Mailing List (http://www.php.net/) >>> : > To unsubscribe, visit: http://www.php.net/unsub.php >>> : > >>> : >>> : >>> : -- >>> : PHP Database Mailing List (http://www.php.net/) >>> : To unsubscribe, visit: http://www.php.net/unsub.php >>> : >>> >>> >>> >>> -- >>> PHP Database Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> >> -- >> PHP Database Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, vis
RE: [PHP-DB] Passing form values with quotes, to itself
Hi I spent ages trying to get it to work. Echoing the " always closes the text area in an input box, so any data after the quotes isn't displayed. Its fundamental to the HTML, so adding slashes is irrelevant. What I did in the end was to swap double quotes " for two single quotes '' using ereg_replace. It looks a little odd sometimes, but it works. You swap it back again when you insert or update the data and addslashes to make sure it inserts safely. Not sure if there are more elegant answers email me offlist if you would like the code HTH Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- > -Original Message- > From: Jim Lucas [php] [mailto:[EMAIL PROTECTED]] > Sent: 14 February 2002 18:34 > To: William Fong; [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Passing form values with quotes, to itself > > > it is called magic quotes and it can be enabled through the php.ini file. > > Jim Lucas > - Original Message - > From: "William Fong" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, February 13, 2002 10:36 AM > Subject: Re: [PHP-DB] Passing form values with quotes, to itself > > > > Doesn't PHP have something that will automatically do this? I can't > > remember, but I think you had to enable it in php.ini or when > you compile. > > > > (just like to know for future reference). > > > > thx. > > > > -w > > > > -- > > William Fong - [EMAIL PROTECTED] > > Phone: 626.968.6424 x210 | Fax: 626.968.6877 > > Wireless #: 805.490.7732| Wireless E-mail: > [EMAIL PROTECTED] > > > > > > > > > > - Original Message - > > From: "David Fudge" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, February 13, 2002 10:12 AM > > Subject: Re: [PHP-DB] Passing form values with quotes, to itself > > > > > > : before you submit to the db, you have to escape the quotes like this: > > : > > : $Body = addslashes($Body); > > : all " " will show up as \" \" > > : and ' ' will be \' \' > > : > > : when you pull the info from the db, you'll have to use > "stripslashes()" > to > > : remove those you put in. > > : $Body = stripslashes($Body_from_db); > > : > > : - Original Message - > > : From: "Faye Keesic" <[EMAIL PROTECTED]> > > : To: <[EMAIL PROTECTED]> > > : Sent: Wednesday, February 13, 2002 1:02 PM > > : Subject: [PHP-DB] Passing form values with quotes, to itself > > : > > : > > : > Hi there. > > : > > > : > I have a form that contains several fields w/ text info > (which may or > > may > > : > not contain single and double quotes). > > : > > > : > When the user clicks Preview, the form's action is set to > call itself > > : > ($PHP_SELF), and the info is displayed nicely so they can read it > over, > > : and > > : > verify it before saving to the db. > > : > > > : > What I'm having problems with is that when the data has quotes, the > text > > : > data cuts off. > > : > > > : > If I use: > > : > then double quotes are cut off. > > : > > > : > If I use: > > : > then single quotes are cut off. > > : > > > : > I want nothing cut off! I've tried addslashes()..still cuts off. > > : > > > : > I hope that all made sense... > > : > -- > > : > Faye > > : > > > : > > > : > -- > > : > PHP Database Mailing List (http://www.php.net/) > > : > To unsubscribe, visit: http://www.php.net/unsub.php > > : > > > : > > : > > : -- > > : PHP Database Mailing List (http://www.php.net/) > > : To unsubscribe, visit: http://www.php.net/unsub.php > > : > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Disable Right click w/ php?
Hi I don't think it is possible without javascript, and it does not always work with javascript. Anybody with any real knowledge can bypass it anyway simply by saving the page and opening it in a text editor. So Javascript will stop casual right clickers, and the others will do it anyway, if they want to. Just my 2p worth HTH Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- > -Original Message- > From: jas [mailto:[EMAIL PROTECTED]] > Sent: 14 February 2002 06:18 > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Disable Right click w/ php? > > > I have been looking on php.net for a function to disallow people to right > click to view source... anyone have a good idea of how to accomplish this > without using java-script? > Thanks in advance, > Jas > > > > -- > 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] Disable Right click w/ php?
There is no way to do this in PHP. None. None at all. It simply cannot be done. Right-clicking is handled by the browser client only, along with things like the back button, etc. If you could have a server-side scripting language make changes in how the browser works, you'd be in some serious trouble. It would be a very serious security violation (which means MicroSoft will probably allow it at some point -- heh). Having said that, there are ways to disable the context menu using JavaScript and DHTML; however, it will only work in certain browsers (notably IE and higher versions of NS). Check out http://www.dynamicdrive.com for some ideas. On Thu, 2002-02-14 at 13:23, William Fong wrote: > I could wget these files and stick them in MySQL to organize ( had to make > this a legit post in php/db )... vi them and dd out the javascript lines. > > There is no point in protecting html... > > > > > -- > William Fong - [EMAIL PROTECTED] > Phone: 626.968.6424 x210 | Fax: 626.968.6877 > Wireless #: 805.490.7732| Wireless E-mail: [EMAIL PROTECTED] > > > > > - Original Message - > From: "jas" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, February 13, 2002 10:17 PM > Subject: [PHP-DB] Disable Right click w/ php? > > > : I have been looking on php.net for a function to disallow people to right > : click to view source... anyone have a good idea of how to accomplish this > : without using java-script? > : Thanks in advance, > : Jas > : > : > : > : -- > : 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 > > -- Sliante, Richard S. Crawford mailto:[EMAIL PROTECTED] http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Yahoo!: rscrawford MSN: [EMAIL PROTECTED] "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupery "Push the button, Max!" -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Disable Right click w/ php?
I could wget these files and stick them in MySQL to organize ( had to make this a legit post in php/db )... vi them and dd out the javascript lines. There is no point in protecting html... -- William Fong - [EMAIL PROTECTED] Phone: 626.968.6424 x210 | Fax: 626.968.6877 Wireless #: 805.490.7732| Wireless E-mail: [EMAIL PROTECTED] - Original Message - From: "jas" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 13, 2002 10:17 PM Subject: [PHP-DB] Disable Right click w/ php? : I have been looking on php.net for a function to disallow people to right : click to view source... anyone have a good idea of how to accomplish this : without using java-script? : Thanks in advance, : Jas : : : : -- : PHP Database Mailing List (http://www.php.net/) : To unsubscribe, visit: http://www.php.net/unsub.php : -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL gets blind!
Hi! On a site I'm developing I need to conduct boolean searches. I use a piece of code I found on: http://www.evolt.org/article/comment/18/15665/ and I've got to say it works really well. The problem is I cannot search for one specific word because, even though the word exists on several records, MySQL never returns any rows. The word I can't look for is "portaria". Any other word works just fine. I have tried every word I could think of and it works... except for that one: "portaria". Here is the syntax: SELECT *, match (titulo,estado,sumario,categoria,tipo,pachave) against (' portaria ') as relevance FROM dgf_net.dgf_lex WHERE match (titulo,estado,sumario,categoria,tipo,pachave) against ('portaria')>0 HAVING relevance>0 ORDER BY relevance DESC And here is a view of the table: Field Type Attributes Null Default Extra id int(11) Noauto_increment insdata datetime No -00-00 00:00:00 startdata datetime No -00-00 00:00:00 area tinytext No autor varchar(255) No titulo varchar(255) No subtitulo varchar(255) No texto text No anexo tinytext No pachave varchar(255) No obs tinytext No activo char(1) No N validade datetime No -00-00 00:00:00 imagem varchar(255) No cafe varchar(8) No Indexes : Keyname Type Cardinality Field PRIMARY PRIMARY 31 id id INDEX None id titulo FULLTEXT None titulo subtitulo texto 1 pachave I'm puzzled! Why is MySQL picky about this specific word? MySQL is 3.23.36 and PHP 4.0.4pl1 Any help is appreciated! :-) jcv :: cdb.pnorte.pt :: #26527125 :: :: 02-14-2002 21:12:07 :: :: A beer doesn't mind when your mother visits. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] inserting a bitmap into an Image
Does anyone know how to put a bitmap into an Image? I need to have a filled circle in a graph. This shouldn't be a problem except we have an older version of GD (and our network guy is overworked so it would take a few weeks to get a newer version installed) and the graph has gridlines. If I make a circle and then fill it it will fill up to a gridline but leave the rest of the circle empty. I was hoping to get a filled circle file and use that in my Image but I can't find anything on PHP.net. I'd really appreciate any ideas you might have! Thanks! -Natalie Natalie S. Leotta Information Management Services, Inc. (301) 680-9770 [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Deleting from a select list ? :-(
Dave, First, you need a "SELECT" tags. print ""; $deloptions_sql = "select * from $tbn2"; $delresult = mysql_query($deloptions_sql, $con) or die("error:".mysql_error()); while ($listdelrows = mysql_fetch_array($delresult) ){ $name2 = $listdelrows[name]; $id2 = $listdelrows[id]; $del_list .="$name2"; } print ""; Second, are you trying to do the above and this in one script? if($delproduct){ $del_sql ="delete from $tbn2 where id = '$id2' and name ='$name2'"; $del_res = mysql_query($del_sql,$con) or die ("Unable to Delete Product"); $delproductmsg = "Deleted $name2 from $p_cat_name"; } if so, you need some more structure... Show more of your script instead of what YOU think we ought to see. You have left out big chunks. I promise, we won't steal your coding for our own nefarious uses rick -Original Message- From: Dave Carrera [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 11:04 AM To: php List Subject: [PHP-DB] Deleting from a select list ? :-( Hi All, I have this code creating a list in a select box. All works ok, I get my list BUT and a NIG BUT. When I select an item to delete it only ever deletes from the last record to the top. Err why ? I think all my code is in the right order but obviously not. Can anyone throw some light on this. As always thanks for past and future help Dave C :-) --MY CODE STARTS HERE --- $deloptions_sql = "select * from $tbn2"; $delresult = mysql_query($deloptions_sql, $con) or die("error: ".mysql_error()); $delrows = mysql_num_rows($delresult); for ($i = 0; $i < $delrows; $i++) { $listdelrows = mysql_fetch_array($delresult); $name2 = $listdelrows[name]; $id2 = $listdelrows[id]; $del_list .="$name2"; } if($delproduct){ $del_sql ="delete from $tbn2 where id = '$id2' and name ='$name2'"; $del_res = mysql_query($del_sql,$con) or die ("Unable to Delete Product"); $delproductmsg = "Deleted $name2 from $p_cat_name"; } --ENDS HERE--- Dave Carrera Website Designer http://www.davecarrera.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Form Validation
addslashes(), stripslashes(), strip_tags(), nl2br() , htmlspecialchars() etc. etc ... check PHP online documentation for more info on them.. But even without those functions, the data inserted thru form wouldn't crash MySQL .. The worst that can happen is if the data has quotes or wrong format etc. the data wouldn't be inserted into MySQL database.. Gurhan -Original Message- From: jas [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 2:32 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Form Validation Anyone know of a good function to strip characters and stuff that would cause mysql to crash from forms? Jas -- 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] PHP/MySQL to DBF
Hello all, I'm looking for a PHP tool that would take the results of a MySQL query and send them to a client browser in DBF format. I wrote an output tool that sends a query result as CSV to the browser, but DBFs are much more handy in this particular case. Does this exist? If not, I can write it - but it'll be a pain in the neck. Couldn't find one on sourceforge.net or the other repositories. Thanks, Dan Barton -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Form Validation
addslashes() stripslashes() Your question is vague... -Original Message- From: jas [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 1:32 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Form Validation Anyone know of a good function to strip characters and stuff that would cause mysql to crash from forms? Jas -- 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] Disable Right click w/ php?
At a philosophical level, I don't think this should be done -- I don't want people messing with my browser settings, because sure as shooting they will not be restored when I leave the site. What is so precious in the HTML that one can't view the source? Miles At 12:12 PM 2/14/2002 -0600, Rick Emery wrote: >You can't do this using PHP, because PHP is server-side. You will need >JavaScript. > >-Original Message- >From: jas [mailto:[EMAIL PROTECTED]] >Sent: Thursday, February 14, 2002 12:18 AM >To: [EMAIL PROTECTED] >Subject: [PHP-DB] Disable Right click w/ php? > > >I have been looking on php.net for a function to disallow people to right >click to view source... anyone have a good idea of how to accomplish this >without using java-script? >Thanks in advance, >Jas > > > >-- >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] Form Validation
Anyone know of a good function to strip characters and stuff that would cause mysql to crash from forms? Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Fwd: php-db Digest 11 Feb 2002 20:12:53 -0000 Issue 1046
Neil, > My 2 cents : > > In fact Todd has also been spouting ( moaning? ) on the Windows/PHP > list too ;-) > > Certainly, parsing Word docs is not necessarily a PHP-DB issue, but an > interesting problem or hack nonetheless. > IMHO M$ have set themselves up for 'illegal' hacking of their file formats > simply by virtue of their widespread use and insistence on not releasing > the source for their products. But surely, this sort of stuff is worth > considering as an exercise - if *everything* was easy there would be no > jobs for people in the IT industry generally! > > >=Word is a Microsoft product. Have you been moaning on their lists (always > >assuming anyone from Microsoft > >actually responds/is helpful on such lists), asking where the Word-PHP > >interface is? Why attack only one side of > >the 'problem'? Perhaps like many others you have a perception that > >Microsoft couldn't care less about what you > >are trying to do? Why then make "the Open Source community" your whipping > >boys (and girls)? > > Hope you guys have cooled off & settled your differences. DL Neil finished > his rather vehement discussion of the benefits of open-source > et al , by *providing 3 helpful suggestions* how to tackle the overriding > problem. I think perhaps 'childish remarks' might be an appropriate > description *IF* the remarks were meant as a personal attack, rather than > an expression that perhaps this list is not appropriate for > reverse-engineering discussions. > > >>I don't know what crawled up your ass and died or pissed in your > >> cheerios this morning. > > >>Geez, whats with you types? I mean, You think Open Source is the > >>ultimate solution and Bill Gates it the evil empire. Grow up and don't > >>respond to my inquiries. I don't like childish remarks from an > >>incompetent fool > > Competence is in the eye of the beholder ( ducks under desk for protection ! ) > > I've only been on this list for a few weeks, but it's proved very helpful > for my development, to think about solutions to other peoples problems, and > provide help where possible. Very grateful for the input others have > generously provided. I think though that the nature of this list is > probably more for newbies than experienced MCP or open-source guru > discussions, preferably for discussion of PHP and Databases - and welcome > any flames suggesting otherwise In fact this list provides an interesting mix of problems for/from 'newbies' and 'gurus' alike, and let's face it, the 'triad'/LAMPS offers such an amazing 'width' of facilities, few people would claim to be 'experts' across the board - so someone who can perform extremely complex SQL SELECTs might find PHP a major challenge, and vice-versa. I certainly enjoy the learning/stimulation. 'Decoding' Word would be an 'interesting hack' - although I don't think such would be necessary. Following up on some of this thread's references - and their references, eg Alain's article shows that the COM interface allows easy (and perfectly legal/expected) access to MS/Word functionality. From then on it seems possible to perform anything that Word will do from the keyboard (I'm not VBA-competent - just know enough to slightly extend macros). Trouble is, those commands are not PHP (etc) - this would require Word/VBA mastery! One day I'll have 'a chat' with one of our Office specialists - who does know his MS oats, and see how realistic it might be. Unfortunately it has not been my experience that the MS 'support' lists are as friendly and competent/quick to respond as are the various PHP and MySQL communities! Thank you for your comment about competence. Although he has said nothing to me/about it, I notice that Todd has taken 'my' suggestion to his client and received positive feedback. Sometimes technical questions can be best tackled in the non-technical environment! It often pays to step back from the coal-face to take a wider look at a 'problem'. You observe my comments to be vituperative - and yes they were. I will apologise if you think they were overly so. Note that the Microsoft-OpenSource issue was raised previously - mine was a reply/riposte. Some want to dish it out, but can't take it. Certainly I took issue with 'blame' or 'complaint' being laid one-sidedly at the door of PHP/OpenSource - it would be unusual for some incompatibility between two products to belong exclusively with any one or the other? Certainly MS won't accede any fault - even between Access and the rest of MS-Office! The superb ironies are that the best (from the client's point of view) answer he has came from the guy he least admires (shall we say...); and that my history (in PCs at least) is Microsoft through-and-through (some would guess that's how I know about Word) and I count myself as still very much a learner in the LAMPS environment. Unfortunately (speaking for myself) there was a 'personal' component. As you observed, the individual has a reputation for 'moaning'
RE: [PHP-DB] Time Question
Use: date("n/j/Y g:i:s A"); If you need any more help on what the letters mean, or you need to change the layout visit: http://www.php.net/manual/en/function.date.php keTTle_drum. >>Hi there. Got a bit of a snag. I'm migrating an ASP app to PHP with a >>mssql7.0 backend. The snag is this, I have a 'starttime' field in my db >>using the 'datetime' format ... looks like this 2/14/2002 12:21:28 PM. >>Unfortuanely, I'm unable to convert this field to type integer at the >>present time. >>How would I get the current time in the same format as above (2/14/2002 >>12:21:28 PM) for insertion to the db in a datetime field datatype? >>Thx Joe :) _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Time Question
Thx Rick :) Appreciate your help :) Cheers, Joe "Rick Emery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > $t = date("m/d/Y h:i:s A", gettimeofday()); > print $t; > ?> > -Original Message- > From: Lerp [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 14, 2002 12:45 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Time Question > > > Hi there. Got a bit of a snag. I'm migrating an ASP app to PHP with a > mssql7.0 backend. The snag is this, I have a 'starttime' field in my db > using the 'datetime' format ... looks like this 2/14/2002 12:21:28 PM. > Unfortuanely, I'm unable to convert this field to type integer at the > present time. > > How would I get the current time in the same format as above (2/14/2002 > 12:21:28 PM) for insertion to the db in a datetime field datatype? > > Thx Joe :) > > > > -- > 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] Time Question
CORRECTION: -- C:\>php -f a.php 02/14/2002 12:49:50 PM -Original Message- From: Lerp [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 12:45 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Time Question Hi there. Got a bit of a snag. I'm migrating an ASP app to PHP with a mssql7.0 backend. The snag is this, I have a 'starttime' field in my db using the 'datetime' format ... looks like this 2/14/2002 12:21:28 PM. Unfortuanely, I'm unable to convert this field to type integer at the present time. How would I get the current time in the same format as above (2/14/2002 12:21:28 PM) for insertion to the db in a datetime field datatype? Thx Joe :) -- 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] Time Question
-Original Message- From: Lerp [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 12:45 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Time Question Hi there. Got a bit of a snag. I'm migrating an ASP app to PHP with a mssql7.0 backend. The snag is this, I have a 'starttime' field in my db using the 'datetime' format ... looks like this 2/14/2002 12:21:28 PM. Unfortuanely, I'm unable to convert this field to type integer at the present time. How would I get the current time in the same format as above (2/14/2002 12:21:28 PM) for insertion to the db in a datetime field datatype? Thx Joe :) -- 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] A while loop prob ?
Try this if ($submit) { if($search == "") { $error1 = "No Records found. Please use at least 1 character in search box"; } else { $srchsql = "select * from $tbn where name like \"%$search%\" "; $srchresult = mysql_query($srchsql, $con); $name =$srchrow['name']; $details =$srchrow['details']; $price =$srchrow['price']; $imgloc =$srchrow['imgloc']; while (list($name, $details, $price, $imgloc) = mysql_fetch_array($srchresult)) { $display_srch_rows .= "$imgloc$name$details$price"; } echo $display_srch_rows; } } the problem is, you were overwriting your results each time you went into the loop therefor always ending up with the last returned result set. if you use " .= " instead of " = " you will concat the results, therefor making one long string. then echo/print the $display_srch_rows variable. Jim Lucas - Original Message - From: "Dave Carrera" <[EMAIL PROTECTED]> To: "php List" <[EMAIL PROTECTED]> Sent: Wednesday, February 13, 2002 11:40 AM Subject: [PHP-DB] A while loop prob ? > Hi All > > What have I done wrong here. > > 3 yes 3 hours I have been plaing with this loop. > > All it shows is the last record in my db. > > It should show and record containing any string in the search. > > Error works > > Please help I beg you... > > As always thank you for any help > > Dave C > > - My Code Starts Here > > if ($submit){ > if($search == ""){ > $error1 = "No Records found. Please use at least > 1 character in search box"; > } > else > { > $srchsql = "select * from $tbn where name like \"%$search%\" "; > $srchresult = mysql_query($srchsql, $con); > $name =$srchrow['name']; > $details =$srchrow['details']; > $price =$srchrow['price']; > $imgloc =$srchrow['imgloc']; > while (list($name, $details, $price, $imgloc) > =mysql_fetch_array($srchresult)){ > > $display_srch_rows = > "$imgloc$name$details$price > "; > } > } > } > > Dave Carrera > Website Designer > http://www.davecarrera.com > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Time Question
Hi there. Got a bit of a snag. I'm migrating an ASP app to PHP with a mssql7.0 backend. The snag is this, I have a 'starttime' field in my db using the 'datetime' format ... looks like this 2/14/2002 12:21:28 PM. Unfortuanely, I'm unable to convert this field to type integer at the present time. How would I get the current time in the same format as above (2/14/2002 12:21:28 PM) for insertion to the db in a datetime field datatype? Thx Joe :) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing form values with quotes, to itself
it is called magic quotes and it can be enabled through the php.ini file. Jim Lucas - Original Message - From: "William Fong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 13, 2002 10:36 AM Subject: Re: [PHP-DB] Passing form values with quotes, to itself > Doesn't PHP have something that will automatically do this? I can't > remember, but I think you had to enable it in php.ini or when you compile. > > (just like to know for future reference). > > thx. > > -w > > -- > William Fong - [EMAIL PROTECTED] > Phone: 626.968.6424 x210 | Fax: 626.968.6877 > Wireless #: 805.490.7732| Wireless E-mail: [EMAIL PROTECTED] > > > > > - Original Message - > From: "David Fudge" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, February 13, 2002 10:12 AM > Subject: Re: [PHP-DB] Passing form values with quotes, to itself > > > : before you submit to the db, you have to escape the quotes like this: > : > : $Body = addslashes($Body); > : all " " will show up as \" \" > : and ' ' will be \' \' > : > : when you pull the info from the db, you'll have to use "stripslashes()" to > : remove those you put in. > : $Body = stripslashes($Body_from_db); > : > : - Original Message - > : From: "Faye Keesic" <[EMAIL PROTECTED]> > : To: <[EMAIL PROTECTED]> > : Sent: Wednesday, February 13, 2002 1:02 PM > : Subject: [PHP-DB] Passing form values with quotes, to itself > : > : > : > Hi there. > : > > : > I have a form that contains several fields w/ text info (which may or > may > : > not contain single and double quotes). > : > > : > When the user clicks Preview, the form's action is set to call itself > : > ($PHP_SELF), and the info is displayed nicely so they can read it over, > : and > : > verify it before saving to the db. > : > > : > What I'm having problems with is that when the data has quotes, the text > : > data cuts off. > : > > : > If I use: > : > then double quotes are cut off. > : > > : > If I use: > : > then single quotes are cut off. > : > > : > I want nothing cut off! I've tried addslashes()..still cuts off. > : > > : > I hope that all made sense... > : > -- > : > Faye > : > > : > > : > -- > : > PHP Database Mailing List (http://www.php.net/) > : > To unsubscribe, visit: http://www.php.net/unsub.php > : > > : > : > : -- > : PHP Database Mailing List (http://www.php.net/) > : To unsubscribe, visit: http://www.php.net/unsub.php > : > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Disable Right click w/ php?
No way. PHP is server-side. Javascript is mostly clientside. Best regards, Andrey Hristov - Original Message - From: "jas" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 14, 2002 8:17 AM Subject: [PHP-DB] Disable Right click w/ php? > I have been looking on php.net for a function to disallow people to right > click to view source... anyone have a good idea of how to accomplish this > without using java-script? > Thanks in advance, > Jas > > > > -- > 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] Disable Right click w/ php?
You can't do this using PHP, because PHP is server-side. You will need JavaScript. -Original Message- From: jas [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 12:18 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Disable Right click w/ php? I have been looking on php.net for a function to disallow people to right click to view source... anyone have a good idea of how to accomplish this without using java-script? Thanks in advance, Jas -- 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] Disable Right click w/ php?
I have been looking on php.net for a function to disallow people to right click to view source... anyone have a good idea of how to accomplish this without using java-script? Thanks in advance, Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Deleting from a select list ? :-(
Is all of this code on one page or do you have the select part on a form on one page and the delete on another page? If this is all on one page, then it would only delete the last record because that was the last value of $id2 after the loop to fill the drop down. In order to select a certain record to delete, you will need to select the item from the drop down list and then submit it to another page to do the delete. HTH Maureen Biorn Dave Carrera <[EMAIL PROTECTED]> said: > Hi All, > I have this code creating a list in a select box. > > All works ok, I get my list BUT and a NIG BUT. > > When I select an item to delete it only ever deletes from the last > record to the top. > > Err why ? > > I think all my code is in the right order but obviously not. > > Can anyone throw some light on this. > > As always thanks for past and future help > > Dave C :-) > > --MY CODE STARTS HERE --- > > $deloptions_sql = "select * from $tbn2"; > $delresult = mysql_query($deloptions_sql, $con) or die("error: > ".mysql_error()); > $delrows = mysql_num_rows($delresult); > for ($i = 0; $i < $delrows; $i++) { > $listdelrows = mysql_fetch_array($delresult); > $name2 = $listdelrows[name]; > $id2 = $listdelrows[id]; > $del_list .=" value="$id2">$name2"; > } > > if($delproduct){ > $del_sql ="delete from $tbn2 where id = '$id2' and name = > '$name2'"; > $del_res = mysql_query($del_sql,$con) or die ("Unable to Delete > Product"); > $delproductmsg = "Deleted $name2 from $p_cat_name"; > } > --ENDS HERE--- > Dave Carrera > Website Designer > http://www.davecarrera.com > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Deleting from a select list ? :-(
Hi All, I have this code creating a list in a select box. All works ok, I get my list BUT and a NIG BUT. When I select an item to delete it only ever deletes from the last record to the top. Err why ? I think all my code is in the right order but obviously not. Can anyone throw some light on this. As always thanks for past and future help Dave C :-) --MY CODE STARTS HERE --- $deloptions_sql = "select * from $tbn2"; $delresult = mysql_query($deloptions_sql, $con) or die("error: ".mysql_error()); $delrows = mysql_num_rows($delresult); for ($i = 0; $i < $delrows; $i++) { $listdelrows = mysql_fetch_array($delresult); $name2 = $listdelrows[name]; $id2 = $listdelrows[id]; $del_list .="$name2"; } if($delproduct){ $del_sql ="delete from $tbn2 where id = '$id2' and name = '$name2'"; $del_res = mysql_query($del_sql,$con) or die ("Unable to Delete Product"); $delproductmsg = "Deleted $name2 from $p_cat_name"; } --ENDS HERE--- Dave Carrera Website Designer http://www.davecarrera.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] counting multiple columns based on different values
OK, this time tested :) SELECT Clients.ClientName, Ratings.Status, Count(*) FROM Clients LEFT JOIN Ratings ON Clients.ID = Ratings.ClientID GROUP BY ClientName, Ratings.Status HAVING Ratings.Status = 2 OR Ratings.Status = 3 regards, Peter Software Engineer / Trainer Vervoorn IT - Original Message - From: "Peter Vervoorn" <[EMAIL PROTECTED]> To: "php-db list" <[EMAIL PROTECTED]> Sent: Thursday, February 14, 2002 9:36 AM Subject: Re: [PHP-DB] counting multiple columns based on different values > This should do the trick (untested): > > SELECT ClientName, Count(*) FROM Clients LEFT JOIN Ratings ON Clients.ID = > Ratings.ClientID > GROUP BY ClientName > HAVING Ratings.Status = 2 OR Ratings.Status = 3 > > > regards, > > Peter > Software Engineer / Trainer > Vervoorn IT -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Logging visits using a database
ummm i am currently using http://www.ezboo.com/ to look @ how it comes out hea to http://lollan.qldgamers.com/ I like it. Shooter - Original Message - From: Peter Lovatt <[EMAIL PROTECTED]> To: Jason Wong <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, February 14, 2002 9:05 PM Subject: RE: [PHP-DB] Logging visits using a database > > > On Thursday 14 February 2002 07:29, Peter Lovatt wrote: > > > Hi > > > > > > Excuse the cross post > > > > > > I am thinking about building a logging tool to do visit > > analysis using SQL, > > > rather than doing log file analysis. > > > > > > The aim is to analyse requests for dynamic pages called via php > > as well as > > > static pages. Static pages will use an include for logging. Php > > calls may > > > have two or three extra parameters which relate to products that are > > > displayed (this is for ecommerce) which I also want to log. I am looking > > > particularly at HTTP_REFERER, paths through the site, and most viewed > > > products. > > > > > > Questions > > > > > > 1. Am I reinventing the wheel? and would it be better to buy a package > > > (Spending money brings me out in a nasty rash, and leaves me feeling a > > > little unsteady on my feet, but is sometimes the best option), or use a > > > free one. The intended audience is non technical managerial type bods so > > > nothing too difficult to understand :) > > > > I would say you are :) Something like Analog would probably do > > all you need > > to do and more. But it doesn't use a database. > > As far as I can see, it does not track referrers and paths through the site, > and a simple pages visited (it includes all the requests for graphics etc ) > > It is also a bit overwhelming for non techies, even with the nicer > interfaces. > > > > > I've done something similar. In apache I pipe the logs through a > > little perl > > program which writes the info directly into an MySQL database. On > > one setup, > > a PII 300/448MB machine *easily* handles 10K requests a day. The table > > (indexed) is nearly up to 1 million rows and shows no > > (noticeable) signs of > > slowing down. > > Great, that was one of my bigger concerns > > > > > > 4. Is a (MySql?) database driven system a good answer, or just the wrong > > > way to go?? > > > > Depends on how dynamic you want your analysis to be. And whether > > you can put > > up with long query times. In the above system some analysis can > > take up to 30 > > secs to perform. > > > > My reason for using a db was complete flexibility in analysing > > the data in > > any which way I want. > > Me too > > > > > Getting the info into the db is the easy part -- I could send you > > the perl > > script that I use. The hard bit is coming up with the necessary > > queries to > > extract the info from the db. > > > That would be much appreciated, please send it to [EMAIL PROTECTED] > > > > > > > > > -- > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > > > /* > > There's so much to say but your eyes keep interrupting me. > > */ > > > > -- > > 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] Re: How To Upload
You can use the GD module in PHP to accept and resize the images. Currently (do to copyright restrictions) the GD libraries ONLY work with .jpg and .png graphics. This form will only allow you to upload one image at a time, so you'd have to 1) Make a script to accept and resize the files and then 2) Create some sort of loop to continualy accept and process multiple files. The only way I can think to do this is to ftp the files to a temporary location on the server and then manualy run a while loop in UNIX. ex. For Each 'ls *.jpg' as $i script.php $t (Check syntax on this one) Perhaps the forum has another idea? (Returned copy.) -Jonathan - Original Message - From: "Luke Thomas" <[EMAIL PROTECTED]> To: "Jonathan Underfoot" <[EMAIL PROTECTED]> Sent: Sunday, October 14, 2001 5:10 AM Subject: Re: How To Upload > Hi, >This Mail interested me very much, I am currently trying to create my > own personal photo album, and I was wondering about how to upload jpg's. Is > there a way that you could upload more than 1 at a time? Also I would like > to resize the images to thumbnails aswell. Do I need the GD module installed > to be able to manipulate the images? > > Hope you can help. > Luke Thomas > > - Original Message - > From: "Jonathan Underfoot" <[EMAIL PROTECTED]> > Newsgroups: php.db > To: "[PHP-DB]" <[EMAIL PROTECTED]> > Sent: Friday, February 08, 2002 10:28 PM > Subject: Re: How To Upload > > > > Heres a form and the PHP behind it I use: > > <---FORM---> > > > > Add Pic > > > > > Pic to Upload(Only .jpg and .gif files) > > > > > > > <---PHP FILE---> > if (is_uploaded_file($userfile)) { > copy($userfile, "location/filename.xxx"); > }} else { > echo "That diddn't work!"; > } > header ("Location: http://www.underfoot.cc/";); > ?> > > I do much more with it (resize and edit images etc etc) but thats the basic > layout... > > -Jonathan > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Logging visits using a database
> On Thursday 14 February 2002 07:29, Peter Lovatt wrote: > > Hi > > > > Excuse the cross post > > > > I am thinking about building a logging tool to do visit > analysis using SQL, > > rather than doing log file analysis. > > > > The aim is to analyse requests for dynamic pages called via php > as well as > > static pages. Static pages will use an include for logging. Php > calls may > > have two or three extra parameters which relate to products that are > > displayed (this is for ecommerce) which I also want to log. I am looking > > particularly at HTTP_REFERER, paths through the site, and most viewed > > products. > > > > Questions > > > > 1. Am I reinventing the wheel? and would it be better to buy a package > > (Spending money brings me out in a nasty rash, and leaves me feeling a > > little unsteady on my feet, but is sometimes the best option), or use a > > free one. The intended audience is non technical managerial type bods so > > nothing too difficult to understand :) > > I would say you are :) Something like Analog would probably do > all you need > to do and more. But it doesn't use a database. As far as I can see, it does not track referrers and paths through the site, and a simple pages visited (it includes all the requests for graphics etc ) It is also a bit overwhelming for non techies, even with the nicer interfaces. > > I've done something similar. In apache I pipe the logs through a > little perl > program which writes the info directly into an MySQL database. On > one setup, > a PII 300/448MB machine *easily* handles 10K requests a day. The table > (indexed) is nearly up to 1 million rows and shows no > (noticeable) signs of > slowing down. Great, that was one of my bigger concerns > > > 4. Is a (MySql?) database driven system a good answer, or just the wrong > > way to go?? > > Depends on how dynamic you want your analysis to be. And whether > you can put > up with long query times. In the above system some analysis can > take up to 30 > secs to perform. > > My reason for using a db was complete flexibility in analysing > the data in > any which way I want. Me too > > Getting the info into the db is the easy part -- I could send you > the perl > script that I use. The hard bit is coming up with the necessary > queries to > extract the info from the db. That would be much appreciated, please send it to [EMAIL PROTECTED] > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > There's so much to say but your eyes keep interrupting me. > */ > > -- > 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] counting multiple columns based on different values
John, > I'm gonna go out on a limb and guess that I'm missing > something obvious (and easy) because this sure seems > like it should be able to be done. > > Here's the issue: I need to pull the client name and > ID out of one table and then, count the records in a > different table (called ratings) that match two > different criteria. > > If I was doing 2 different sql statments, they would > look like this: > > select clientname, clients.ID, count(*) FROM clients, > ratings WHERE clients.ID = ratings.clientID AND > ratings.status = '2' > select clientname, clients.ID, count(*) FROM clients, > ratings WHERE clients.ID = ratings.clientID AND > ratings.status = '3' > > In a perfect world, I'd be able to receive the > following data from a single query: > > > | ClientName | ClientID | Status-2 | Status-3| > | Bob| 28 | 103 | 87 | > | Steve | 29 | 11 | 106 | > | Jerry | 30 | 50 | 82 | > > I sure hope I explained that well enough. Let's break it down into smaller problems: 1 getting the data out of the clients tbl 2 getting the first ratings criteria 3 getting the second ratings criteria The first is so trivial I won't bore you further. The second you also solved: add a join and a COUNT(*) group. Adding/combining with the third is where the problems lie! The key issue is the last word - "group". The second ratings criteria demands a different grouping. So can you declare the ratings table twice? SELECT clientname, clients.ID, COUNT(two.status), COUNT(three.status) FROM clients, ratings as two, ratings as three WHERE clients.ID = two.clientID AND two.status = '2' AND clients.ID = three.clientID AND three.status = '3' Apologies for my lack of time to prepare a sample db and test this - but you have the data already, so please give it a go. If it doesn't work, come back to us, and someone/I will show you how to solve the problem as a 'pivot table'. Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Logging visits using a database
On Thursday 14 February 2002 07:29, Peter Lovatt wrote: > Hi > > Excuse the cross post > > I am thinking about building a logging tool to do visit analysis using SQL, > rather than doing log file analysis. > > The aim is to analyse requests for dynamic pages called via php as well as > static pages. Static pages will use an include for logging. Php calls may > have two or three extra parameters which relate to products that are > displayed (this is for ecommerce) which I also want to log. I am looking > particularly at HTTP_REFERER, paths through the site, and most viewed > products. > > Questions > > 1. Am I reinventing the wheel? and would it be better to buy a package > (Spending money brings me out in a nasty rash, and leaves me feeling a > little unsteady on my feet, but is sometimes the best option), or use a > free one. The intended audience is non technical managerial type bods so > nothing too difficult to understand :) I would say you are :) Something like Analog would probably do all you need to do and more. But it doesn't use a database. > 2. If I do use an existing package, are there any that are good with > dynamic sites and the parameters passed to scripts, rather than just > logging static pages? Don't know. > 3. Writing a database driven stats package on a medium traffic site (3-500 > visits a day, Average 8-12 pages per visit=6000 inserts a day, peaking at > 2-3 per second ) will mean lots of inserts, and a few reads when the > analysis is run. Running MySql on a 1.5GHz 512MB machine, is it better to > leave the table unindexed and put up with slow analysis, or will the > machine cope with indexes? The data could be aggregated periodically, but > if possible left intact for up to a year to follow trends. I've done something similar. In apache I pipe the logs through a little perl program which writes the info directly into an MySQL database. On one setup, a PII 300/448MB machine *easily* handles 10K requests a day. The table (indexed) is nearly up to 1 million rows and shows no (noticeable) signs of slowing down. > 4. Is a (MySql?) database driven system a good answer, or just the wrong > way to go?? Depends on how dynamic you want your analysis to be. And whether you can put up with long query times. In the above system some analysis can take up to 30 secs to perform. My reason for using a db was complete flexibility in analysing the data in any which way I want. > Any thoughts and experience much appreciated before I commit to hours of > work and gallons of coffee Getting the info into the db is the easy part -- I could send you the perl script that I use. The hard bit is coming up with the necessary queries to extract the info from the db. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* There's so much to say but your eyes keep interrupting me. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] RE: Logging visits using a database
i think i saw an article on phpbuilder.com regarding how to set up a good thing for the path taken - something along the lines of storing IP vs time vs page hit, then a good method for selecting from the db that shows the path of the visitor HTH beau // -Original Message- // From: Peter Lovatt [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 14 February 2002 4:39 PM // To: Gurhan Ozen; Peter Lovatt; [EMAIL PROTECTED] // Subject: [PHP-DB] RE: Logging visits using a database // // // Thanks. // // Analog only does basic 'what files have people viewed?' type // reports, which // offers some of the insight I am looking for, but not the // path through the // site etc. Also the output confuses non techies. Any other thouhts? // // TIA // Peter // // --- // Excellence in internet and open source software // --- // Sunmaia // www.sunmaia.net // [EMAIL PROTECTED] // tel. 0121-242-1473 // --- // // > -Original Message- // > From: Gurhan Ozen [mailto:[EMAIL PROTECTED]] // > Sent: 14 February 2002 03:09 // > To: Peter Lovatt; [EMAIL PROTECTED] // > Subject: RE: Logging visits using a database // > // > // > Hi // > I have never used it but sounds like analog would fit your // needs pretty // > well. Check them out at: // > http://analog.sourceforge.net/ // > // > Hope this helps.. // > // > Gurhan // > // > // > -Original Message- // > From: Peter Lovatt [mailto:[EMAIL PROTECTED]] // > Sent: Wednesday, February 13, 2002 6:29 PM // > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] // > Subject: Logging visits using a database // > // > // > Hi // > // > Excuse the cross post // > // > I am thinking about building a logging tool to do visit analysis // > using SQL, // > rather than doing log file analysis. // > // > The aim is to analyse requests for dynamic pages called // via php as well as // > static pages. Static pages will use an include for // logging. Php calls may // > have two or three extra parameters which relate to // products that are // > displayed (this is for ecommerce) which I also want to // log. I am looking // > particularly at HTTP_REFERER, paths through the site, and // most viewed // > products. // > // > Questions // > // > 1. Am I reinventing the wheel? and would it be better to // buy a package // > (Spending money brings me out in a nasty rash, and leaves // me feeling a // > little unsteady on my feet, but is sometimes the best option), or // > use a free // > one. The intended audience is non technical managerial type bods // > so nothing // > too difficult to understand :) // > // > 2. If I do use an existing package, are there any that are good // > with dynamic // > sites and the parameters passed to scripts, rather than just // > logging static // > pages? // > // > 3. Writing a database driven stats package on a medium // traffic site (3-500 // > visits a day, Average 8-12 pages per visit=6000 inserts a // day, peaking at // > 2-3 per second ) will mean lots of inserts, and a few // reads when the // > analysis is run. Running MySql on a 1.5GHz 512MB machine, // is it better to // > leave the table unindexed and put up with slow analysis, or will // > the machine // > cope with indexes? The data could be aggregated // periodically, but if // > possible left intact for up to a year to follow trends. // > // > 4. Is a (MySql?) database driven system a good answer, or just // > the wrong way // > to go?? // > // > Any thoughts and experience much appreciated before I // commit to hours of // > work and gallons of coffee // > // > Thanx // > // > Peter // > // > // > --- // > Excellence in internet and open source software // > --- // > Sunmaia // > www.sunmaia.net // > [EMAIL PROTECTED] // > tel. 0121-242-1473 // > --- // > // > // > // - // > Before posting, please check: // >http://www.mysql.com/manual.php (the manual) // >http://lists.mysql.com/ (the list archive) // > // > To request this thread, e-mail <[EMAIL PROTECTED]> // > To unsubscribe, e-mail // > <[EMAIL PROTECTED]> // > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] counting multiple columns based on different values
This should do the trick (untested): SELECT ClientName, Count(*) FROM Clients LEFT JOIN Ratings ON Clients.ID = Ratings.ClientID GROUP BY ClientName HAVING Ratings.Status = 2 OR Ratings.Status = 3 regards, Peter Software Engineer / Trainer Vervoorn IT - Original Message - From: "John Hawkins" <[EMAIL PROTECTED]> To: "php-db list" <[EMAIL PROTECTED]> Sent: Thursday, February 14, 2002 3:11 AM Subject: [PHP-DB] counting multiple columns based on different values > I'm gonna go out on a limb and guess that I'm missing > something obvious (and easy) because this sure seems > like it should be able to be done. > > Here's the issue: I need to pull the client name and > ID out of one table and then, count the records in a > different table (called ratings) that match two > different criteria. > > If I was doing 2 different sql statments, they would > look like this: > > select clientname, clients.ID, count(*) FROM clients, > ratings WHERE clients.ID = ratings.clientID AND > ratings.status = '2' > select clientname, clients.ID, count(*) FROM clients, > ratings WHERE clients.ID = ratings.clientID AND > ratings.status = '3' > > In a perfect world, I'd be able to receive the > following data from a single query: > > > | ClientName | ClientID | Status-2 | Status-3| > | Bob| 28 | 103 | 87 | > | Steve | 29 | 11 | 106 | > | Jerry | 30 | 50 | 82 | > > I sure hope I explained that well enough. > > Thanks! > > John > > __ > Do You Yahoo!? > Send FREE Valentine eCards with Yahoo! Greetings! > http://greetings.yahoo.com > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Logging visits using a database
Thanks. Analog only does basic 'what files have people viewed?' type reports, which offers some of the insight I am looking for, but not the path through the site etc. Also the output confuses non techies. Any other thouhts? TIA Peter --- Excellence in internet and open source software --- Sunmaia www.sunmaia.net [EMAIL PROTECTED] tel. 0121-242-1473 --- > -Original Message- > From: Gurhan Ozen [mailto:[EMAIL PROTECTED]] > Sent: 14 February 2002 03:09 > To: Peter Lovatt; [EMAIL PROTECTED] > Subject: RE: Logging visits using a database > > > Hi > I have never used it but sounds like analog would fit your needs pretty > well. Check them out at: > http://analog.sourceforge.net/ > > Hope this helps.. > > Gurhan > > > -Original Message- > From: Peter Lovatt [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 13, 2002 6:29 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Logging visits using a database > > > Hi > > Excuse the cross post > > I am thinking about building a logging tool to do visit analysis > using SQL, > rather than doing log file analysis. > > The aim is to analyse requests for dynamic pages called via php as well as > static pages. Static pages will use an include for logging. Php calls may > have two or three extra parameters which relate to products that are > displayed (this is for ecommerce) which I also want to log. I am looking > particularly at HTTP_REFERER, paths through the site, and most viewed > products. > > Questions > > 1. Am I reinventing the wheel? and would it be better to buy a package > (Spending money brings me out in a nasty rash, and leaves me feeling a > little unsteady on my feet, but is sometimes the best option), or > use a free > one. The intended audience is non technical managerial type bods > so nothing > too difficult to understand :) > > 2. If I do use an existing package, are there any that are good > with dynamic > sites and the parameters passed to scripts, rather than just > logging static > pages? > > 3. Writing a database driven stats package on a medium traffic site (3-500 > visits a day, Average 8-12 pages per visit=6000 inserts a day, peaking at > 2-3 per second ) will mean lots of inserts, and a few reads when the > analysis is run. Running MySql on a 1.5GHz 512MB machine, is it better to > leave the table unindexed and put up with slow analysis, or will > the machine > cope with indexes? The data could be aggregated periodically, but if > possible left intact for up to a year to follow trends. > > 4. Is a (MySql?) database driven system a good answer, or just > the wrong way > to go?? > > Any thoughts and experience much appreciated before I commit to hours of > work and gallons of coffee > > Thanx > > Peter > > > --- > Excellence in internet and open source software > --- > Sunmaia > www.sunmaia.net > [EMAIL PROTECTED] > tel. 0121-242-1473 > --- > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php