[PHP-DB] newbie question on PHP Mysql...
Hi all! I'm taking my first steps with PHP MySQL. Can anyone give me a hint on why this would not work? * $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1] '); echo mysql_result($result,0), \n; echo mysql_result($result,0,1); * I get: Warning: mysql_result(): supplied argument is not a valid MySQL result resource Regards, Evert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: newbie question on PHP Mysql...
Hi ! Could you do a print_r($result) after your mysql_query ? Or you sure of your argv[1] ? Sylvain Gourvil Evert Meulie wrote: Hi all! I'm taking my first steps with PHP MySQL. Can anyone give me a hint on why this would not work? * $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1] '); echo mysql_result($result,0), \n; echo mysql_result($result,0,1); * I get: Warning: mysql_result(): supplied argument is not a valid MySQL result resource Regards, Evert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: newbie question on PHP Mysql...
Hi, I guess you used a single quote over the query so the text, $argv[1], was entered into the query rather than the value inside it. try: $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = ' .$argv[1] ); OR $result = mysql_query(SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1]); should do the trick 21nu Sylvain Gourvil wrote: Hi ! Could you do a print_r($result) after your mysql_query ? Or you sure of your argv[1] ? Sylvain Gourvil Evert Meulie wrote: Hi all! I'm taking my first steps with PHP MySQL. Can anyone give me a hint on why this would not work? * $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1] '); echo mysql_result($result,0), \n; echo mysql_result($result,0,1); * I get: Warning: mysql_result(): supplied argument is not a valid MySQL result resource Regards, Evert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: newbie question on PHP Mysql...
Hi Evert, try: echo mysql_result($result,0,0), \n; echo mysql_result($result,0,1); You forgot a zero... Regards, Sigrid Evert Meulie [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi all! I'm taking my first steps with PHP MySQL. Can anyone give me a hint on why this would not work? * $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1] '); echo mysql_result($result,0), \n; echo mysql_result($result,0,1); * I get: Warning: mysql_result(): supplied argument is not a valid MySQL result resource Regards, Evert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: newbie question on PHP Mysql...
Evert Meulie wrote: Hi! I've tried your suggestions, but still get the same error message. The 'print_r($result);' that I added does not print anything, so that would explain why I get the errors. My idea is to call this script with a value, like: script.php value Doesn't that put the value in $argv[1] ? Regards, Evert What do you use to execute your php scripts. Php on linux ssh ? Apache ? call your script with script.php?var=value to get your value in $_GET['var'] But even if your args are emptied, it should return an error in your $result ! Unnawut Leepaisalsuwanna wrote: Hi, I guess you used a single quote over the query so the text, $argv[1], was entered into the query rather than the value inside it. try: $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = ' .$argv[1] ); OR $result = mysql_query(SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1]); should do the trick 21nu Sylvain Gourvil wrote: Hi ! Could you do a print_r($result) after your mysql_query ? Or you sure of your argv[1] ? Sylvain Gourvil Evert Meulie wrote: Hi all! I'm taking my first steps with PHP MySQL. Can anyone give me a hint on why this would not work? * $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1] '); echo mysql_result($result,0), \n; echo mysql_result($result,0,1); * I get: Warning: mysql_result(): supplied argument is not a valid MySQL result resource Regards, Evert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: newbie question on PHP Mysql...
Try This $result = mysql_query(SELECT SUM(AcctInputOctets),SUM(AcctOutputOctets) FROM radacct WHERE username = '$argv[1]' ); this will make sure that even if $arg[1] is empty it still get '' (empty) as part of the query - Original Message - From: Sylvain Gourvil [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Wednesday, September 21, 2005 3:26 PM Subject: [PHP-DB] Re: newbie question on PHP Mysql... Evert Meulie wrote: Hi! I've tried your suggestions, but still get the same error message. The 'print_r($result);' that I added does not print anything, so that would explain why I get the errors. My idea is to call this script with a value, like: script.php value Doesn't that put the value in $argv[1] ? Regards, Evert What do you use to execute your php scripts. Php on linux ssh ? Apache ? call your script with script.php?var=value to get your value in $_GET['var'] But even if your args are emptied, it should return an error in your $result ! Unnawut Leepaisalsuwanna wrote: Hi, I guess you used a single quote over the query so the text, $argv[1], was entered into the query rather than the value inside it. try: $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = ' .$argv[1] ); OR $result = mysql_query(SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1]); should do the trick 21nu Sylvain Gourvil wrote: Hi ! Could you do a print_r($result) after your mysql_query ? Or you sure of your argv[1] ? Sylvain Gourvil Evert Meulie wrote: Hi all! I'm taking my first steps with PHP MySQL. Can anyone give me a hint on why this would not work? * $result = mysql_query('SELECT SUM(AcctInputOctets), SUM(AcctOutputOctets) FROM radacct WHERE username = $argv[1] '); echo mysql_result($result,0), \n; echo mysql_result($result,0,1); * I get: Warning: mysql_result(): supplied argument is not a valid MySQL result resource Regards, Evert -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals computer viruses. This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals computer viruses. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] A question with php.ini
Hi, How does the php.ini need to be setup for SMTP or how do I find it out? Thank-You very much Daryl Booth
Re: [PHP-DB] A question with php.ini
At 03:31 PM 9/21/2005, Daryl Booth wrote: Hi, How does the php.ini need to be setup for SMTP or how do I find it out? Thank-You very much Daryl Booth Google didn't take long . http://www.phplivesupport.com/documentation/viewarticle.php?uid=1aid=70pid=3 and that's pretty clear. It depends on whether you're installing on Linux/BSD or Windows. Somewhere in the online manual there's a parallel example. Miles Thompson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Repetitive Result
I have a table created from two mysql tables which shows all Members of Congress with related data. The Representative's name is pulled from one sql table and the data from another sql table. When the php table comes up on the web page, the name of the Representative for Maryland's 2nd district appears for the 3rd through the eighth districts as well: Representative State District Gilchrest MD 1 Ruppersberger MD 2 Ruppersberger MD 3 Ruppersberger MD 4 Ruppersberger MD 5 Ruppersberger MD 6 Ruppersberger MD 7 Ruppersberger MD 8 The rest of the 435 names are correct in the table on the web page. The data for MD districts 2-8 are correct. The correct names are shown in the sql table on the server for MD districts 2-8 and there are not duplicate entries for Ruppersberger. I tried changing the spelling of Ruppersberger in the sql table on the server and it changed for each of the results for Ruppersberger (districts 2-8) in the web page table. Why am I getting the repetition shown above? Ken -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Repetitive Result
depends on your query, some joins might make for duplicate results...show your code bastien From: [EMAIL PROTECTED] To: php-db@lists.php.net php-db@lists.php.net Subject: [PHP-DB] Repetitive Result Date: Wed, 21 Sep 2005 16:02:48 -0400 I have a table created from two mysql tables which shows all Members of Congress with related data. The Representative's name is pulled from one sql table and the data from another sql table. When the php table comes up on the web page, the name of the Representative for Maryland's 2nd district appears for the 3rd through the eighth districts as well: Representative State District Gilchrest MD 1 Ruppersberger MD 2 Ruppersberger MD 3 Ruppersberger MD 4 Ruppersberger MD 5 Ruppersberger MD 6 Ruppersberger MD 7 Ruppersberger MD 8 The rest of the 435 names are correct in the table on the web page. The data for MD districts 2-8 are correct. The correct names are shown in the sql table on the server for MD districts 2-8 and there are not duplicate entries for Ruppersberger. I tried changing the spelling of Ruppersberger in the sql table on the server and it changed for each of the results for Ruppersberger (districts 2-8) in the web page table. Why am I getting the repetition shown above? Ken -- 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] Repetitive Result
Here's the query (actually pulled from 3 sql tables; no joins): select 109fh4.rep, veteransdata04.state, veteransdata04.cd, 109fh4.party, 1091vote224.vote1091224, veteransdata04.vetpop, veteransdata04.totalexpend*1000, veteransdata04.totalpatients, veteransdata04.medexpend*1000, veteransdata04.totalexpend*1000/veteransdata04.totalpatients from veteransdata04, 109fh4, 1091vote224 where veteransdata04.ident = 109fh4.ident and veteransdata04.ident = 1091vote224.ident and 109fh4.ident = 1091vote224.ident order by $sort_field $sort_order; $data_set = mysql_query($get_data_query, $dbh); * On Wed, 21 Sep 2005 16:11:32 -0400, Bastien Koert [EMAIL PROTECTED] wrote: depends on your query, some joins might make for duplicate results...show your code bastien From: [EMAIL PROTECTED] To: php-db@lists.php.net php-db@lists.php.net Subject: [PHP-DB] Repetitive Result Date: Wed, 21 Sep 2005 16:02:48 -0400 I have a table created from two mysql tables which shows all Members of Congress with related data. The Representative's name is pulled from one sql table and the data from another sql table. When the php table comes up on the web page, the name of the Representative for Maryland's 2nd district appears for the 3rd through the eighth districts as well: Representative State District Gilchrest MD 1 Ruppersberger MD 2 Ruppersberger MD 3 Ruppersberger MD 4 Ruppersberger MD 5 Ruppersberger MD 6 Ruppersberger MD 7 Ruppersberger MD 8 The rest of the 435 names are correct in the table on the web page. The data for MD districts 2-8 are correct. The correct names are shown in the sql table on the server for MD districts 2-8 and there are not duplicate entries for Ruppersberger. I tried changing the spelling of Ruppersberger in the sql table on the server and it changed for each of the results for Ruppersberger (districts 2-8) in the web page table. Why am I getting the repetition shown above? Ken -- 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] Repetitive Result
um, that is a join, just uses the older syntax. try selecting with the distinct clause select distinct(109fh4.rep), veteransdata04.state bastien From: [EMAIL PROTECTED] To: php-db@lists.php.net php-db@lists.php.net Subject: Re: [PHP-DB] Repetitive Result Date: Wed, 21 Sep 2005 16:17:53 -0400 Here's the query (actually pulled from 3 sql tables; no joins): select 109fh4.rep, veteransdata04.state, veteransdata04.cd, 109fh4.party, 1091vote224.vote1091224, veteransdata04.vetpop, veteransdata04.totalexpend*1000, veteransdata04.totalpatients, veteransdata04.medexpend*1000, veteransdata04.totalexpend*1000/veteransdata04.totalpatients from veteransdata04, 109fh4, 1091vote224 where veteransdata04.ident = 109fh4.ident and veteransdata04.ident = 1091vote224.ident and 109fh4.ident = 1091vote224.ident order by $sort_field $sort_order; $data_set = mysql_query($get_data_query, $dbh); * On Wed, 21 Sep 2005 16:11:32 -0400, Bastien Koert [EMAIL PROTECTED] wrote: depends on your query, some joins might make for duplicate results...show your code bastien From: [EMAIL PROTECTED] To: php-db@lists.php.net php-db@lists.php.net Subject: [PHP-DB] Repetitive Result Date: Wed, 21 Sep 2005 16:02:48 -0400 I have a table created from two mysql tables which shows all Members of Congress with related data. The Representative's name is pulled from one sql table and the data from another sql table. When the php table comes up on the web page, the name of the Representative for Maryland's 2nd district appears for the 3rd through the eighth districts as well: Representative State District Gilchrest MD 1 Ruppersberger MD 2 Ruppersberger MD 3 Ruppersberger MD 4 Ruppersberger MD 5 Ruppersberger MD 6 Ruppersberger MD 7 Ruppersberger MD 8 The rest of the 435 names are correct in the table on the web page. The data for MD districts 2-8 are correct. The correct names are shown in the sql table on the server for MD districts 2-8 and there are not duplicate entries for Ruppersberger. I tried changing the spelling of Ruppersberger in the sql table on the server and it changed for each of the results for Ruppersberger (districts 2-8) in the web page table. Why am I getting the repetition shown above? Ken -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Repetitive Result
That didn't do it. I tried with parentheses around the 109fh4.rep and without the parentheses. The really curious thing is that the repetition only happens within Maryland and starts with the second Maryland entry. The next state is Maine (alphabetical by the abbreviation ME) and there is no repetition. On Wed, 21 Sep 2005 16:36:59 -0400, Bastien Koert [EMAIL PROTECTED] wrote: um, that is a join, just uses the older syntax. try selecting with the distinct clause select distinct(109fh4.rep), veteransdata04.state bastien From: [EMAIL PROTECTED] To: php-db@lists.php.net php-db@lists.php.net Subject: Re: [PHP-DB] Repetitive Result Date: Wed, 21 Sep 2005 16:17:53 -0400 Here's the query (actually pulled from 3 sql tables; no joins): select 109fh4.rep, veteransdata04.state, veteransdata04.cd, 109fh4.party, 1091vote224.vote1091224, veteransdata04.vetpop, veteransdata04.totalexpend*1000, veteransdata04.totalpatients, veteransdata04.medexpend*1000, veteransdata04.totalexpend*1000/veteransdata04.totalpatients from veteransdata04, 109fh4, 1091vote224 where veteransdata04.ident = 109fh4.ident and veteransdata04.ident = 1091vote224.ident and 109fh4.ident = 1091vote224.ident order by $sort_field $sort_order; $data_set = mysql_query($get_data_query, $dbh); * On Wed, 21 Sep 2005 16:11:32 -0400, Bastien Koert [EMAIL PROTECTED] wrote: depends on your query, some joins might make for duplicate results...show your code bastien From: [EMAIL PROTECTED] To: php-db@lists.php.net php-db@lists.php.net Subject: [PHP-DB] Repetitive Result Date: Wed, 21 Sep 2005 16:02:48 -0400 I have a table created from two mysql tables which shows all Members of Congress with related data. The Representative's name is pulled from one sql table and the data from another sql table. When the php table comes up on the web page, the name of the Representative for Maryland's 2nd district appears for the 3rd through the eighth districts as well: Representative State District Gilchrest MD 1 Ruppersberger MD 2 Ruppersberger MD 3 Ruppersberger MD 4 Ruppersberger MD 5 Ruppersberger MD 6 Ruppersberger MD 7 Ruppersberger MD 8 The rest of the 435 names are correct in the table on the web page. The data for MD districts 2-8 are correct. The correct names are shown in the sql table on the server for MD districts 2-8 and there are not duplicate entries for Ruppersberger. I tried changing the spelling of Ruppersberger in the sql table on the server and it changed for each of the results for Ruppersberger (districts 2-8) in the web page table. Why am I getting the repetition shown above? Ken -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] antiword error for popen
I have an error showing;I can't find the name of your HOME directory when I upload word doc and retrieve text by antiword. I do not know why I will get kind like error! code--- $handle = popen(/usr/bin/antiword \$original_tmp\ -t 21, 'r'); $strbuf = fread($handle, 2048000); echo $strbuf; //I can't find the name of your HOME directory $strbuf = addslashes($strbuf); pclose($handle); ---yui -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php