RE: [PHP] PHP SQL Code
> > > I would like yo show the users in a list that have a date that is more > > > than > > > 60 days old. > > > > $sql = "SELECT * FROM stompers WHERE sUpdated < CUR_DATE() - INTERVAL 60 > > DAY AND sActive = 'Y' ORDER BY sUpdated DESC"; > > This one returns a 'Could not get Query' warning ... so thats out. Sorry, it's CURDATE(), not CUR_DATE(). Maybe you shouldn't be so quick to rule things out... ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP SQL Code
This one returns a 'Could not get Query' warning ... so thats out. - Original Message - From: "John W. Holmes" <[EMAIL PROTECTED]> To: "'Philip J. Newman'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, March 03, 2003 5:31 AM Subject: RE: [PHP] PHP SQL Code > > I would like yo show the users in a list that have a date that is more > > than > > 60 days old. > > $sql = "SELECT * FROM stompers WHERE sUpdated < CUR_DATE() - INTERVAL 60 > DAY AND sActive = 'Y' ORDER BY sUpdated DESC"; > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP SQL Code
> I would like yo show the users in a list that have a date that is more > than > 60 days old. $sql = "SELECT * FROM stompers WHERE sUpdated < CUR_DATE() - INTERVAL 60 DAY AND sActive = 'Y' ORDER BY sUpdated DESC"; ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP SQL Code
I'd use ... WHERE UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(sUpdated) > 60*60*24*60 but I'm sure someone will come up with something more efficient. Tim Ward http://www.chessish.com mailto:[EMAIL PROTECTED] - Original Message - From: Philip J. Newman <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, March 02, 2003 7:46 AM Subject: [PHP] PHP SQL Code > I would like yo show the users in a list that have a date that is more than > 60 days old. > > > $sql = "SELECT * FROM stompers WHERE sUpdated < > from_unixtime(unix_timestamp(now())-(15760*60)) AND sActive = 'Y' ORDER BY > sUpdated DESC"; > > This don't quite work .. > > Any suggestions? > > > -- > Philip J. Newman. > Head Developer > [EMAIL PROTECTED] > > +64 (9) 576 9491 > +64 021-048-3999 > > -- > Friends are like stars > You can't allways see them, > but they are always there. > > -- > Websites: > > PhilipNZ.com - Design. > http://www.philipnz.com/ > [EMAIL PROTECTED] > > Philip's Domain // Internet Project. > http://www.philipsdomain.com/ > [EMAIL PROTECTED] > > Vital Kiwi / NEWMAN.NET.NZ. > http://www.newman.net.nz/ > [EMAIL PROTECTED] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP SQL Code
I would like yo show the users in a list that have a date that is more than 60 days old. $sql = "SELECT * FROM stompers WHERE sUpdated < from_unixtime(unix_timestamp(now())-(15760*60)) AND sActive = 'Y' ORDER BY sUpdated DESC"; This don't quite work .. Any suggestions? -- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- Friends are like stars You can't allways see them, but they are always there. -- Websites: PhilipNZ.com - Design. http://www.philipnz.com/ [EMAIL PROTECTED] Philip's Domain // Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL Query
There is a nice piece of software that you should get, http://ems-hitech.com/mymanager/! It's not free, but you can download a trial. (I would get it) It is great for building querys across tables. -Original Message- From: Zydox [mailto:[EMAIL PROTECTED]] Sent: Friday, February 14, 2003 11:18 PM To: [EMAIL PROTECTED] Subject: [PHP] SQL Query I have a problem writing a query that can select a Interest for a specific user... There are tvo tables, IList and IIndex... IList contains this : ID SubID Interest Valid Edit Delete 1 0 Datorer 0 Edit Delete 2 1 Spel 0 Edit Delete 3 2 Strategi 0 Edit Delete 4 3 Star Craft 1 Edit Delete 5 3 Star Wars: Gallactic Battelinggrounds 1 Edit Delete 6 2 Shoot-Em-Up 0 Edit Delete 7 6 Half-Life 0 Edit Delete 8 7 Team Fortress 1 Edit Delete 9 7 Counter-Strike 1 And IIndex contains a UserID And InterestID... this query : "SELECT DISTINCTROW InterestsList.ID, InterestsList.SubID, InterestsList.Interest, InterestsList.Valid FROM InterestsList AS II RIGHT JOIN InterestsList ON InterestsList.ID=II.SubID LEFT JOIN InterestsIndex ON InterestsList.ID=InterestsIndex.InterestID AND InterestsIndex.UserID='1'" Selects all rows from IList... even if there Is'nt any instans in IIndex... this thougt is that a User can choose a "Valid" Interest and then the query should select all SubInterests... anyone know how to do that ? // Regards Zydox -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Query
I have a problem writing a query that can select a Interest for a specific user... There are tvo tables, IList and IIndex... IList contains this : ID SubID Interest Valid Edit Delete 1 0 Datorer 0 Edit Delete 2 1 Spel 0 Edit Delete 3 2 Strategi 0 Edit Delete 4 3 Star Craft 1 Edit Delete 5 3 Star Wars: Gallactic Battelinggrounds 1 Edit Delete 6 2 Shoot-Em-Up 0 Edit Delete 7 6 Half-Life 0 Edit Delete 8 7 Team Fortress 1 Edit Delete 9 7 Counter-Strike 1 And IIndex contains a UserID And InterestID... this query : "SELECT DISTINCTROW InterestsList.ID, InterestsList.SubID, InterestsList.Interest, InterestsList.Valid FROM InterestsList AS II RIGHT JOIN InterestsList ON InterestsList.ID=II.SubID LEFT JOIN InterestsIndex ON InterestsList.ID=InterestsIndex.InterestID AND InterestsIndex.UserID='1'" Selects all rows from IList... even if there Is'nt any instans in IIndex... this thougt is that a User can choose a "Valid" Interest and then the query should select all SubInterests... anyone know how to do that ? // Regards Zydox -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP PDF parser and FFDB-php SQL wrapper
Hi All, I need to extract text ata from PDF files. Does anyone know if there is a PHP PDF parser? Also, does anyone know if there is a sql wrapper for the ffdb-php project (http://sourceforge.net/projects/ffdb-php/)? John created this wonderful FFDB in PHP, and I was wondering if there are plans to include his FFDB in the next PHP release. I mean, has there been any discussion about adding FFDB as the default database for those who don't have access to a real SQL database. I think adding FFDB support would enhance PHP's popularity. Zlutarch __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sql server -- trusted connection
> From: "Daniel Masson" <[EMAIL PROTECTED]> > > I need help on this urgently. > > I need to connect to a ms sql server usgin windows autentication on a > win 2000 box and IIS 5, i cant switch sql server to windows and sql > authentication, .. I really need to know hot to connect. I know very little about Windows, but I successfully made a COM connection to MS-SQL recently. Here's sample code: $db_connection = new COM("ADODB.Connection"); $db_connstr = "DRIVER={SQL server};server=xdata;database=sampledb;uid=user;pwd=password;"; @$db_connection->open($db_connstr); $select_sql = "SELECT FieldName1, FieldName2, FieldName3 FROM TableName ORDER BY FieldName1"; @$rs = $db_connection->execute($select_sql); if (!$rs) { echo("Unable to make MS-SQL database selection!\n" . "\n" . "\n" . "\n"); exit(); } $rs_fld0 = $rs->Fields(0); $rs_fld1 = $rs->Fields(1); $rs_fld2 = $rs->Fields(2); while (!$rs->EOF) { echo("$rs_fld0->value$rs_fld1->value$rs_fld2->value\n"); $rs->MoveNext(); } $rs->Close(); $db_connection->Close(); -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sql server -- trusted connection
Hello list. I need help on this urgently. I need to connect to a ms sql server usgin windows autentication on a win 2000 box and IIS 5, i cant switch sql server to windows and sql authentication, .. I really need to know hot to connect. Thanks Daniel E Massón. Ingeniero de desarrollo [EMAIL PROTECTED] Imagine S.A. Su Aliado Efectivo en Internet www.imagine.com.co (57 1)2182064 - (57 1)6163218 Bogotá - Colombia - Soluciones web para Internet e Intranet - Soluciones para redes - Licenciamiento de Software - Asesoría y Soporte Técnico -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
> --- Sean Burlington <[EMAIL PROTECTED]> wrote: > > I think the bandwidth wasters are those who ask > > questions poorly (it takes several follow up mails > > to find out what the question was) and those who > > don't have a qucik look at the archives first > > (is someone puuting together an FAQ ?) > > I agree. I think John's response was a simple answer to a > simple question. He was probably tired of trying to > interpret questions from this list. I suppose I take a > similar approach in that I quickly delete questions that > make no sense or only hint at the real question. Perhaps I > am being rude, too, but I'm just quieter about it. :-) > > Oh, and here is a link that I think John alluded to: > > http://www.tuxedo.org/~esr/faqs/smart-questions.html I'm not tired of anything; it was just too vague of a question to be answered, as were the 3 follow-ups that were posted. I still have no idea what the OP wants. After some more searching, this is the FAQ I was looking for: http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-n o-answers.html Note that the original question started with "Does anyone know..." ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL+php
--- Sean Burlington <[EMAIL PROTECTED]> wrote: > I think the bandwidth wasters are those who ask > questions poorly (it takes several follow up mails > to find out what the question was) and those who > don't have a qucik look at the archives first > (is someone puuting together an FAQ ?) I agree. I think John's response was a simple answer to a simple question. He was probably tired of trying to interpret questions from this list. I suppose I take a similar approach in that I quickly delete questions that make no sense or only hint at the real question. Perhaps I am being rude, too, but I'm just quieter about it. :-) Oh, and here is a link that I think John alluded to: http://www.tuxedo.org/~esr/faqs/smart-questions.html Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL+php
John W. Holmes wrote: .it's an log for a VoIp network, evrey voip has an ip and i whant that instad of the VoIp's IP to put his name, instad of "1.1.1.1:xxx" must be "jhon doe form yyy city", it's easier to read for the people who So where do you get the name from. You're still not being descriptive enough. I'd probably put the ip address to name mapping in a separate table. If we call that table "nameip" and it has fields "name" and "ip", and if your other table is "othertable" with a "ip" field then you can begin your sql statement with something like: select nip.name from nameip nip, othertable ot where nip.ip = ot.ip and ot.ip = whatever you need to get the right record. The above is untested and you may need to modify it to suit your database's syntax (you do not tell us which), but it should give you the general idea. Sean, the difficulty is that you were not explaining what you wanted clearly enough, not giving us enough information. It took several posts to do that. John's simple answer "yes" was a humourous hint to that. All we knew is the few lines of your original post, we don't know if you are ace programmer and database wizard or newbie. You know what you want to achieve and the backgroud to it, we do not. You know your response was out of line. I think a simple apology would be appreciated. John is a mainstay of this list and deals with many requests for help per day. Its a high volume list, please stay on it yourself and find out. See if you can help others. Its also php-general so should really be for requests that do not fall into other catagories such as php-db, php-install or mysql, its not a database list. I feel that many people post to this list, even with off-topic questions, because they know they will receive help. Why? Simply because there are people such as John who wade through hundreds of posts every day, putting themselves out, and doing their best. Regards Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL+php
Sean Malloy wrote: I see a lot of these type of answers on the list at the moment. I'm sick of receiving smart ass answers from people. It wastes my time, and my bandwidth. Either answer the fucking question, even if it hasn't been asked correctly, or don't reply at all. Given you are a 'PHP Professional' John, I would expect a little more from you. I thought Johns response was humorous and to the point ... John has shown a tremendous willingness to help people on this list - and I can undertsand him getting frustrated by the number of unclear questions... I sometimes read this list and see if there is anything I can give back to the community ... ..but often give up trying to find questions I can answer in amongst the cryptic posts some people seem to think are a way of asking for help. I think the bandwidth wasters are those who ask questions poorly (it takes several follow up mails to find out what the question was) and those who don't have a qucik look at the archives first (is someone puuting together an FAQ ?) -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL+php
it doesn't change it in the database, just in the output. Thomas On Sun, 19 Jan 2003 03:17:04 +0200 (EET) [EMAIL PROTECTED] (Paul Marinas) wrote: > something like that only i don't whant to alter the database, the fields > in the database must remains unchanged, only, on page i whant to display > diferent data. > > On Sun, 19 Jan 2003, Sean Malloy wrote: > > > If you want to do it within the query itself, take a look at the mysql > > replace command > > > > REPLACE(str,from_str,to_str) > > > > SELECT REPLACE(,,) FROM table > > > > or you can do it using PHP once the query has executed, on a record by > > record basis, within a while/for loop or whatever. > > > > -Original Message- > > From: Paul Marinas [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, 19 January 2003 11:07 AM > > Cc: [EMAIL PROTECTED] > > Subject: [PHP] SQL+php > > > > > > Dose anyone know how to search and replace a string in a > > mysql_query output. > > > > Thanks, Paul > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Thomas Seifert mailto:[EMAIL PROTECTED] http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
I apologise for calling you a PHP Professional, clearly I was mistaken. ;) -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, 19 January 2003 4:36 PM To: 'Sean Malloy'; [EMAIL PROTECTED] Subject: RE: [PHP] SQL+php It's _for_ PHP Professionals. If I read a Woman's magazine, does that make me a woman? Anyhow, answers like this are a good way for people to learn not to ask Yes or No questions. There's even a funny FAQ on this, but I can't find the link anywhere. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
> I see a lot of these type of answers on the list at the moment. > > I'm sick of receiving smart ass answers from people. It wastes my time, > and > my bandwidth. > > Either answer the fucking question, even if it hasn't been asked > correctly, > or don't reply at all. > > Given you are a 'PHP Professional' John, I would expect a little more from > you. It's _for_ PHP Professionals. If I read a Woman's magazine, does that make me a woman? Anyhow, answers like this are a good way for people to learn not to ask Yes or No questions. There's even a funny FAQ on this, but I can't find the link anywhere. ---John Holmes... > > -Original Message- > From: John W. Holmes [mailto:[EMAIL PROTECTED]] > Sent: Sunday, 19 January 2003 11:42 AM > To: 'Paul Marinas' > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] SQL+php > > > > Dose anyone know how to search and replace a string in a > > mysql_query output. > > Yes. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
> .it's an log for a VoIp network, evrey voip has an ip and i whant > that instad of the VoIp's IP to put his name, instad of "1.1.1.1:xxx" must > be "jhon doe form yyy city", it's easier to read for the people who that > follow the logs. .. that's it ... So where do you get the name from. You're still not being descriptive enough. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL+php
:))) .it's an log for a VoIp network, evrey voip has an ip and i whant that instad of the VoIp's IP to put his name, instad of "1.1.1.1:xxx" must be "jhon doe form yyy city", it's easier to read for the people who that follow the logs. .. that's it ... On Sun, 19 Jan 2003, Justin French wrote: > where the F*** are you getting july from??? which number do you want to > convert to a month, or am i totally missing it? > > you need to be DESCRIPTIVE in what you want to acheive. > > we're not a mind readers! > > > Justin > > > on 19/01/03 11:59 AM, Paul Marinas ([EMAIL PROTECTED]) wrote: > > > i am trying to select some fields form a database but in there the data is > > something like "172.10.192.22:100", not very frendly, and instad of those > > numbers i whant to display on my web page something like "july"...that's > > it ..:) > > > > On Sat, 18 Jan 2003, John W. Holmes wrote: > > > >> How about you describe exactly what you're trying to do and why and then > >> someone can help you. > >> > >> ---John W. Holmes... > >> > >> PHP Architect - A monthly magazine for PHP Professionals. Get your copy > >> today. http://www.phparch.com/ > >> > >>> -Original Message- > >>> From: Paul Marinas [mailto:[EMAIL PROTECTED]] > >>> Sent: Saturday, January 18, 2003 7:46 PM > >>> To: John W. Holmes > >>> Subject: RE: [PHP] SQL+php > >>> > >>> > >>> what number? .. i really need that . > >>> On Sat, 18 Jan 2003, John W. Holmes wrote: > >>> > >>>>> Dose anyone know how to search and replace a string in a > >>>>> mysql_query output. > >>>> > >>>> Yes. > >>>> > >>>> ---John W. Holmes... > >>>> > >>>> PHP Architect - A monthly magazine for PHP Professionals. Get your > >> copy > >>>> today. http://www.phparch.com/ > >>>> > >>>> > >>>> > >>>> -- > >>>> PHP General Mailing List (http://www.php.net/) > >>>> To unsubscribe, visit: http://www.php.net/unsub.php > >>>> > >> > >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL+php
where the F*** are you getting july from??? which number do you want to convert to a month, or am i totally missing it? you need to be DESCRIPTIVE in what you want to acheive. we're not a mind readers! Justin on 19/01/03 11:59 AM, Paul Marinas ([EMAIL PROTECTED]) wrote: > i am trying to select some fields form a database but in there the data is > something like "172.10.192.22:100", not very frendly, and instad of those > numbers i whant to display on my web page something like "july"...that's > it ..:) > > On Sat, 18 Jan 2003, John W. Holmes wrote: > >> How about you describe exactly what you're trying to do and why and then >> someone can help you. >> >> ---John W. Holmes... >> >> PHP Architect - A monthly magazine for PHP Professionals. Get your copy >> today. http://www.phparch.com/ >> >>> -Original Message- >>> From: Paul Marinas [mailto:[EMAIL PROTECTED]] >>> Sent: Saturday, January 18, 2003 7:46 PM >>> To: John W. Holmes >>> Subject: RE: [PHP] SQL+php >>> >>> >>> what number? .. i really need that . >>> On Sat, 18 Jan 2003, John W. Holmes wrote: >>> >>>>> Dose anyone know how to search and replace a string in a >>>>> mysql_query output. >>>> >>>> Yes. >>>> >>>> ---John W. Holmes... >>>> >>>> PHP Architect - A monthly magazine for PHP Professionals. Get your >> copy >>>> today. http://www.phparch.com/ >>>> >>>> >>>> >>>> -- >>>> PHP General Mailing List (http://www.php.net/) >>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>> >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
something like that only i don't whant to alter the database, the fields in the database must remains unchanged, only, on page i whant to display diferent data. On Sun, 19 Jan 2003, Sean Malloy wrote: > If you want to do it within the query itself, take a look at the mysql > replace command > > REPLACE(str,from_str,to_str) > > SELECT REPLACE(,,) FROM table > > or you can do it using PHP once the query has executed, on a record by > record basis, within a while/for loop or whatever. > > -Original Message- > From: Paul Marinas [mailto:[EMAIL PROTECTED]] > Sent: Sunday, 19 January 2003 11:07 AM > Cc: [EMAIL PROTECTED] > Subject: [PHP] SQL+php > > > Dose anyone know how to search and replace a string in a > mysql_query output. > > Thanks, Paul > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
If you want to do it within the query itself, take a look at the mysql replace command REPLACE(str,from_str,to_str) SELECT REPLACE(,,) FROM table or you can do it using PHP once the query has executed, on a record by record basis, within a while/for loop or whatever. -Original Message- From: Paul Marinas [mailto:[EMAIL PROTECTED]] Sent: Sunday, 19 January 2003 11:07 AM Cc: [EMAIL PROTECTED] Subject: [PHP] SQL+php Dose anyone know how to search and replace a string in a mysql_query output. Thanks, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
i am trying to select some fields form a database but in there the data is something like "172.10.192.22:100", not very frendly, and instad of those numbers i whant to display on my web page something like "july"...that's it ..:) On Sat, 18 Jan 2003, John W. Holmes wrote: > How about you describe exactly what you're trying to do and why and then > someone can help you. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > -Original Message- > > From: Paul Marinas [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, January 18, 2003 7:46 PM > > To: John W. Holmes > > Subject: RE: [PHP] SQL+php > > > > > > what number? .. i really need that . > > On Sat, 18 Jan 2003, John W. Holmes wrote: > > > > > > Dose anyone know how to search and replace a string in a > > > > mysql_query output. > > > > > > Yes. > > > > > > ---John W. Holmes... > > > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your > copy > > > today. http://www.phparch.com/ > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
How about you describe exactly what you're trying to do and why and then someone can help you. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ > -Original Message- > From: Paul Marinas [mailto:[EMAIL PROTECTED]] > Sent: Saturday, January 18, 2003 7:46 PM > To: John W. Holmes > Subject: RE: [PHP] SQL+php > > > what number? .. i really need that . > On Sat, 18 Jan 2003, John W. Holmes wrote: > > > > Dose anyone know how to search and replace a string in a > > > mysql_query output. > > > > Yes. > > > > ---John W. Holmes... > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > > today. http://www.phparch.com/ > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
I see a lot of these type of answers on the list at the moment. I'm sick of receiving smart ass answers from people. It wastes my time, and my bandwidth. Either answer the fucking question, even if it hasn't been asked correctly, or don't reply at all. Given you are a 'PHP Professional' John, I would expect a little more from you. -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, 19 January 2003 11:42 AM To: 'Paul Marinas' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] SQL+php > Dose anyone know how to search and replace a string in a > mysql_query output. Yes. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL+php
> Dose anyone know how to search and replace a string in a > mysql_query output. Yes. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL+php
Dose anyone know how to search and replace a string in a mysql_query output. Thanks, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL Error
I don't think there's anything wrong with the queries themselves. Are you trying to run them all at once? You're getting an error because MySQL is reaching a semi-colon somewhere and that's causing a parse error... Show how you're trying to run all of these queries. Bottom line, you must do them one at a time with mysql_query, or run them through the command line in a file. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: Stephen [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 7:15 PM To: PHP List Subject: [PHP] SQL Error I'm having some troubles. I have an install script which runs a lot of SQL statements to create tables then insert info into them. One of them is an emoticons table. Here's the error I'm getting: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':\)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 or, if I change my code a little, it's this: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 Here's my code which inserts the information: INSERT INTO c_emotes VALUES (':)', 'emotes/smile.gif'); // I also have tried placing a \ infront of the )...no luck INSERT INTO c_emotes VALUES (';)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':(', 'emotes/sad.gif'); INSERT INTO c_emotes VALUES (':P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-)', 'emotes/smile.gif'); INSERT INTO c_emotes VALUES (';-)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':-P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':-(', 'emotes/sad.gif'); Anyone see the problem?? Thanks, Stephen Craton http://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Error
I just tried this in MySQL and it inserted no problem INSERT INTO c_emotes VALUES (6, ':-)'); Mike *** REPLY SEPARATOR *** On 30/12/2002 at 7:14 PM Stephen wrote: I'm having some troubles. I have an install script which runs a lot of SQL statements to create tables then insert info into them. One of them is an emoticons table. Here's the error I'm getting: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':\)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 or, if I change my code a little, it's this: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 Here's my code which inserts the information: INSERT INTO c_emotes VALUES (':)', 'emotes/smile.gif'); // I also have tried placing a \ infront of the )...no luck INSERT INTO c_emotes VALUES (';)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':(', 'emotes/sad.gif'); INSERT INTO c_emotes VALUES (':P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-)', 'emotes/smile.gif'); INSERT INTO c_emotes VALUES (';-)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':-P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':-(', 'emotes/sad.gif'); Anyone see the problem?? Thanks, Stephen Craton http://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us
[PHP] SQL Error
I'm having some troubles. I have an install script which runs a lot of SQL statements to create tables then insert info into them. One of them is an emoticons table. Here's the error I'm getting: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':\)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 or, if I change my code a little, it's this: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 Here's my code which inserts the information: INSERT INTO c_emotes VALUES (':)', 'emotes/smile.gif'); // I also have tried placing a \ infront of the )...no luckINSERT INTO c_emotes VALUES (';)', 'emotes/wink.gif');INSERT INTO c_emotes VALUES (':(', 'emotes/sad.gif');INSERT INTO c_emotes VALUES (':P', 'emotes/tounge.gif');INSERT INTO c_emotes VALUES (':|', 'emotes/blank.gif');INSERT INTO c_emotes VALUES (':-|', 'emotes/blank.gif');INSERT INTO c_emotes VALUES (':-)', 'emotes/smile.gif');INSERT INTO c_emotes VALUES (';-)', 'emotes/wink.gif');INSERT INTO c_emotes VALUES (':-P', 'emotes/tounge.gif');INSERT INTO c_emotes VALUES (':-(', 'emotes/sad.gif'); Anyone see the problem?? Thanks,Stephen Cratonhttp://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL: INSERT using subqueries
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ohhh you're close. A little tweak, and it works. Here's what I came up with: INSERT INTO myTable (owner, name) SELECT id as "owner", 'myName' as "name" FROM users where username='myUserName'; I think if you omit the (owner, name), it thinks you want to fill the whole table, so by doing it this way you can specify only what you want to change. Thanks for your help, Ernest! - -Evan On Monday 16 December 2002 12:13 am, you wrote: > At 09:01 16.12.2002, Evan Nemerson said: > [snip] > > >Anyways, my question is rather simple- how do I do an INSERT using a > >subquery? > >I want something like this- only one that works: > > > >INSERT INTO myTable > >SET owner=(SELECT id FROM users WHERE username='myUsername'); > > [snip] > > INSERT INTO myTable >SELECT id as "owner" FROM users where username='myUsername'; > > other columns, not selected from source table: > > INSERT INTO myTable >SELECT id as "owner", 92 as "data1", 'hello world' as "data2" >FROM users where username='myUsername'; > > should do it (untested on mySQL) - -- Cats are intended to teach us that not everything in nature has a function. - -Garrison Keillor -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9/Y+w/rncFku1MdIRAtjFAJ9k8CaAVyHxe3Rdubo0cXPYMMP14gCfdZoN /AXg9bAvjtt+xWCJMmY8r3E= =byql -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL: INSERT using subqueries
At 09:01 16.12.2002, Evan Nemerson said: [snip] >Anyways, my question is rather simple- how do I do an INSERT using a >subquery? >I want something like this- only one that works: > >INSERT INTO myTable >SET owner=(SELECT id FROM users WHERE username='myUsername'); [snip] INSERT INTO myTable SELECT id as "owner" FROM users where username='myUsername'; other columns, not selected from source table: INSERT INTO myTable SELECT id as "owner", 92 as "data1", 'hello world' as "data2" FROM users where username='myUsername'; should do it (untested on mySQL) -- >O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL: INSERT using subqueries
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 First off, sorry it's a SQL question not PHP, but I don't subscribe to mysql-general (or whatever it's called), and I have a feeling someone on this list will be able to help... Anyways, my question is rather simple- how do I do an INSERT using a subquery? I want something like this- only one that works: INSERT INTO myTable SET owner=(SELECT id FROM users WHERE username='myUsername'); Actually, I want to set a few more fields too, but not using subqueries. I would prefer the ..() VALUES ()... syntax, but I converted to this when I suspected that was the problem- it wasn't. I realize that I _could_ get put the id into a PHP variable, then make another query from that (which is what I'll be doing until i get a response ;)), but I'd prefer not to. Any help would be much appreciated, and thanks in advance! - -Evan - -- To achieve adjustment and sanity and the conditions that follow from them, we must study the structural characteristics of this world first and, then only, build languages of similar structure, instead of habitually ascribing to the world the primitive structure of our language. - -Alfred Korzybski -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9/YiD/rncFku1MdIRAg13AJ0VWveL8D79oMGuD+LVXpliqecbYgCeKlBw S+j22cnoMS/WNm0Iwbxjzlo= =EC92 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Question: Search Records between two dates.
select * from table_name where (start_date >='2002-10-01' and start_date <='2002-12-10') or (end_date >='2002-10-01' and end_date <='2002-12-10') At 01:08 11.12.2002, [-^-!-%- said: [snip] > >Hello everyone, > >I need to get a recordset between two dates, and am having a little >trouble. I was wondering if someone could me make it more efficient. > >The goal: > Each record has a start_date and end_date field. I want to be able to >extract records that has the start_date and/or end_date, within the >specified date range. > >What I have: > >select * from table_name where start_date >='2002-10-01' and end_date ><='2002-12-10' ... > >This works, but is somewhat inconsistent. > >Example: >1) the query will exclude a record that has an end_date later then 12/10, > but a start_date later then 10/01. *** I need it to include that*** >2) The query also list records with a january 2003 end_date. i.e. >end_date=2003-01-15. Strange. > > I've read about the mysql BETWEEN and DATE DIFF function, but don't fully >get it. I'm hoping that >someone can help clarifying it. > > >Is there a better way to do this? Am I missing something? >Please help. > >-john > >=P e p i e D e s i g n s > www.pepiedesigns.com > Providing Solutions That Increase Productivity > > Web Developement. Database. Hosting. Multimedia. > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php [snip] -- >O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Question: Search Records between two dates.
Hello everyone, I need to get a recordset between two dates, and am having a little trouble. I was wondering if someone could me make it more efficient. The goal: Each record has a start_date and end_date field. I want to be able to extract records that has the start_date and/or end_date, within the specified date range. What I have: select * from table_name where start_date >='2002-10-01' and end_date <='2002-12-10' ... This works, but is somewhat inconsistent. Example: 1) the query will exclude a record that has an end_date later then 12/10, but a start_date later then 10/01. *** I need it to include that*** 2) The query also list records with a january 2003 end_date. i.e. end_date=2003-01-15. Strange. I've read about the mysql BETWEEN and DATE DIFF function, but don't fully get it. I'm hoping that someone can help clarifying it. Is there a better way to do this? Am I missing something? Please help. -john =P e p i e D e s i g n s www.pepiedesigns.com Providing Solutions That Increase Productivity Web Developement. Database. Hosting. Multimedia. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
did I say Java? oops, i meant SQLlearning Java in my comp sci class..(= forgive me. Jule On Tuesday, Nov 5, 2002, at 21:54 US/Eastern, Martin Towell wrote: "where" is a java keyword ? have you got an example ? It's been _ages_ since I've done any code in java :( -Original Message- From: Jule Slootbeek [mailto:jslootbeek@;clarku.edu] Sent: Wednesday, November 06, 2002 1:52 PM To: Marco Tabini Cc: [EMAIL PROTECTED] Subject: Re: [PHP] sql error apparently 'where' and 'with' are keywords in Java, i've changed them and now it works fine. thanks! Jule On Tuesday, Nov 5, 2002, at 21:53 US/Eastern, Marco Tabini wrote: I'm not entirely sure... different configurations perhaps? Have you verified that that's indeed the problem? Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: "where" is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
possible, but wouldn't phpMyAdmin export the name with the tick marks?? CREATE TABLE foo (`where` varchar(255) NOT NULL); Jule On Tuesday, Nov 5, 2002, at 21:51 US/Eastern, John W. Holmes wrote: PHPMyAdmin may put tick marks around the name, which will get rid of the error. `where` varchar(255) not null ... ---John Holmes... -Original Message- From: Jule Slootbeek [mailto:jslootbeek@;clarku.edu] Sent: Tuesday, November 05, 2002 9:43 PM To: Marco Tabini Cc: [EMAIL PROTECTED] Subject: Re: [PHP] sql error Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: "where" is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
apparently 'where' and 'with' are keywords in Java, i've changed them and now it works fine. thanks! Jule On Tuesday, Nov 5, 2002, at 21:53 US/Eastern, Marco Tabini wrote: I'm not entirely sure... different configurations perhaps? Have you verified that that's indeed the problem? Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: "where" is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] sql error
PHPMyAdmin may put tick marks around the name, which will get rid of the error. `where` varchar(255) not null ... ---John Holmes... > -Original Message- > From: Jule Slootbeek [mailto:jslootbeek@;clarku.edu] > Sent: Tuesday, November 05, 2002 9:43 PM > To: Marco Tabini > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] sql error > > Ah i see, but then why will phpMyAdmin let me use it? > it works fine on my local db with these names, but on my remote server > it refuses to create the table. > > Jule > > On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: > > > "where" is a reserved keyword in SQL--try changing the name of that > > column to something else. > > > > > > Marco > > > > --- > > php|architect -- The Monthly Magazine For PHP Professionals > > Visit us on the web at http://www.phparch.com! > > > > On Tue, 5 Nov > > 2002, Jule Slootbeek wrote: > > > >> I know this is the wrong mailinglist, but i don't want to subscribe to > >> a second one for one random question. > >> > >> when trying to enter this into my db: > >> > >> DROP TABLE IF EXISTS dates; > >> CREATE TABLE dates ( > >>id int(10) unsigned NOT NULL auto_increment, > >>date varchar(50) NOT NULL default '', > >>at varchar(50) NOT NULL default '', > >>where varchar(255) NOT NULL default '', > >>with varchar(255) NOT NULL default '', > >>whereURL varchar(100) NOT NULL default '', > >>info varchar(255) NOT NULL default '', > >>PRIMARY KEY (id) > >> ) TYPE=MyISAM; > >> > >> (this is generated by phpMyAdmin) > >> > >> i get this error: > >> > >> ERROR 1064 at line 18: You have an error in your SQL syntax near > >> 'where > >> varchar(255) NOT NULL default '', > >>with varchar(255) NOT NULL default '',' at line 5 > >> > >> where's the error? > >> i don't see anything wrong.. > >> > >> TIA, > >> > >> Jule > >> > >> Jule Slootbeek > >> [EMAIL PROTECTED] > >> > >> > >> > > > > > Jule Slootbeek > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
I'm not entirely sure... different configurations perhaps? Have you verified that that's indeed the problem? Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: > Ah i see, but then why will phpMyAdmin let me use it? > it works fine on my local db with these names, but on my remote server > it refuses to create the table. > > Jule > > On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: > > > "where" is a reserved keyword in SQL--try changing the name of that > > column to something else. > > > > > > Marco > > > > --- > > php|architect -- The Monthly Magazine For PHP Professionals > > Visit us on the web at http://www.phparch.com! > > > > On Tue, 5 Nov > > 2002, Jule Slootbeek wrote: > > > >> I know this is the wrong mailinglist, but i don't want to subscribe to > >> a second one for one random question. > >> > >> when trying to enter this into my db: > >> > >> DROP TABLE IF EXISTS dates; > >> CREATE TABLE dates ( > >>id int(10) unsigned NOT NULL auto_increment, > >>date varchar(50) NOT NULL default '', > >>at varchar(50) NOT NULL default '', > >>where varchar(255) NOT NULL default '', > >>with varchar(255) NOT NULL default '', > >>whereURL varchar(100) NOT NULL default '', > >>info varchar(255) NOT NULL default '', > >>PRIMARY KEY (id) > >> ) TYPE=MyISAM; > >> > >> (this is generated by phpMyAdmin) > >> > >> i get this error: > >> > >> ERROR 1064 at line 18: You have an error in your SQL syntax near > >> 'where > >> varchar(255) NOT NULL default '', > >>with varchar(255) NOT NULL default '',' at line 5 > >> > >> where's the error? > >> i don't see anything wrong.. > >> > >> TIA, > >> > >> Jule > >> > >> Jule Slootbeek > >> [EMAIL PROTECTED] > >> > >> > >> > > > > > Jule Slootbeek > [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
Ah i see, but then why will phpMyAdmin let me use it? it works fine on my local db with these names, but on my remote server it refuses to create the table. Jule On Tuesday, Nov 5, 2002, at 21:47 US/Eastern, Marco Tabini wrote: "where" is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql error
"where" is a reserved keyword in SQL--try changing the name of that column to something else. Marco --- php|architect -- The Monthly Magazine For PHP Professionals Visit us on the web at http://www.phparch.com! On Tue, 5 Nov 2002, Jule Slootbeek wrote: > I know this is the wrong mailinglist, but i don't want to subscribe to > a second one for one random question. > > when trying to enter this into my db: > > DROP TABLE IF EXISTS dates; > CREATE TABLE dates ( >id int(10) unsigned NOT NULL auto_increment, >date varchar(50) NOT NULL default '', >at varchar(50) NOT NULL default '', >where varchar(255) NOT NULL default '', >with varchar(255) NOT NULL default '', >whereURL varchar(100) NOT NULL default '', >info varchar(255) NOT NULL default '', >PRIMARY KEY (id) > ) TYPE=MyISAM; > > (this is generated by phpMyAdmin) > > i get this error: > > ERROR 1064 at line 18: You have an error in your SQL syntax near 'where > varchar(255) NOT NULL default '', >with varchar(255) NOT NULL default '',' at line 5 > > where's the error? > i don't see anything wrong.. > > TIA, > > Jule > > Jule Slootbeek > [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sql error
I know this is the wrong mailinglist, but i don't want to subscribe to a second one for one random question. when trying to enter this into my db: DROP TABLE IF EXISTS dates; CREATE TABLE dates ( id int(10) unsigned NOT NULL auto_increment, date varchar(50) NOT NULL default '', at varchar(50) NOT NULL default '', where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '', whereURL varchar(100) NOT NULL default '', info varchar(255) NOT NULL default '', PRIMARY KEY (id) ) TYPE=MyISAM; (this is generated by phpMyAdmin) i get this error: ERROR 1064 at line 18: You have an error in your SQL syntax near 'where varchar(255) NOT NULL default '', with varchar(255) NOT NULL default '',' at line 5 where's the error? i don't see anything wrong.. TIA, Jule Jule Slootbeek [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL>Insert and recover the ID
> use mysql_insert_id(). Much more reliable when and if you use the system > with more than one person inserting at the same time. Sure it's for that I ask Thanks for your help. Christian, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL>Insert and recover the ID
use mysql_insert_id(). Much more reliable when and if you use the system with more than one person inserting at the same time. -Original Message- From: Christian Ista [mailto:mailing-list@;istasofts.com] Sent: Thursday, October 31, 2002 2:12 PM To: [EMAIL PROTECTED] Subject: [PHP] SQL>Insert and recover the ID Hello, In a table, I have some fields and the primary key is an autoincrement field. I insert an row and I'd like to recover the ID used for the last record I inserted. For the moment, I do a select max(Id) just after the insert but there is, my be a best way to do it. Thanks for your help Christian, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL>Insert and recover the ID
> In a table, I have some fields and the primary key is an autoincrement > field. I insert an row and I'd like to recover the ID used for the last > record I inserted. > > For the moment, I do a select max(Id) just after the insert but there > is, my be a best way to do it. Stop. Read this: www.php.net/mysql_insert_id ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL>Insert and recover the ID
Check out mysql_insert_id() > For the moment, I do a select max(Id) just after the insert but there > is, my be a best way to do it. -- Linux: Because rebooting is for adding hardware. Fingerprint = CE24 057D 1E88 A253 3196 89DB 9FF0 9EF0 2F70 8BE8 BE8 signature.asc Description: This is a digitally signed message part
[PHP] SQL>Insert and recover the ID
Hello, In a table, I have some fields and the primary key is an autoincrement field. I insert an row and I'd like to recover the ID used for the last record I inserted. For the moment, I do a select max(Id) just after the insert but there is, my be a best way to do it. Thanks for your help Christian, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL : left join from multiple tables
Thanks for the help. I got it working. I used SQL92, instead of Oracle's sql standard. I just hate to recode when migrating to mysql or postgresql. Sincerely, Faisal -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 24, 2002 7:33 PM To: 'Faisal Abdullah'; [EMAIL PROTECTED] Subject: RE: [PHP] SQL : left join from multiple tables [snip] "select a.name, b.department, c.position from emp a left join dept b on a.staffno = b.staffno left join position c on a.staffno = c.staffno where staffno = $staffno"; I know the statement above is totally wrong. I'm just hoping u guys can understand what i'm trying to achieve from it. [/snip] All you have to change to make this right is change the ON statement after 'left join position c' to 'on b.staffno = c.staffno'. Remember that you are moving from left to right in the join, so your ON must also move from left to right. HTH! Jay __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL : left join from multiple tables
Faisal, I'd check the documentation CDs for Oracle 9i. Oracle 8 does not use the "join" or "left" keywords but a plus sign in parenthesis "(+)" whose position determines whether it is a left or right join. It may not be SQL2 but its Oracle. HTH Chris Marek Kilimajer wrote: > Well, this would work in MySQL, I have even more LEFT JOINs, so go > find out if it is possible with Oracle. > > Faisal Abdullah wrote: > >> Hi again people! How's it goin? >> >> Here's the question >> How do I do left joins from multiple tables? >> I want to do something like this: >> >> "select a.name, b.department, c.position >> from emp a >> left join dept b >> on a.staffno = b.staffno >> left join position c >> on a.staffno = c.staffno >> where staffno = $staffno"; >> >> I know the statement above is totally wrong. I'm just hoping u guys can >> understand what i'm trying to achieve from it. >> >> By the way, this is on Oracle 9i, but I guess ANSI would be fine. >> Thanks again. >> >> Sincerely, >> Faisal >> >> __ >> >> >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL : left join from multiple tables
[snip] [snip] "select a.name, b.department, c.position from emp a left join dept b on a.staffno = b.staffno left join position c on a.staffno = c.staffno where staffno = $staffno"; I know the statement above is totally wrong. I'm just hoping u guys can understand what i'm trying to achieve from it. [/snip] All you have to change to make this right is change the ON statement after 'left join position c' to 'on b.staffno = c.staffno'. Remember that you are moving from left to right in the join, so your ON must also move from left to right. [/snip] I also just realized that your where statement may be too ambiguous, so change it (again think from left to right) to 'where a.staffno = $staffno'. Since a.staffno should match b.staffno should match c.staffno. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL : left join from multiple tables
[snip] "select a.name, b.department, c.position from emp a left join dept b on a.staffno = b.staffno left join position c on a.staffno = c.staffno where staffno = $staffno"; I know the statement above is totally wrong. I'm just hoping u guys can understand what i'm trying to achieve from it. [/snip] All you have to change to make this right is change the ON statement after 'left join position c' to 'on b.staffno = c.staffno'. Remember that you are moving from left to right in the join, so your ON must also move from left to right. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL : left join from multiple tables
Well, this would work in MySQL, I have even more LEFT JOINs, so go find out if it is possible with Oracle. Faisal Abdullah wrote: >Hi again people! How's it goin? > >Here's the question >How do I do left joins from multiple tables? >I want to do something like this: > >"select a.name, b.department, c.position >from emp a >left join dept b >on a.staffno = b.staffno >left join position c >on a.staffno = c.staffno >where staffno = $staffno"; > >I know the statement above is totally wrong. I'm just hoping u guys can >understand what i'm trying to achieve from it. > >By the way, this is on Oracle 9i, but I guess ANSI would be fine. >Thanks again. > >Sincerely, >Faisal > >__ > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL : left join from multiple tables
Hi again people! How's it goin? Here's the question How do I do left joins from multiple tables? I want to do something like this: "select a.name, b.department, c.position from emp a left join dept b on a.staffno = b.staffno left join position c on a.staffno = c.staffno where staffno = $staffno"; I know the statement above is totally wrong. I'm just hoping u guys can understand what i'm trying to achieve from it. By the way, this is on Oracle 9i, but I guess ANSI would be fine. Thanks again. Sincerely, Faisal __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/SQL - inserting into database null results
Hi, Wednesday, August 21, 2002, 11:25:30 PM, you wrote: n> I am a new person to PHP. I have purchased and read PHP fast & easy by n> Julie Meloni and have also read the 24 hours PHP book. I am able to connect n> to the SQL database and insert into the database via my html form. However, n> the values are null. When I look at the data in my database, it reads " ", n> " ", " ", etc. n> I have tried a couple different code: n> $query = "INSERT INTO MemberReviews n> VALUES (' ','$memb_name', '$bookname','$author', '$grade', '$review') "; n> mysql_query($query); n> mysql_close(); n> or in the form itself, I have tried: n> # this is processed when the form is submitted n> # back on to this page (POST METHOD) n> if ($REQUEST_METHOD=="POST") { n> # double-up apostrophes n> $review = str_replace("'","''",$review); n> $author = str_replace("'","''",$author); n> # setup SQL statement n> $SQL = " INSERT INTO MemberReviews "; n> $SQL = $SQL . " (memb_name, bookname, author, grade, review) VALUES n> "; n> $SQL = $SQL . " ('$memb_name', '$bookname','$author', '$grade', n> '$review') "; n> #execute SQL statement n> $result = mysql_db_query($db,"$SQL",$cid); n> # check for error n> if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n");} n> echo ("New Record Added\n"); n> } ?>> n> Thanks in advance for your help n> Jennifer If you have the latest version of php (4.2.2 or 4.2.1) try if(!empty($_POST['memb_name']))$memb_name = add_slashes($_POST['memb_name']); if(!empty($_POST['bookname']))$bookname = add_slashes($_POST['bookname']); and so on, then add them to your query string. (add_slashes() will take care of any pesky quotes) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/SQL - inserting into database null results
I am a new person to PHP. I have purchased and read PHP fast & easy by Julie Meloni and have also read the 24 hours PHP book. I am able to connect to the SQL database and insert into the database via my html form. However, the values are null. When I look at the data in my database, it reads " ", " ", " ", etc. I have tried a couple different code: $query = "INSERT INTO MemberReviews VALUES (' ','$memb_name', '$bookname','$author', '$grade', '$review') "; mysql_query($query); mysql_close(); or in the form itself, I have tried: New Record Added\n"); } ?> Thanks in advance for your help Jennifer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Injection/Data Balidation
Oops! Sorry! I meant to say "apostrophe" and not "single quotes"... And sorry 'bout this additional post... Regards, - E >Actually, I DID read the articles before I replied. > >If you read it again, the basic problem is not about any "extended >SQLServer functionality"--it's about how ASP works AND how the database >server was configured AND how Window$ works. > >Sorry, but the attacks mentioned CANNOT be done on any of the database >servers that I've used. And with PHP, Apache, Linux combination, they just >don't apply. > >Hey, don't get me wrong. I really appreciate any security info but >personally I don't think they apply here... > >- E > >HINT: PHP doesn't use another "'" (single quote) character to escape >another single quote character--it's just basically stupid to do so. > >HINT 2: Configure your database server to have, for example, (1) a database >username/password that can only SELECT -- enough for dynamically generated >pages (2) a username/password that can only do INSERT or UPDATE, etc. Why >would I make a username/password for my web pages that can delete important >table or the entire database itself? > >> >>If you'll thoroughly read the articles, most of those attacks that don't >>involve the use of extended SQLServer functionality, CAN be done on >>other RDBMS's. And if nothing else, you'll see the ingenuity of the >>attackers. >> >>Hey, take what you liked, and leave the rest lay. >>-- >> >>If You want to buy computer parts, see the reviews at: >>http://www.cnet.com/ >>**OR EVEN BETTER COMPILATIONS**!! >>http://sysopt.earthweb.com/userreviews/products/ > > > > >_ >Charle con sus amigos online usando MSN Messenger: http://messenger.msn.com > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php _ Charle con sus amigos online usando MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Injection/Data Balidation
Actually, I DID read the articles before I replied. If you read it again, the basic problem is not about any "extended SQLServer functionality"--it's about how ASP works AND how the database server was configured AND how Window$ works. Sorry, but the attacks mentioned CANNOT be done on any of the database servers that I've used. And with PHP, Apache, Linux combination, they just don't apply. Hey, don't get me wrong. I really appreciate any security info but personally I don't think they apply here... - E HINT: PHP doesn't use another "'" (single quote) character to escape another single quote character--it's just basically stupid to do so. HINT 2: Configure your database server to have, for example, (1) a database username/password that can only SELECT -- enough for dynamically generated pages (2) a username/password that can only do INSERT or UPDATE, etc. Why would I make a username/password for my web pages that can delete important table or the entire database itself? > >If you'll thoroughly read the articles, most of those attacks that don't >involve the use of extended SQLServer functionality, CAN be done on >other RDBMS's. And if nothing else, you'll see the ingenuity of the >attackers. > >Hey, take what you liked, and leave the rest lay. >-- > >If You want to buy computer parts, see the reviews at: >http://www.cnet.com/ >**OR EVEN BETTER COMPILATIONS**!! >http://sysopt.earthweb.com/userreviews/products/ _ Charle con sus amigos online usando MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Injection/Data Balidation
I didn't see that, what a waste of paper Randy - Original Message - From: "Edwin @" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, August 16, 2002 1:14 PM Subject: Re: [PHP] SQL Injection/Data Balidation > Yeah, I'm scared... > > Please excuse me but may I say that it seems like you've sent some wrong > info to the wrong mailing list? > > I use PHP NOT ASP, I use MySQL or PostgreSQL or Oracle but NOT M$ SQL > Server. And IIS? Of course, some people use it (perhaps) because of some > unavoidable circumstances but I don't--I use Apache NOT IIS. > > Of course, there's nothing bad about being cautious... However, please send > some links (or documents) that are more relevant... > > Thanks anyway, now *I* have something to scare my friends... ;) > > - E > > > > >Please CC me as I'm on digest: > >-- > > > >Are there any libraries for data validation available? If one reads > >papers like these: > > > > http://www.nextgenss.com/papers/advanced_sql_injection.pdf > > http://www.nextgenss.com/papers/more_advanced_sql_injection.pdf > > > >It becomes apparent that sites using databases are incredibly open to > >attack because of the ingenuity of the attackers. I think there should > >be a PHPGuardLib or something. After reading those articles, I plan on > >filtering ALL input for semi-cololons and 'chr(' character strings. In > >the cases where I want to accept apostrophes, I'm going to be very > >careful. > > > >Also, are there any attacks to email programs on linux that can be done > >through input forms? > > > >PS, for those who think escaping user input only on apostrophes, THINK > >AGAIN! And read the aticles above. > >-- > > > >If You want to buy computer parts, see the reviews at: > >http://www.cnet.com/ > >**OR EVEN BETTER COMPILATIONS**!! > >http://sysopt.earthweb.com/userreviews/products/ > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > _ > MSN Hotmail è il provider email più grande al mondo. cosa aspetti a farti un > account? http://www.hotmail.it > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Injection/Data Balidation
Yeah, I'm scared... Please excuse me but may I say that it seems like you've sent some wrong info to the wrong mailing list? I use PHP NOT ASP, I use MySQL or PostgreSQL or Oracle but NOT M$ SQL Server. And IIS? Of course, some people use it (perhaps) because of some unavoidable circumstances but I don't--I use Apache NOT IIS. Of course, there's nothing bad about being cautious... However, please send some links (or documents) that are more relevant... Thanks anyway, now *I* have something to scare my friends... ;) - E > >Please CC me as I'm on digest: >-- > >Are there any libraries for data validation available? If one reads >papers like these: > > http://www.nextgenss.com/papers/advanced_sql_injection.pdf > http://www.nextgenss.com/papers/more_advanced_sql_injection.pdf > >It becomes apparent that sites using databases are incredibly open to >attack because of the ingenuity of the attackers. I think there should >be a PHPGuardLib or something. After reading those articles, I plan on >filtering ALL input for semi-cololons and 'chr(' character strings. In >the cases where I want to accept apostrophes, I'm going to be very >careful. > >Also, are there any attacks to email programs on linux that can be done >through input forms? > >PS, for those who think escaping user input only on apostrophes, THINK >AGAIN! And read the aticles above. >-- > >If You want to buy computer parts, see the reviews at: >http://www.cnet.com/ >**OR EVEN BETTER COMPILATIONS**!! >http://sysopt.earthweb.com/userreviews/products/ > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php _ MSN Hotmail è il provider email più grande al mondo cosa aspetti a farti un account? http://www.hotmail.it -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Injection/Data Balidation
Please CC me as I'm on digest: -- Are there any libraries for data validation available? If one reads papers like these: http://www.nextgenss.com/papers/advanced_sql_injection.pdf http://www.nextgenss.com/papers/more_advanced_sql_injection.pdf It becomes apparent that sites using databases are incredibly open to attack because of the ingenuity of the attackers. I think there should be a PHPGuardLib or something. After reading those articles, I plan on filtering ALL input for semi-cololons and 'chr(' character strings. In the cases where I want to accept apostrophes, I'm going to be very careful. Also, are there any attacks to email programs on linux that can be done through input forms? PS, for those who think escaping user input only on apostrophes, THINK AGAIN! And read the aticles above. -- If You want to buy computer parts, see the reviews at: http://www.cnet.com/ **OR EVEN BETTER COMPILATIONS**!! http://sysopt.earthweb.com/userreviews/products/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL datetime ERROR !
Hi Djurovski, > I use this query to input data into MySQL DB. > EXPIRE is Expire Date! > My script allways inputs "1.1.0001" into database (as value of expire). > what is wrong? > > My table: > > CREATE TABLE korpa ( >idnarudzbeukorpi int(255) DEFAULT '0' NOT NULL auto_increment, >mernaj varchar(255) NOT NULL, >nazivproizvoda varchar(255) NOT NULL, >ip_adresa_narucioca varchar(255) NOT NULL, >id_proizvoda varchar(255) NOT NULL, >kolicina_proizvoda decimal(255,2) DEFAULT '1.00' NOT NULL, >cena decimal(255,2), >datum datetime DEFAULT '-00-00 00:00:00' NOT NULL, >expire datetime, >PRIMARY KEY (idnarudzbeukorpi) > ); > > MySQL query: > > $aSQL2="insert into korpa (mernaj, nazivproizvoda, ip_adresa_narucioca, > id_proizvoda, cena, datum, expire) values ('$mernaj', '$naziv', '$ip', > '$id', '$cena', now(), now()+3000)"; Adding apples to oranges? expire is a datetime column. what format does now() produce its result in? can an integer (3,000) be added to that? =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL datetime ERROR !
Hi, I use this query to input data into MySQL DB. EXPIRE is Expire Date! My script allways inputs "1.1.0001" into database (as value of expire). what is wrong? My table: CREATE TABLE korpa ( idnarudzbeukorpi int(255) DEFAULT '0' NOT NULL auto_increment, mernaj varchar(255) NOT NULL, nazivproizvoda varchar(255) NOT NULL, ip_adresa_narucioca varchar(255) NOT NULL, id_proizvoda varchar(255) NOT NULL, kolicina_proizvoda decimal(255,2) DEFAULT '1.00' NOT NULL, cena decimal(255,2), datum datetime DEFAULT '-00-00 00:00:00' NOT NULL, expire datetime, PRIMARY KEY (idnarudzbeukorpi) ); MySQL query: $aSQL2="insert into korpa (mernaj, nazivproizvoda, ip_adresa_narucioca, id_proizvoda, cena, datum, expire) values ('$mernaj', '$naziv', '$ip', '$id', '$cena', now(), now()+3000)"; Please help me! -- -- Djurovski Dejan [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL datetime ERROR !
Hi, I use this query to input data into MySQL DB. EXPIRE is Expire Date! My script allways inputs "1.1.0001" into database (as value of expire). what is wrong? My table: CREATE TABLE korpa ( idnarudzbeukorpi int(255) DEFAULT '0' NOT NULL auto_increment, mernaj varchar(255) NOT NULL, nazivproizvoda varchar(255) NOT NULL, ip_adresa_narucioca varchar(255) NOT NULL, id_proizvoda varchar(255) NOT NULL, kolicina_proizvoda decimal(255,2) DEFAULT '1.00' NOT NULL, cena decimal(255,2), datum datetime DEFAULT '-00-00 00:00:00' NOT NULL, expire datetime, PRIMARY KEY (idnarudzbeukorpi) ); MySQL query: $aSQL2="insert into korpa (mernaj, nazivproizvoda, ip_adresa_narucioca, id_proizvoda, cena, datum, expire) values ('$mernaj', '$naziv', '$ip', '$id', '$cena', now(), now()+3000)"; Please help me! -- -- Djurovski Dejan [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
If I have to do that for every reply then I will only reply to half as many messages each day. On Tue, 13 Aug 2002, Jason Wong wrote: > On Tuesday 13 August 2002 00:03, Rasmus Lerdorf wrote: > > I know many people hate top-posts, but when you get 1400+ emails every day > > and answer 50+, it sure does speed things up. > > It probably depends. > > > Having the relevant text > > right up front means I don't have to scroll down to find it. > > Having the relevant text AND the context up front is even more useful. > > > If I don't > > understand the reply and need more context, that's when I scroll down to > > see what the reply was all about. > > IMHO that wastes even more time. > > > If all I see on my screen when I scan a > > message is a bunch of >'s I tend to just skip them. > > I contend that if people trim, quote and reply properly then in most cases all > the info and context will be available in the first "screenful" of the > message. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
On Tuesday 13 August 2002 00:03, Rasmus Lerdorf wrote: > I know many people hate top-posts, but when you get 1400+ emails every day > and answer 50+, it sure does speed things up. It probably depends. > Having the relevant text > right up front means I don't have to scroll down to find it. Having the relevant text AND the context up front is even more useful. > If I don't > understand the reply and need more context, that's when I scroll down to > see what the reply was all about. IMHO that wastes even more time. > If all I see on my screen when I scan a > message is a bunch of >'s I tend to just skip them. I contend that if people trim, quote and reply properly then in most cases all the info and context will be available in the first "screenful" of the message. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
On Monday 12 August 2002 23:53, Analysis & Solutions wrote: > Hi Tyler: > > On Mon, Aug 12, 2002 at 02:32:57PM +, Tyler Durdin wrote: > > Why not just let such a simple question go then? It was clearly a question that had nowt to do with PHP. Even your subsequent posts defending your position insisting that was a continuation of an earlier thread does not change the fact that it is a non-PHP question. This is a pretty high volume list. It only works if people like Dan graciously give up their time to read the list and help where possible. If the list was full of off-topic posts then I'm pretty sure that the experienced users would be pretty p*ssed off and leave the list. > I was being helpful by pointing you to the manual where you could find the > answer to this particular question AND a means of figuring out answers to > future questions. Some people like their answers on a plate -- you should've copied and pasted the relevant section/chapter from the manual. Now _that_ is being helpful -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* No one can have a higher opinion of him than I have, and I think he's a dirty little beast. -- W.S. Gilbert */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
I know many people hate top-posts, but when you get 1400+ emails every day and answer 50+, it sure does speed things up. Having the relevant text right up front means I don't have to scroll down to find it. If I don't understand the reply and need more context, that's when I scroll down to see what the reply was all about. If all I see on my screen when I scan a message is a bunch of >'s I tend to just skip them. If you want me to consider a message you need to get to your point really really quickly or it is an automatic delete for me. -Rasmus On Mon, 12 Aug 2002, Analysis & Solutions wrote: > Hi Tyler: > > On Mon, Aug 12, 2002 at 02:32:57PM +, Tyler Durdin wrote: > > > > Why not just let such a simple question go then? > > I was being helpful by pointing you to the manual where you could find the > answer to this particular question AND a means of figuring out answers to > future questions. > > I was terse because you seemed to have hit on a pet peeve of mine: people > not wanting to figure things out for themselves. While, of course, I > could be mistaken, your post gave no indication of such efforts. > > Now on to a separate pet peeve... > > A: No. > Q: Is it okay to top post and not snip out unrelated parts of prior >posts (let alone the signature lines, etc)? > > --Dan > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
Hi Tyler: On Mon, Aug 12, 2002 at 02:32:57PM +, Tyler Durdin wrote: > > Why not just let such a simple question go then? I was being helpful by pointing you to the manual where you could find the answer to this particular question AND a means of figuring out answers to future questions. I was terse because you seemed to have hit on a pet peeve of mine: people not wanting to figure things out for themselves. While, of course, I could be mistaken, your post gave no indication of such efforts. Now on to a separate pet peeve... A: No. Q: Is it okay to top post and not snip out unrelated parts of prior posts (let alone the signature lines, etc)? --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
My question as to what the AS statement did was just that, a question. It works perfectly, but I was curious if I was not completely understanding of what it did or if I could make better use of it. As for my reply i feel it was completely justified in that my post was on topic. I understand that Dan is on here alot just trying to be helpful, but in this case he had no intention of being helpful when he posted his reply. The fact is the message was on topic and if he had no useful information he should not have posted at all. It was never my intention to irritate anyone, just defend my post as it was a justified. If we have nothing nice or helpful to post to one another, then we should post nothing at all. >From: "DL Neil" <[EMAIL PROTECTED]> >To: "Tyler Durdin" <[EMAIL PROTECTED]>,<[EMAIL PROTECTED]> >CC: <[EMAIL PROTECTED]> >Subject: Re: [PHP] SQL ? >Date: Mon, 12 Aug 2002 15:49:45 +0100 > >Now then, let's all play nicely together! > >Dan: relevance >It is a PHP question because whereas the SQL query SELECT fred FROM tbl >produces an array element back in PHP such as $row[ "fred" ], this >convention/mapping comes well unstuck if you submit something like SELECT >IF >( answer = 'a', TRUE, FALSE )... or even SELECT fred+barney... Accordingly >the need to create an alias column name (Answer-A) and thereafter in PHP to >access the returned data with something like $row[ "Answer-A" ]. > >Tyler: appreciation and politeness >I thought this looked familiar, and it is part of something I sent to you >36 >hours ago to perform cross-totalling on a survey or exam results type >database. Since then there has been no comment from you, except to others. >If the suggestion doesn't work, please have the courtesy to come back to >me, >at least by cc:, for correction or amplification. NB If you had tested it >at >the MySQL (?) command line or using a management tool (recommended testing >procedure before implementing in PHP), then you would have observed the >result. > >Dan is often here, being helpful. Did you really mean to irritate two >people >by thoughtlessness if not deed, during the course of a single conversation? >=dn > > > > Why not just let such a simple question go then? Especially since your >reply > > is also off topic? Also, the question I asked was part of a reply from a > > previous topic. Thanks to all who answered my "simple" question. It is > > greatly appreciated. > > > >On Mon, Aug 12, 2002 at 02:15:23PM +, Tyler Durdin wrote: > > > > SELECT *, IF (answer = 'a', TRUE, FALSE) AS Answer-A > > > > What does the As Answer-A mean and what does it do? > > > > > >Why not examine the manual for the answer to such a basic question, > > >especially one that is off topic for the list you posted to? > > > > > >Assuming you're using MySQL read >http://www.mysql.com/doc/en/SELECT.html > > >and you'll quickly come across the meaning of AS. > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
Now then, let's all play nicely together! Dan: relevance It is a PHP question because whereas the SQL query SELECT fred FROM tbl produces an array element back in PHP such as $row[ "fred" ], this convention/mapping comes well unstuck if you submit something like SELECT IF ( answer = 'a', TRUE, FALSE )... or even SELECT fred+barney... Accordingly the need to create an alias column name (Answer-A) and thereafter in PHP to access the returned data with something like $row[ "Answer-A" ]. Tyler: appreciation and politeness I thought this looked familiar, and it is part of something I sent to you 36 hours ago to perform cross-totalling on a survey or exam results type database. Since then there has been no comment from you, except to others. If the suggestion doesn't work, please have the courtesy to come back to me, at least by cc:, for correction or amplification. NB If you had tested it at the MySQL (?) command line or using a management tool (recommended testing procedure before implementing in PHP), then you would have observed the result. Dan is often here, being helpful. Did you really mean to irritate two people by thoughtlessness if not deed, during the course of a single conversation? =dn > Why not just let such a simple question go then? Especially since your reply > is also off topic? Also, the question I asked was part of a reply from a > previous topic. Thanks to all who answered my "simple" question. It is > greatly appreciated. > >On Mon, Aug 12, 2002 at 02:15:23PM +, Tyler Durdin wrote: > > > SELECT *, IF (answer = 'a', TRUE, FALSE) AS Answer-A > > > What does the As Answer-A mean and what does it do? > > > >Why not examine the manual for the answer to such a basic question, > >especially one that is off topic for the list you posted to? > > > >Assuming you're using MySQL read http://www.mysql.com/doc/en/SELECT.html > >and you'll quickly come across the meaning of AS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
Why not just let such a simple question go then? Especially since your reply is also off topic? Also, the question I asked was part of a reply from a previous topic. Thanks to all who answered my "simple" question. It is greatly appreciated. >From: Analysis & Solutions <[EMAIL PROTECTED]> >To: PHP List <[EMAIL PROTECTED]> >Subject: Re: [PHP] SQL ? >Date: Mon, 12 Aug 2002 10:26:55 -0400 > >On Mon, Aug 12, 2002 at 02:15:23PM +, Tyler Durdin wrote: > > SELECT *, IF (answer = 'a', TRUE, FALSE) AS Answer-A > > What does the As Answer-A mean and what does it do? > >Why not examine the manual for the answer to such a basic question, >especially one that is off topic for the list you posted to? > >Assuming you're using MySQL read http://www.mysql.com/doc/en/SELECT.html >and you'll quickly come across the meaning of AS. > >--Dan > >-- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL ?
On Mon, Aug 12, 2002 at 02:15:23PM +, Tyler Durdin wrote: > SELECT *, IF (answer = 'a', TRUE, FALSE) AS Answer-A > What does the As Answer-A mean and what does it do? Why not examine the manual for the answer to such a basic question, especially one that is off topic for the list you posted to? Assuming you're using MySQL read http://www.mysql.com/doc/en/SELECT.html and you'll quickly come across the meaning of AS. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL ?
[snip] SELECT *, IF (answer = 'a', TRUE, FALSE) AS Answer-A [/snip] Answer-A is a handle for the data which you can use later when trying to display the results via PHP, as in an object line; print($data->Answer-A); HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL ?
SELECT *, IF (answer = 'a', TRUE, FALSE) AS Answer-A What does the As Answer-A mean and what does it do? _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL field problem
Chris, select distinct kat from tablename; Its in the mysql manual, 6.4.1 SELECT Syntax. HTH Chris [EMAIL PROTECTED] wrote: >Hello > >I have a problem with mysql.I create a table with a field "kat".In this field are >entries like this : > >Light >Dark >Dark >Light >Robot >Find >Dark >Light > >You see that all entries are not unique.So i want to list as output all entries but >only once.If the word "Dark" is in the table 6 times php should output dark only 1 >time. >How should i solve this problem ? > >Thanks! >chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL field problem
ðÒÉ×ÅÔ! [EMAIL PROTECTED] wrote: > You see that all entries are not unique.So i want to list as output all entries but >only once.If the word "Dark" is in the table 6 times php should output dark only 1 >time. > How should i solve this problem ? select distinct and RTFM :) ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL field problem
SELECT DISTINCT kat FROM mytable; Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 10, 2002 12:40 PM Subject: [PHP] SQL field problem Hello I have a problem with mysql.I create a table with a field "kat".In this field are entries like this : Light Dark Dark Light Robot Find Dark Light You see that all entries are not unique.So i want to list as output all entries but only once.If the word "Dark" is in the table 6 times php should output dark only 1 time. How should i solve this problem ? Thanks! chris
Re: [PHP] SQL field problem
Martin's post is what you want... knew there was a query (just couldn't remember it). "Chris Earle" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'd make another array that I can refer to and check for a value from the > original query (which with a huge array could become cumbersome, but it > doesn't look like you have will have too many duplicate names). Every time > you come across a new value, add it to the 2nd array (if it's not new, then > don't add it), then put the pointer of the array back to the start. Return > whether it was added or not, if it was added, then return 1 (true -- you can > display that word), or else return 0 (false -- it was already in the list > and thus has been displayed). > > Of course you might not want to do this if both arrays are going to become > huge (if the first is going to be like 1 long, but the 2nd is only 4 > long then it might still be slow). I believe there is a SQL Query that can > cancel out duplicates for you. > > "Ed Lazor" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > You can refer to fields by their number. > > > > $Row[3]; > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, July 10, 2002 10:40 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] SQL field problem > > > > > > Hello > > > > I have a problem with mysql.I create a table with a field "kat".In this > > field are entries like this : > > > > Light > > Dark > > Dark > > Light > > Robot > > Find > > Dark > > Light > > > > You see that all entries are not unique.So i want to list as output all > > entries but only once.If the word "Dark" is in the table 6 times php > should > > output dark only 1 time. > > How should i solve this problem ? > > > > Thanks! > > chris > > > > > > > This message is intended for the sole use of the individual and entity to > > whom it is addressed, and may contain information that is privileged, > > confidential and exempt from disclosure under applicable law. If you are > > not the intended addressee, nor authorized to receive for the intended > > addressee, you are hereby notified that you may not use, copy, disclose or > > distribute to anyone the message or any information contained in the > > message. If you have received this message in error, please immediately > > advise the sender by reply email and delete the message. Thank you very > > much. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL field problem
I'd make another array that I can refer to and check for a value from the original query (which with a huge array could become cumbersome, but it doesn't look like you have will have too many duplicate names). Every time you come across a new value, add it to the 2nd array (if it's not new, then don't add it), then put the pointer of the array back to the start. Return whether it was added or not, if it was added, then return 1 (true -- you can display that word), or else return 0 (false -- it was already in the list and thus has been displayed). Of course you might not want to do this if both arrays are going to become huge (if the first is going to be like 1 long, but the 2nd is only 4 long then it might still be slow). I believe there is a SQL Query that can cancel out duplicates for you. "Ed Lazor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You can refer to fields by their number. > > $Row[3]; > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 10, 2002 10:40 AM > To: [EMAIL PROTECTED] > Subject: [PHP] SQL field problem > > > Hello > > I have a problem with mysql.I create a table with a field "kat".In this > field are entries like this : > > Light > Dark > Dark > Light > Robot > Find > Dark > Light > > You see that all entries are not unique.So i want to list as output all > entries but only once.If the word "Dark" is in the table 6 times php should > output dark only 1 time. > How should i solve this problem ? > > Thanks! > chris > > > This message is intended for the sole use of the individual and entity to > whom it is addressed, and may contain information that is privileged, > confidential and exempt from disclosure under applicable law. If you are > not the intended addressee, nor authorized to receive for the intended > addressee, you are hereby notified that you may not use, copy, disclose or > distribute to anyone the message or any information contained in the > message. If you have received this message in error, please immediately > advise the sender by reply email and delete the message. Thank you very > much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL field problem
SELECT DISTINCT kat FROM tablename; should work. Martin >>> <[EMAIL PROTECTED]> 07/10/02 01:40PM >>> Hello I have a problem with mysql.I create a table with a field "kat".In this field are entries like this : Light Dark Dark Light Robot Find Dark Light You see that all entries are not unique.So i want to list as output all entries but only once.If the word "Dark" is in the table 6 times php should output dark only 1 time. How should i solve this problem ? Thanks! chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL field problem
I think you want to use group by: SELECT * FROM table GROUP BY kat; -- Tyler Longren Captain Jack Communications [EMAIL PROTECTED] www.captainjack.com On Wed, 10 Jul 2002 19:40:11 +0200 <[EMAIL PROTECTED]> wrote: > Hello > > I have a problem with mysql.I create a table with a field "kat".In > this field are entries like this : > > Light > Dark > Dark > Light > Robot > Find > Dark > Light > > You see that all entries are not unique.So i want to list as output > all entries but only once.If the word "Dark" is in the table 6 times > php should output dark only 1 time. How should i solve this problem ? > > Thanks! > chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL field problem
You can refer to fields by their number. $Row[3]; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 10, 2002 10:40 AM To: [EMAIL PROTECTED] Subject: [PHP] SQL field problem Hello I have a problem with mysql.I create a table with a field "kat".In this field are entries like this : Light Dark Dark Light Robot Find Dark Light You see that all entries are not unique.So i want to list as output all entries but only once.If the word "Dark" is in the table 6 times php should output dark only 1 time. How should i solve this problem ? Thanks! chris This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL field problem
Hello I have a problem with mysql.I create a table with a field "kat".In this field are entries like this : Light Dark Dark Light Robot Find Dark Light You see that all entries are not unique.So i want to list as output all entries but only once.If the word "Dark" is in the table 6 times php should output dark only 1 time. How should i solve this problem ? Thanks! chris
Re: [PHP] SQL Statement
Sorry... michi.. I've ignored your advice to quote the script as : > 3. > you have to quote "v$session": "v\$session" - yeah.. the script is work when I change the script right below : $query = "Select OSUSER >From v\$session Where USERNAME = (Select USER From DUAL) And AUDSID =(Select USERENV('SESSIONID') From DUAL)"; great thanks in advance to michi... ^_^ - Original Message - From: "èdy kurniawan" <[EMAIL PROTECTED]> Subject: Re: [PHP] SQL Statement > thanks to michi for ASAP response... > but I thought your opinion not actually right.. > > I've a sql : > > $query = "Select dfl_desc From > fmmis__datafls@dbhonda Where dfl_flag = > (Select dpb_flag From fmadm_gs00_dtlppbs@dbhonda > Where DPB_PARTNONSTOCK = '".$TT[$n]."') > And DFL_KDDOK ='PPM'"; > > its a kind of subselect (or oracle-ist usual call it nested query) and it > works properly. > > as your sugesstion, I've ever put a simple script : > $query = "Select OSUSER > From v$session"; > > and the error is still occured. > > Ora_Parse failed (ORA-00942: table or view does not exist > > > O.k. but at all... i'm very appreciate for your response michi .. > > any other ideas ? > > sincerely, > edyk - Original Message - From: <[EMAIL PROTECTED]> Sent: Wednesday, June 19, 2002 1:26 PM Subject: Re: [PHP] SQL Statement > this is the problem: > > $query = "Select OSUSER > >From v$session > Where USERNAME = (Select USER From DUAL) > And AUDSID =(Select USERENV('SESSIONID') From DUAL)"; > > 1. > mysql does NOT support subselects! > 2. > delete the "<" in front of "FROM" > 3. > you have to quote "v$session": "v\$session" > > start with a short query like: > $query = "select OSUSER from v\$session where USERNAME like 'foo'"; > > then you have to recode the subselects with php-loops!!! > michi > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Statement
this is the problem: $query = "Select OSUSER >From v$session Where USERNAME = (Select USER From DUAL) And AUDSID =(Select USERENV('SESSIONID') From DUAL)"; 1. mysql does NOT support subselects! 2. delete the "<" in front of "FROM" 3. you have to quote "v$session": "v\$session" start with a short query like: $query = "select OSUSER from v\$session where USERNAME like 'foo'"; then you have to recode the subselects with php-loops!!! michi -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Statement
Hello PHP mania, I'm a newcomer right here, i just wanna ask a litle dummy question : I put the SQL below into my SQL Plus editor : ** Select OSUSER >From v$session Where USERNAME = (Select USER From DUAL) And AUDSID =(Select USERENV('SESSIONID') From DUAL) * and it works with the output is my logon OS. when I's connecting with PHP and ORACLE.DLL with the complete script below : * "; exit; } $cursor = Ora_Open ($connection); if ($cursor == false){ echo Ora_ErrorCode($connection).": ".Ora_Error($connection).""; exit; } #check admin $query = "Select OSUSER >From v$session Where USERNAME = (Select USER From DUAL) And AUDSID =(Select USERENV('SESSIONID') From DUAL) "; $result = Ora_Parse ($cursor, $query); if ($result == false){ echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor).""; exit; } $result = Ora_Exec ($cursor); if ($result == false){ echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor).""; exit; } while (Ora_Fetch_Into ($cursor, &$values)){ $admin = $values[0]; } echo " USER Anda sekarang : $admin"; Ora_Close ($cursor); Ora_Logoff ($connection); ?> *** the error occured : Warning: Ora_Parse failed (ORA-00942: table or view does not exist -- while processing OCI function OPARSE) in c:\phpdev\www\project\test\osuser.php on line 22 942: ORA-00942: table or view does not exist -- while processing OCI function OPARSE why its happen ? in the right rule of oracle, if this table or view does not exist (V$SESSION) my SQL will not work in SQL Plus editor. Please, help me ASAP... TIA, edyk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql commnad in a for loop !
Uh, Mr Flesh: On Tue, Jun 18, 2002 at 05:54:21PM +0100, Septic Flesh wrote: > > for $day=1 until $day=31 > { > count how many records (rows) there are in the tracker table, > without counting rows that contain the same "user_id" value, > when the day=$day. > } What have you tried so far? Did you look at the Control Structures portion of the PHP manual on php.net yet? Also, your approach is overly complex. Use a GROUP BY statement in your query. Check out the MySQL (or whatever database you're using) manual for more info the on that. In this case, write something like "GROUP BY day, user_id" --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql help ?
> or one line for each sess_id with only one row: > select * from tracker where count(sess_id)=1 and day='1' and month=' > ".$month." ' group by sess_id; sorry that was wrong! correct: select * from tracker where day='1' and month=' ".$month." ' group by sess_id having count(sess_id)=1; michi -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql help ?
> select * from tracker where day='1' and month=' ".$month." ' XXX"; > > XXX = but donot return values with the same value in the "sess_id" field > > what should XXX be ? one line for each sess_id select * from tracker where day='1' and month=' ".$month." ' group by sess_id; or one line for each sess_id with only one row: select * from tracker where count(sess_id)=1 and day='1' and month=' ".$month." ' group by sess_id; michi -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sql help ?
select * from tracker where day='1' and month=' ".$month." ' XXX"; XXX = but donot return values with the same value in the "sess_id" field what should XXX be ? thanks in advance... -- Sapilas@/dev/pinkeye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sql commnad in a for loop !
I wanna make the following sql query which looks a bit complicated., and put it in a for loop too for all days from 1 to 31. == for $day=1 until $day=31 { count how many records (rows) there are in the tracker table, without counting rows that contain the same "user_id" value, when the day=$day. } == how do i CALL then each result to display them in a web page ? Can something like that happen, or shall I repeate the same query 31 times ? :( Thanks in advance.. -- Sapilas@/dev/pinkeye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL question, getting error and not sure why
My following query : insert into acteursenc (nuacteur,nomacteur) (select AA, BB from (select max(nuacteur)+1 AA from acteursenc), (select 'Michael Sweeney' BB from acteursenc))" produces an ORA-1: unique constraint error. The primary key is nuacteur, but by setting AA to max(nuacteur)+1 I should be getting a new key that is unique, however it does not seem that way. What am I doing wrong here? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL Server test tool
This is not tested but should work $mysql_host = "localhost:1433"; $mysql_login = "billy"; $mysql_pw = "bob"; if(!$db_conn = mysql_connect($mysql_host, $mysql_login, $mysql_pw)){ echo "Connection Failed"; } Robert W. Collins II Webmaster New Orleans Regional Transit Authority Phone : (504) 248-3826 Email : [EMAIL PROTECTED] -Original Message- From: Scott St. John [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 15, 2002 6:53 AM To: [EMAIL PROTECTED] Subject: [PHP] SQL Server test tool Has anyone seen or know if it is possible to use PHP to test if a SQL server is alive on port 1433? I know I could run a query, but was looking for something to actually test on the port. Thanks, -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL Server test tool
Just attempt to connect. If it succeeds, the server is alive. Matthew Walker Senior Software Engineer ePliant Marketing -Original Message- From: Scott St. John [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 15, 2002 6:53 AM To: [EMAIL PROTECTED] Subject: [PHP] SQL Server test tool Has anyone seen or know if it is possible to use PHP to test if a SQL server is alive on port 1433? I know I could run a query, but was looking for something to actually test on the port. Thanks, -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL Server test tool
I would imagine that you could use fsockopen to open a socket connection on that port in order to test it. -Jared -Original Message- From: Scott St. John [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 15, 2002 8:53 AM To: [EMAIL PROTECTED] Subject: [PHP] SQL Server test tool Has anyone seen or know if it is possible to use PHP to test if a SQL server is alive on port 1433? I know I could run a query, but was looking for something to actually test on the port. Thanks, -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Server test tool
Has anyone seen or know if it is possible to use PHP to test if a SQL server is alive on port 1433? I know I could run a query, but was looking for something to actually test on the port. Thanks, -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL session handler problem
Hi! I just wrote a SQL session handler class using some info from the example at http://gateway.digitaria.com/~chris/php/mysql_session_handler/. And.. everything works perfectly, until I attempt to set a session variable, and the custom write function get's executed. It seems that the data parameter passed to the function is empty, no matter what I do. The session-id parameter is correct (and users keep their sessions, it seems like things are working except this), but the data parameter is empty. I read in the example on the URL above that if you didn't set session.save_handler to user, something would go bad during write. The session class can be found at http://www.nordheim.no/temp/session.class.phps (no use to paste the whole thing here I guess). Never mind those funny database-class-things in there, it's just a PEAR DB-wrapper (imagine that, a wrapper-wrapper ;). I'm initiating the class like this; $session = new Session(); /* Constructor will set session.save_handler */ $session->setHandler(); /* This will define session handlers */ $session->Start(); /* Executes session_start(). Is that enough? Works with the default session handler ;) */ ..then, I set a session variable: $_SESSION["test"] = "TESTING"; then, the $session->_write() functions gets executed, but the data parameter is blank. Can anyone tell me what I'm doing wrong here? I'm running PHP 4.2.0 on Apache 1.3.24 (Linux). -- Trond Arve Nordheim - "This message is ROT13-encrypted twice for extra security." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Query (Group By)
Hi, This is more a SQL question that a php one, but here goes: I have a table with 3 fields, Date, IP, ISP. Basically I have written some php to store the following in the table each time someone hits a page on my site. Now I want to display some info about the users currently on my site, but I want to try and do it with 1 SQL query. Basically I want to display a count of how many unique IPs there are on my site from each ISP... for example 3 NTL 1 BT 5 Freeserve but in each group there will be more than 1 entry for each user due to them causing a row in the table on each hit. I can't seem to group it together how I want with 1 query. The best I can do is count how many rows are from each IP (but this figure is too high since it doesn't take into account that the IPs must be unique). Here is my current SQL: $sql = "SELECT ISP, COUNT(*) as total FROM track GROUP BY ISP ORDER BY total DESC"; I could make this work by doing some sorting in PHP once I get the data, but I would prefer to do it with SQL... Anyone know how to do what I want? Thanks Andrew
Re: [PHP] SQL Warning
Hey... Ok Firs Mike.. Yes I have been "fixing" some of her scripts and saw she used this too.. Unbelievably I also so this point about the string in the string without concat op's but incredibly it works.. Now back to reason why it don't work.. Okay Jenny.. Hi again :) Next.. Do you have anything actually IN your table ({$config["prefix"]}_users) ?? If so does the username in it match {$session["uid"]} ?? If it doesn't and mysql_query returns a error cos a) table don't exist or b) some other sql error such as column name wrong etc.. Then mysql_fetch_array will cough up error.. This happened when I setup your scripts on my box.. And whenever I setup any scripts in which I don't yet have any records matching the query so mysql_fetch_array goes nuts.. Ok.. Hope it helped.. ::: : Julien Bonastre [The-Spectrum.org CEO] : A.K.A. The_RadiX : [EMAIL PROTECTED] : ABN: 64 235 749 494 : QUT Student :: 04475739 ::: - Original Message - From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]> To: "'Jennifer Downey'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, April 24, 2002 10:05 PM Subject: RE: [PHP] SQL Warning > > -Original Message- > > From: Jennifer Downey [mailto:[EMAIL PROTECTED]] > > Sent: 24 April 2002 04:46 > > > > Would you please direct your attention to this URL > > > > http://testphp.netfirms.com/code1.html > > > > Look at the bottom where the big orange commented syntax is > > and explain what > > is going on there? > > > $query = "SELECT name FROM {$config["prefix"]}_users WHERE uid={$session["uid"]}"; > > $ret = mysql_query($query); > > > > // this is line 14 > while($row = mysql_fetch_array($ret)) > . > . > . > // this is the problem area. It is giving me this sql warning Warning: Supplied argument is not a valid MySQL result resource in /home/public_html/sortitems.php on line 14 look at top for line 14 why is it > > // looking at line 14 I am not asking for any of that information? > > > No idea why the error message is so far down the page, but it is certainly referring to line 14 -- it is telling you that the $ret you are supplying to mysql_fetch_array is invalid. Why? Because the mysql_query failed, and so $ret was not assigned valid result resource. This is why you should ALWAYS check the return value of a mysql_query call before trying to fetch its results. > > Now, why is the query failing? Well, let's take a look at this line: > > $query = "SELECT name FROM {$config["prefix"]}_users WHERE uid={$session["uid"]}"; > > The stuff to the right of the "=" consists of: > > (1) the string "SELECT name FROM {$config[" > (2) the constant named prefix (which, I guess, doesn't exist) > (3) the string "]}_users WHERE uid={$session[" > (4) the constant named uid (ditto!) > (5) the string "]}" > > with NO concatenation operators in between. > > This line ought to generate multiple warnings and notices -- you must have error_reporting set to suppress all these useful messages, so I suggest you change it to something more useful forthwith (such as E_ALL, or at least E_ALL ^ E_NOTICE). > > So, the final solution to your problem would be either of the following: > > $query = "SELECT name FROM {$config[\"prefix\"]}_users WHERE uid={$session[\"uid\"]}"; > > $query = "SELECT name FROM {$config['prefix']}_users WHERE uid={$session['uid']}"; > > Hope this helps. > > Cheers! > > Mike > > - > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Beckett Park, LEEDS, LS6 3QS, United Kingdom > Email: [EMAIL PROTECTED] > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php