[PHP-DB] PHP problem
Sorry to be a little bit off topic i have code that generates: SELECT NAME=xxx OPTION LABEL=1LONG TEXT 1 OPTION LABEL=2LONG TEXT 2 OPTION LABEL=3LONG TEXT 3 /SELECT in the script I check value of $xxx and I get i.e. LONG TEXT 1 despite of 1. Do you have any idea on this. PS. Placing /OPTION at the end of each line doesn't help thanks in advance Bartlomiej Pawlik -- Okrel Swoje potrzeby - my znajdziemy ofert za Ciebie! [ http://oferty.onet.pl ]
Re: [PHP-DB] PHP problem
- Original Message - From: Bartek Pawlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 26, 2002 11:11 AM Subject: [PHP-DB] PHP problem Sorry to be a little bit off topic i have code that generates: OPTION LABEL=1LONG TEXT 1 use: option value=1long text 1/option mvgr, Joffrey van Wageningen -- .-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]-- | Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue | PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863 | * We demand guaranteed rigidly defined areas of doubt and uncertainty. | -- Douglas Adams -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Grouped sql output
Hi friends, I've been struggling for a while now so I thought I'd ask. What's the easiest way to for to print group sql output. For example I need to output customers grouped by zip. Like: zip customer a customer b zip customer d customer e zip customer c custoemr f customer g Do I need to build array's and loop through them or can I print straight from a record set ( using Postgresql or Mysql ) Thanks heaps ! Regards Rudi. = Get your personalised email and homepage at www.easymail.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Grouped sql output
Thanks Sven, I've already got the sql OK. I have the records set but I want to print it report like So It's needs some thing like a loop with an inner loop Like ol lizip ul licustomer licustomer /ul lizip ul licustomer licustomer /ul /ol Hope this makes sense. I'll elaborate more if you think I should. Cheers Rudi. Hi friends, I've been struggling for a while now so I thought I'd ask. What's the easiest way to for to print group sql output. For example I need to output customers grouped by zip. Like: zip customer a customer b zip customer d customer e zip customer c custoemr f customer g Do I need to build array's and loop through them or can I print straight from a record set ( using Postgresql or Mysql ) Thanks heaps ! Regards Rudi. = Get your personalised email and homepage at www.easymail.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Get your personalised email and homepage at www.easymail.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Grouped sql output
Hi, I've done this before in coldfusion. It's the one thing I'm note sure on how to do the same(ish) in PHP - my language of choice. If we have the record set the CF code would look like ul cfoutput query=customers group=zip !--- loop through record set --- li#zip# ol cfoutput !--- inner loop on group by zip --- li#customer# /cfoutput /ol /cfoutput /ul So I'm think also to use 2 loops for the same purpose in PHP. Can I do this from the record set like above or do I need to build array's I wonder ? Cheers Rudi. Thanks Sven, I've already got the sql OK. I have the records set but I want to print it report like So It's needs some thing like a loop with an inner loop Like ol lizip ul licustomer licustomer /ul lizip ul licustomer licustomer /ul /ol Hope this makes sense. I'll elaborate more if you think I should. Cheers Rudi. Hi friends, I've been struggling for a while now so I thought I'd ask. What's the easiest way to for to print group sql output. For example I need to output customers grouped by zip. Like: zip customer a customer b zip customer d customer e zip customer c custoemr f customer g Do I need to build array's and loop through them or can I print straight from a record set ( using Postgresql or Mysql ) Thanks heaps ! Regards Rudi. = Get your personalised email and homepage at www.easymail.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = = Get your personalised email and homepage at www.easymail.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] using sendmail w/ windows
CrossWalkCentral, any one know how to use send mail with windows instead of linux. Will this work are their other options? Beware of crosswires! Yes one can send mail (the activity of email) from PHP running on Windows. I wouldn't bother with loading sendmail (the name of the package) onto a Windows machine! Take a look at the php.ini's mail section. There are three lines. One is Unix only - leave commented out. Uncomment the other two. One is your default 'from' address. The other points PHP at an SMTP server (can be on any machine - the PHP server, another in the local network, some remote/ISP on the Internet). RTFM about mail(). Email from PHP under Windows is in many ways easier than the same under Linux! Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Odp: [PHP-DB] PHP problem
Unfortunately, it doesn't work, the same situation Sorry to be a little bit off topic i have code that generates: OPTION LABEL=1LONG TEXT 1 use: option value=1long text 1/option mvgr, Joffrey van Wageningen -- .-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]-- | Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue | PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863 | * We demand guaranteed rigidly defined areas of doubt and uncertainty. | -- Douglas Adams -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Okresl Swoje potrzeby - my znajdziemy oferte za Ciebie! [ http://oferty.onet.pl ] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Euro Dates into MySQL
Hi all, I have a site where dates are being displayed and also entered by users. I don't want to offend them by asking them to use the -mm-dd format or to split the date into its constituent parts. I am displaying by using the MySQL Date_Format syntax and that's fine. I get dd/mm/ and I want to be able to have the user enter 'dd/mm'' into a form and have it put into MySQL in the -mm-dd format. Now I have written a function in php to do this but I might be mising an easier, more elegant/efficient way of doing this. Any suggestions? George P, in Edinburgh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Grouped sql output
Hi Rudi, I've been struggling for a while now so I thought I'd ask. What's the easiest way to for to print group sql output. For example I need to output customers grouped by zip. Like: zip customer a customer b zip customer d customer e zip customer c custoemr f customer g Do I need to build array's and loop through them or can I print straight from a record set ( using Postgresql or Mysql ) As a general rule, I would ask the RDBMS to do as much as possible (WHERE, GROUP BY, ORDER BY, HAVING), before handing the data to PHP - then use PHP to concentrate on getting the formatting/presentation (HTML) right! What you're asking for is quite common - and easy to implement (once you know how). Does that 'philosophy' answer your question, or were you wanting coding-level advice? If so, please post your current SQL query and if it's not too long, the pertinent part of your PHP prototype, and I/someone else here, will be happy to make suggestions. Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP problem
Bartek, This is snipped from a working form on my site: select name=ASOp option value=cn selectedcontains option value=eqexact match option value=bwbegins with /select and it works. George - Original Message - From: Bartek Pawlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 26, 2002 10:49 AM Subject: Odp: [PHP-DB] PHP problem Unfortunately, it doesn't work, the same situation Sorry to be a little bit off topic i have code that generates: OPTION LABEL=1LONG TEXT 1 use: option value=1long text 1/option mvgr, Joffrey van Wageningen -- .-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]-- | Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue | PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863 | * We demand guaranteed rigidly defined areas of doubt and uncertainty. | -- Douglas Adams -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Okresl Swoje potrzeby - my znajdziemy oferte za Ciebie! [ http://oferty.onet.pl ] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Grouped sql output
Hi Rudi, I've done this before in coldfusion. It's the one thing I'm note sure on how to do the same(ish) in PHP - my language of choice. If we have the record set the CF code would look like ul cfoutput query=customers group=zip !--- loop through record set --- li#zip# ol cfoutput !--- inner loop on group by zip --- li#customer# /cfoutput /ol /cfoutput /ul So I'm think also to use 2 loops for the same purpose in PHP. Can I do this from the record set like above or do I need to build array's I wonder ? No need for arrays - the resultset from the RDBMS effectively is one - SQL-talk says it's a table (please show us your SQL query if you have any doubt about this). Make sure the SQL resultset is sorted/grouped correctly! You're approach looks right to me - just more CF than PHP-like. How's this? query RDBMS check result ok/have at least one row extract first row initiate presentation WHILE not EoD note zip code ECHO zip heading WHILE this row's zip == noted zip AND not EoD ECHO customer data end while zip extract next row from resultset end while data terminate presentation OK? Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Grouped sql output
Not entirely sure what you're trying to do, but would it be sensible to use... $sql=SELECT * FROM Customers ORDER BY zip ASC; . . and then when you've got the results... if ($myrow = mysql_fetch_array($result)) { $zip=0; $zipcount=0; do { if ($zip!=$myrow[zip]){ if ($zipcount!=0){ echo (/ol\n/ul\n); }else{ $zipcount=1; } echo (ul\nli$zip/li\nol\n); } echo (li$myrow[customer]/li\n); }while ($myrow = mysql_fetch_array($result)); echo (/ol\n/ul\n); } or something like that anyways ;) hope that's useful? cheers, Matt -Original Message- From: Rudi Starcevic [mailto:[EMAIL PROTECTED]] Sent: 26 February 2002 11:02 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Grouped sql output Hi, I've done this before in coldfusion. It's the one thing I'm note sure on how to do the same(ish) in PHP - my language of choice. If we have the record set the CF code would look like ul cfoutput query=customers group=zip !--- loop through record set --- li#zip# ol cfoutput !--- inner loop on group by zip --- li#customer# /cfoutput /ol /cfoutput /ul So I'm think also to use 2 loops for the same purpose in PHP. Can I do this from the record set like above or do I need to build array's I wonder ? Cheers Rudi. Thanks Sven, I've already got the sql OK. I have the records set but I want to print it report like So It's needs some thing like a loop with an inner loop Like ol lizip ul licustomer licustomer /ul lizip ul licustomer licustomer /ul /ol Hope this makes sense. I'll elaborate more if you think I should. Cheers Rudi. Hi friends, I've been struggling for a while now so I thought I'd ask. What's the easiest way to for to print group sql output. For example I need to output customers grouped by zip. Like: zip customer a customer b zip customer d customer e zip customer c custoemr f customer g Do I need to build array's and loop through them or can I print straight from a record set ( using Postgresql or Mysql ) Thanks heaps ! Regards Rudi. = Get your personalised email and homepage at www.easymail.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = = Get your personalised email and homepage at www.easymail.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.323 / Virus Database: 180 - Release Date: 08/02/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP problem
Dear Bartlomiej Pawlik, Try: SELECT NAME=xxx OPTION VALUE=1LONG TEXT 1 OPTION VALUE=2LONG TEXT 2 OPTION VALUE=3LONG TEXT 3 /SELECT Greetings, Maarten Verheijen - Original Message - From: Bartek Pawlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 26, 2002 11:11 AM Subject: [PHP-DB] PHP problem Sorry to be a little bit off topic i have code that generates: SELECT NAME=xxx OPTION LABEL=1LONG TEXT 1 OPTION LABEL=2LONG TEXT 2 OPTION LABEL=3LONG TEXT 3 /SELECT in the script I check value of $xxx and I get i.e. LONG TEXT 1 despite of 1. Do you have any idea on this. PS. Placing /OPTION at the end of each line doesn't help thanks in advance Bartlomiej Pawlik -- Okrel Swoje potrzeby - my znajdziemy ofert za Ciebie! [ http://oferty.onet.pl ] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: using sendmail w/ windows
You can use PHP to send mail. If you wish to set it up: Open the php.ini and look for: [mail function] ; For Win32 only. SMTP= this will be your smtp server; for Win32 only ; For Win32 only. sendmail_from= this will be your email address; for Win32 only ; For Unix only. You may supply arguments as well (default: 'sendmail -t -i'). ;sendmail_path=this is the path to sendmail --leave this commented out. HTH Jennifer Downey Crosswalkcentral [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... any one know how to use send mail with windows instead of linux. Will this work are their other options? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Grouped sql output
Hi, Thanks for the input, I'll stop messing around and post some code Be warned this code is untested :-) It's kinda like thinking out loud. I think this should produce a nested list output from a query. Given this query : SELECT count(zip) AS zipcount,zip,cust_last_name FROM customers GROUP BY zip ORDER BY zip,cust_last_name; My php code might look like : ( for Postgresql ) $thiszip = pg_result($res,0,0); // the first zip code in the record set echo ul; // open main list for ( $i=0; $i=pg_numrows($res); ++$i ) // begin loop over record set { if ( pg_result($res,$i,0) != $thiszip ) // if this zip is the same as the last { if ( $thiszip != no_zip_yet ) // if this is true we have an open ol list { echo /ol;} echo li.pg_result($res,$i,0); // output zip code echo ol; // open inner list echo li.pg_result($res,$i,1); // output customer data $thiszip = pg_result($res,$i,0); // track current zip } else // zip is same as last one { echo li.pg_result($res,$i,1); // output customer data } } // finish loop. echo /ul; // close main list. What do you think ? I'll test it tomorrow at work. I'll let you know how she goes. Thanks for your time, suggestions and attention. Much appreciated. Regards Rudi. = Get your personalised email and homepage at www.easymail.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP, Oracle and iso-8859-1 characters
Hello, I have a database that contains text with accented vowels (àèéìòù). They are displayed just fine when accessing the database from Java/JSP pages on the same machine and DB, but from PHP I get the vowels without the accent (à = a, è = e). The database uses UTF-8 encoding. Platform infos: Red Hat Linux Apache 1.3.20 PHP 4.1.1 (accepting ISO-8859-15 and UTF-8) Oracle 8.1.7 (using UTF-8 encoding, accessed using the OCI API) I'd be really happy to have even the slighties hint about the issue Thanks in advance Michele P.S. I'm not on the list, please CC: me, thanks again -- Michele Campeotto Wireless Team E-TREE S.p.A. __ Via Fonderia 45 - 31100 Treviso - Italy- ph.+39.0422.3107 fax.+39.0422.310888 www.e-tree.com www.webanana.com ___ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Passing contents of array on as variables...
Would you have an example of that? Jas Beau Lebens [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... rather than all the hidden fields and stuff you guys are trying to do - why not just build the array variable you want, then save it into a session, on the next page, access the session variable and wallah - there's your array, still in tact and just as you left it (ie. containing all the info you want, not the word Array) HTH beua // -Original Message- // From: jas [mailto:[EMAIL PROTECTED]] // Sent: Monday, 25 February 2002 5:50 PM // To: [EMAIL PROTECTED] // Subject: Re: [PHP-DB] Passing contents of array on as variables... // // // Bjorn, // I just wanted to thank you for giving me alot of insight // into what I was // trying to accomplish however, due to time restraints I have // decided to do it // a different way by pulling the entries into a select box // that a customer can // use to delete the different items. Once again, thanks a ton // Jas // // Jas [EMAIL PROTECTED] wrote in message // [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... // Ok, I think I understand what you are talking about. So // now I know what I // need to accomplish, and would you happen to know of a good // place to learn // about something like this? For some reason this function // keeps seeming to // elude me and if you know of a good tutorial on how to // accomplish this I // would appreciate it. Thanks again, // Jas // [EMAIL PROTECTED] wrote in message // [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... // One problem I see is that you are sending all of the // values for all of // your // fields (except the id field) from the first page to the // second page, not // just // the ones that are checked, so even if it was working // properly, you would // get // a list of all items in the table, not just the checked // items. You need // to // send the array of id's (since this is the name for the // checkbox) from // the // first page to the second one (again in the checkbox form // element, you // did // not // put a value on it). // // What your first page is currently doing is pulling all of the // information // out // of the database. Then as soon as you pull each item out, you are // putting // it // into an hidden form element array, ie. $car_type[], // $car_model[], etc. // regardless of whether the checkbox is checked or not to // pass to the next // page. You do not know if the checkbox is checked or not // until the next // page // when it looks at the values in the id array. On the // second page, you // need // to // look at the id array and then (through a database call) // pull the row // from // the // table for each id in the array. // // HTH // // MB // // jas [EMAIL PROTECTED] said: // //$i=0; //while // // ($car_type[$i],$car_model[$i],$car_year[$i],$car_price[$i],$c // ar_vin[$i]) // { //$i ++; //} //Is what I added and this is what is being output to // the screen at this //point... //=0; while () { ++; } //now i am still too new to php to understand why it is // not putting the //contents of the array into my hidden fields like it // does on my first // page (i //can see them when I view source). //[EMAIL PROTECTED] wrote in message //[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... // When you call your $car_type in the second page, you // need to set a //variable // starting at 0 and call it as $car_type[0] and loop // through all of // the //values // in the array. // // ie. // // $i=0; // while ($car_type[$i]) { // // I have added more code below that should help. // // MB // // // jas [EMAIL PROTECTED] said: // // Yeah, tried that and it still isnt passing the // contents of the // array // as //a // varible to the confirmation page for deletion. I // am at a loss on // this //one. // [EMAIL PROTECTED] wrote in message // [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... // You didn't add the value part of the hidden element, ie. // // INPUT TYPE=\hidden\ NAME=\car_type\ // value=\$myrow[car_type]\ // // You were naming the field as an array with no value. // // if you want to pass this as an array of values, // you would need // to // use: // // INPUT TYPE=\hidden\ NAME=\car_type[]\ // value=\$myrow[car_type]\ // // Give that a try and see if it works. // // HTH // // MB // // // jas [EMAIL PROTECTED] said: // //As of right now if you run the php script and // view source on // the //page // you //can see that it does place the
RE: [PHP-DB] PHP, Oracle and iso-8859-1 characters
try setting NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252 or ENGLISH.UNITED KINGDOM.WE8MSWIN1252 in php. That should work. -Original Message- From: michele campeotto [mailto:[EMAIL PROTECTED]] Sent: 26 February 2002 15:53 To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP, Oracle and iso-8859-1 characters Hello, I have a database that contains text with accented vowels (àèéìòù). They are displayed just fine when accessing the database from Java/JSP pages on the same machine and DB, but from PHP I get the vowels without the accent (à = a, è = e). The database uses UTF-8 encoding. Platform infos: Red Hat Linux Apache 1.3.20 PHP 4.1.1 (accepting ISO-8859-15 and UTF-8) Oracle 8.1.7 (using UTF-8 encoding, accessed using the OCI API) I'd be really happy to have even the slighties hint about the issue Thanks in advance Michele P.S. I'm not on the list, please CC: me, thanks again -- Michele Campeotto Wireless Team E-TREE S.p.A. __ Via Fonderia 45 - 31100 Treviso - Italy- ph.+39.0422.3107 fax.+39.0422.310888 www.e-tree.com www.webanana.com ___ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Formating field type text in HTML
Hi all! I have a table in postgres with a field type text, where I can store a formated text. When I take this field to my page, there's no one html tag inside the content displayed. Can I read the content of the field, line by line, putting a br at the end? How can I do something like this? Inside the database, I used the option \H, to see the result in HTML. It was ok, with the br in the right place. How can I use this output in my page? Is it possible to pass the \H to the database using php? Thanks a lot. -- Jairo Tcatchenco [EMAIL PROTECTED] Coordenadoria de Defesa Agropecuária - CDA Secretaria de Agricultura e Abastecimento do Estado de São Paulo - SAA/SP -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Formating field type text in HTML
Hi there:) Take a look at nl2br() function ..it converts \n to br tag HTH Joe :) Jairo Tcatchenco [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all! I have a table in postgres with a field type text, where I can store a formated text. When I take this field to my page, there's no one html tag inside the content displayed. Can I read the content of the field, line by line, putting a br at the end? How can I do something like this? Inside the database, I used the option \H, to see the result in HTML. It was ok, with the br in the right place. How can I use this output in my page? Is it possible to pass the \H to the database using php? Thanks a lot. -- Jairo Tcatchenco [EMAIL PROTECTED] Coordenadoria de Defesa Agropecuária - CDA Secretaria de Agricultura e Abastecimento do Estado de São Paulo - SAA/SP -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Finding records with NULL values
I have a table of questions, and a table of responses (initially empty) which gets updated every time an answer is submitted, with the question number, member id and response. I wish to produce a SELECT query that will find the questions that haven't been answered by a particular member, i.e. a query that finds the questions that DO NOT have an entry in responses. How can I do this? Regards, Robin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] variable interpolation in mysql queries
Hi, Im kinda new to this list. Can anyone tell me what is the proper way to interpolate my php variables into my mysql queries? I've been trying $query = SELECT password FROM users WHERE login='$login'; then: mysql_query($result); $pd = mysql_result($result); but I get a message that says: Supplied Argument is not a valid MySQL-Link resource any ideas, anyone? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] variable interpolation in mysql queries
$query=query; $result=mysql_query($query); $pd=mysql_result($result); Notice the zig-zag - $query is first on the left side, then on the right side, then $result is first on the left side, then on the right side. Bogdan Ryan Snow wrote: Hi, Im kinda new to this list. Can anyone tell me what is the proper way to interpolate my php variables into my mysql queries? I've been trying $query = SELECT password FROM users WHERE login='$login'; then: mysql_query($result); $pd = mysql_result($result); but I get a message that says: Supplied Argument is not a valid MySQL-Link resource any ideas, anyone? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Finding records with NULL values
Hi Robin, Use a standard select like you normally would, and in your where clause, use where [field] is null : select field1[, field2, ...] from table1[, table2, ...] where fieldx is null [...] -bsh Robin McKenzie wrote: I have a table of questions, and a table of responses (initially empty) which gets updated every time an answer is submitted, with the question number, member id and response. I wish to produce a SELECT query that will find the questions that haven't been answered by a particular member, i.e. a query that finds the questions that DO NOT have an entry in responses. How can I do this? Regards, Robin -- /-=[ BILLY S HALSEY ]=--\ | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW | | All opinions and technical advice offered in this message are my | | own and not necessarily endorsed by my employer. | \--=[ [EMAIL PROTECTED] ]=/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] variable interpolation in mysql queries
PS. You should consider using mysql_fetch_row() or at least mysql_fetch_array() for perforance reasons. B Bogdan Stancescu wrote: $query=query; $result=mysql_query($query); $pd=mysql_result($result); Notice the zig-zag - $query is first on the left side, then on the right side, then $result is first on the left side, then on the right side. Bogdan Ryan Snow wrote: Hi, Im kinda new to this list. Can anyone tell me what is the proper way to interpolate my php variables into my mysql queries? I've been trying $query = SELECT password FROM users WHERE login='$login'; then: mysql_query($result); $pd = mysql_result($result); but I get a message that says: Supplied Argument is not a valid MySQL-Link resource any ideas, anyone? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] variable interpolation in mysql queries
Would it be faster if all you wanted was one variable, or your SQL statement only returned on cell? -- William Fong - [EMAIL PROTECTED] Phone: 626.968.6424 x210 | Fax: 626.968.6877 Wireless #: 805.490.7732| Wireless E-mail: [EMAIL PROTECTED] - Original Message - From: Bogdan Stancescu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Ryan Snow [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, February 26, 2002 2:32 PM Subject: Re: [PHP-DB] variable interpolation in mysql queries : PS. You should consider using mysql_fetch_row() or at least : mysql_fetch_array() for perforance reasons. : : B : : Bogdan Stancescu wrote: : : $query=query; : $result=mysql_query($query); : $pd=mysql_result($result); : : Notice the zig-zag - $query is first on the left side, then on the : right side, then $result is first on the left side, then on the right : side. : : Bogdan : : Ryan Snow wrote: : : Hi, Im kinda new to this list. Can anyone tell me what is the proper : way to interpolate my php variables into my mysql queries? : : I've been trying $query = SELECT password FROM users WHERE : login='$login'; : : : then: : mysql_query($result); : $pd = mysql_result($result); : : but I get a message that says: Supplied Argument is not a valid : MySQL-Link resource : : any ideas, anyone? : : : : : : : : : : -- : PHP Database Mailing List (http://www.php.net/) : To unsubscribe, visit: http://www.php.net/unsub.php : -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: php-db Finding records with NULL values
Pretty easy really SELECT * FROM foo WHERE bar is NULL - DON'T use quotes NULL is a valid string it is not the same as NULL - Some DBMS's allow you to say bar = NULL but technically this is wrong because NULL is undefined and cannot be equal to anything not even another NULL. - Also is not NULL - be sure you blank fields are NULL and not - A clever way to search for both and NULL in the same query is: SELECT * FROM foo WHERE NOT bar This may not work in all DBMS's but give it a try; OR would work too. Good Luck, Frank On 2/26/02 2:20 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: From: Robin McKenzie [EMAIL PROTECTED] Date: Tue, 26 Feb 2002 21:49:00 - To: [EMAIL PROTECTED] Subject: Finding records with NULL values I have a table of questions, and a table of responses (initially empty) which gets updated every time an answer is submitted, with the question number, member id and response. I wish to produce a SELECT query that will find the questions that haven't been answered by a particular member, i.e. a query that finds the questions that DO NOT have an entry in responses. How can I do this? Regards, Robin -- Frank Flynn Poet, Artist Mystic -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] variable interpolation in mysql queries
First of all that should throw an error, correct syntax is mysql_result ($query, 0) meaning to grab the 0 index returned. I am not sure about performance wise, however I dislike mysql_result since if nothing is returned then you get a runtime error. Instead I like to use list($pd) = mysql_fetch_row ( mysql_query ( select password from users where login = '$login' ) ); Then you can test $pd without getting sql errors. -- Stewart --- Ryan Snow [EMAIL PROTECTED] wrote: Hi, Im kinda new to this list. Can anyone tell me what is the proper way to interpolate my php variables into my mysql queries? I've been trying $query = SELECT password FROM users WHERE login='$login'; then: mysql_query($result); $pd = mysql_result($result); but I get a message that says: Supplied Argument is not a valid MySQL-Link resource any ideas, anyone? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] variable interpolation in mysql queries
Cool, I didn't know you could embed mysql_query(...) inside mysql_fetch_row(...). That's kinda nice--I hate having a line each for 1-connecting, 2-selecting, 3-querying, and 4-resulting. I'll hafta try that. Thanks. Ryan On Tue, 26 Feb 2002, Stewart Gateley wrote: First of all that should throw an error, correct syntax is mysql_result ($query, 0) meaning to grab the 0 index returned. I am not sure about performance wise, however I dislike mysql_result since if nothing is returned then you get a runtime error. Instead I like to use list($pd) = mysql_fetch_row ( mysql_query ( select password from users where login = '$login' ) ); Then you can test $pd without getting sql errors. -- Stewart --- Ryan Snow [EMAIL PROTECTED] wrote: Hi, Im kinda new to this list. Can anyone tell me what is the proper way to interpolate my php variables into my mysql queries? I've been trying $query = SELECT password FROM users WHERE login='$login'; then: mysql_query($result); $pd = mysql_result($result); but I get a message that says: Supplied Argument is not a valid MySQL-Link resource any ideas, anyone? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Advantage Database Server
Has anybody had any luck or tried connecting to ADS from PHP? What is required? Thanks, Stewart __ Do You Yahoo!? Yahoo! Greetings - Send FREE e-cards for every occasion! http://greetings.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php