[PHP-DB] Re: [PHP] Query - Grouping Results
Doesn't seem to work, how would I print that out with PHP? On Monday 19 March 2001 13:52, you wrote: how about something like select distinct name, date_format(time, "%W %D %M %Y") as login from users, user_logins where user_logins.user_id = users.id order by name,time -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 1:43 PM To: PHP Database Mailing List; PHP General Mailing List Subject: [PHP] Query - Grouping Results Hi, I've got a table like: iduser_id ip time 1 2 127.0.0.1 20010316105018 Etc, etc. I do a join on the this table and the users table to get the coresponding username to user_id like this: SELECT users.name AS name, user_logins.ip AS ip, UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE user_logins.user_id = users.id ORDER BY time ASC How can I display the results grouped by username? So, I want to be able to display: Logins for John Thursday 10th Friday 12th Monday 23rd Logins for Bob Monday 1st Tuesday 2nd Saturday 31st Thanks for any help, Jord -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] PHP, ADO/ODBC and MS Access 97 Queries
Can anyone give me any pointers on how I can execute queries in MS Access97 from PHP and get the results back using either ADO or ODBC? Thanks in advance Darren -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] PHP mysql_connect Access Denied
Hi Newbie here I am running Apache/PHP/MySQL locally which emulates my server environment online. I want to use it as a test environment. I am running through Julie Meloni's 'PHP Fast Easy...' and have run up against a problem. Using the mysql_connect statement in a php page: ? $connection=mysql_connect("localhost", "threezero", "qwerty00") or die ("could not connect"); if ($connection) { $msg = "success"; } ? html head titleMySQL Connection/title /head body bgcolor="#FF" text="#00" ? echo "$msg"; ? /body /html I get the following error returned in any browser: Warning: MySQL Connection Failed: Can't connect to MySQL server on 'localhost' (10061) in c:\program files\apache group\apache\htdocs\threezero\phptests\dbstuff\db_connect.php on line 2 could not connect This is returned after enetering the following into the 'mysql' database using the MySQL monitor: insert into user (host, user, password) values ('localhost', 'threezero', password('qwerty00'); Querying the table returns the inserted values in the table (the password column being encrypted). I am thinking that there are some potential configuration problems as the php page works in my online server environment (pair networks) Has anyone got an idea where I am going wrong and/or can point me in the right direction? Any help appreciated. TIA Matt Coyne t h r e e z e r o : : : the mill, millstone lane, leicester, le1 5jn e : [EMAIL PROTECTED] :: m : 07747 845690 w : http://www.threezero.co.uk : : :t h r e e z e r o -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP mysql_connect Access Denied
I get the following error returned in any browser: Warning: MySQL Connection Failed: Can't connect to MySQL server on 'localhost' (10061) in c:\program files\apache group\apache\htdocs\threezero\phptests\dbstuff\db_connect.php on line 2 could not connect could be that mysqld isn't running... ++ | Julie Meloni ([EMAIL PROTECTED]) | || | "PHP Essentials" and "PHP Fast Easy" | | http://www.thickbook.com | ++ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] cflocation in PHP
Is there a way to jump out of one script and into another like with cflocation() in CF. Does php have a similar function? Miles Scruggs -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] php/linux/mssql
-Original Message- From: Miles Scruggs [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 11:17 AM To: PHP Mailing Subject: FW: [PHP-DB] php/linux/mssql Well from what I can tell php treats sybase and mssql the same. Am I wrong on this, or how do I fix this? That's correct... I have setp php/linux/mssql and everything works except the MS SQL connection. I don't get any errors returned to me, but it doesn't connect. As far as I can tell it doesn't even try, but I can't tell at what point it is breaking. I have used the freetds 0.51 libs to make this connection since I can't get the sybase libs. Here is what I have installed php-4.0.4pl1 apache_1.3.14 freetds-0.51 mysql-3.22.32 (connection to mysql works fine) On a remote site I have MS SQL server 2000 installed [ snip ] So I don't get an error until I try to select a db. I run tcpdump at the same time just to make sure that it wasn't trying to connect to the remote server and there was no attempt to even make a connection. Have you tried running a 'make check' in your FreeTDS directory to run the library's self-tests? I know I had to tweak a couple of things before I got PHP to work with a MS SQL server, and most of them came in the stages of getting FreeTDS working correctly before I even tried to build it into PHP. Is your SYBASE environment variable set correctly? Have you double-checked the sybase-related settings in your php.ini? Are you using the --enable-dbmfix flag for configure when building FreeTDS? (If so, have you made the appropriate changes in PHP's code or applied the patches from the FreeTDS website?) --- Mark Roedel ([EMAIL PROTECTED]) || "There cannot be a crisis next week. Systems Programmer / WebMaster || My schedule is already full." LeTourneau University ||-- Henry Kissinger -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] php/linux/mssql
So I don't get an error until I try to select a db. I run tcpdump at the same time just to make sure that it wasn't trying to connect to the remote server and there was no attempt to even make a connection. Have you tried running a 'make check' in your FreeTDS directory to run the library's self-tests? I know I had to tweak a couple of things before I got PHP to work with a MS SQL server, and most of them came in the stages of getting FreeTDS working correctly before I even tried to build it into PHP. Ok you are right make check failed here is a dump of the failure creating t0006 make check-TESTS make[7]: Entering directory `/usr/local/src/freetds-0.51/src/tds/unittests' t0001.c: Testing login, logout connect: Network is unreachable tds_connect() failed try_tds_login() failed FAIL: t0001 t0002.c: Test basic submit query, results connect: Network is unreachable tds_connect() failed try_tds_login() failed FAIL: t0002 t0003.c: Testing DB change -- 'use tempdb' connect: Network is unreachable tds_connect() failed try_tds_login() failed FAIL: t0003 t0004.c: Test large (512 bytes) queries connect: Network is unreachable tds_connect() failed try_tds_login() failed FAIL: t0004 t0005.c: Test large (512 bytes) replies connect: Network is unreachable tds_connect() failed try_tds_login() failed FAIL: t0005 t0006.c: Test SYBREAL, SYBFLT8 values connect: Network is unreachable tds_connect() failed try_tds_login() failed FAIL: t0006 === 6 of 6 tests failed === I'm not to sure why I would get "Network is unreachable" I can reach the outside network just fine. Where do I find out where it is trying to connect and how? Is your SYBASE environment variable set correctly? Have you double-checked the sybase-related settings in your php.ini? Are you using the --enable-dbmfix flag for configure when building FreeTDS? (If so, have you made the appropriate changes in PHP's code or applied the patches from the FreeTDS website?) I did compile FreeTDS with --enable-dbmfix flag, but I can't find any information on this patch that you are talking about. Should I just not use this flag? Miles Scruggs -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP mysql_connect Access Denied
http://mysql.com/documentation/mysql/bychapter/manual_Privilege_system.html# Adding_users Check out the docs here. You need to add users this way: shell mysql --user=root mysql mysql GRANT ALL PRIVILEGES ON *.* TO monty@localhost IDENTIFIED BY 'some_pass' WITH GRANT OPTION; mysql GRANT ALL PRIVILEGES ON *.* TO monty@"%" IDENTIFIED BY 'some_pass' WITH GRANT OPTION; mysql GRANT RELOAD,PROCESS ON *.* TO admin@localhost; mysql GRANT USAGE ON *.* TO dummy@localhost; olinux - Original Message - From: "Matt Coyne" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, March 19, 2001 8:16 AM Subject: [PHP-DB] PHP mysql_connect Access Denied Hi Newbie here I am running Apache/PHP/MySQL locally which emulates my server environment online. I want to use it as a test environment. I am running through Julie Meloni's 'PHP Fast Easy...' and have run up against a problem. Using the mysql_connect statement in a php page: ? $connection=mysql_connect("localhost", "threezero", "qwerty00") or die ("could not connect"); if ($connection) { $msg = "success"; } ? html head titleMySQL Connection/title /head body bgcolor="#FF" text="#00" ? echo "$msg"; ? /body /html I get the following error returned in any browser: Warning: MySQL Connection Failed: Can't connect to MySQL server on 'localhost' (10061) in c:\program files\apache group\apache\htdocs\threezero\phptests\dbstuff\db_connect.php on line 2 could not connect This is returned after enetering the following into the 'mysql' database using the MySQL monitor: insert into user (host, user, password) values ('localhost', 'threezero', password('qwerty00'); Querying the table returns the inserted values in the table (the password column being encrypted). I am thinking that there are some potential configuration problems as the php page works in my online server environment (pair networks) Has anyone got an idea where I am going wrong and/or can point me in the right direction? Any help appreciated. TIA Matt Coyne t h r e e z e r o : : : the mill, millstone lane, leicester, le1 5jn e : [EMAIL PROTECTED] :: m : 07747 845690 w : http://www.threezero.co.uk : : :t h r e e z e r o -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Line breaks in output
Newbie here. How do I get line breaks in output from a database? I have a list of things in a file, like: item1``item2``item3 (etc) I want them displyed in a textarea as: item1 item2 item3 Probably very simple, haven't got that far in my book yet. Martin S. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Free MySQL Database Hosting (beta! beta! beta!)
Hi, I'm testing out the concept of offering free MySQL database hosting. Feel free to create a database at http://superid.dyndns.org:8080/freesql/index.php There's no catch, or hidden agenda. I thought it might be fun to try and offer this as a service to people who might be learning MySQL (and hopefully eventually PostgreSQL too) but arent interested in administering a db server. Regards, SuperID -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How do I test on number of fields ?
check where you are getting "$mysql_link" that is the problem I usually associate with the error you report. if $mysql_link is undefined, MySQL can't perform the query. Terry On Tuesday, March 20, 2001, at 12:06 AM, Toke Herkild wrote: $mysql_result = mysql_query($query, $mysql_link); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Problem with Interbase/Character Set
Hello, I use IB 6.01 with PHP 4.04 on Linux or/and Win When I try to to change the character set of a connection I get an error message: php-code: ... ibase_connect($Hostname,$Username,$Password,'DOS850'); ... error-message: "Warning: InterBase: arithmetic exception, numeric overflow, or string truncation Cannot transliterate character between character sets" What's the problem? It doesn't work on Windows, the same on Linux. It's the same with other charactersets (ASCII, WIN1252...). many thanks for an answer Joe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to display HTML code?
Well you don't need PHP to do it, but you can replace the greater than and less than signs with their html entities(lt; and gt;) which the browser will parse, and it will display the appropriate chars. So... ?php print "lt;font size=+2gt"; ? will print the html without parsing it. Now if only the newsreader doesn't parse this as html. -- phill ""Osman Omar"" [EMAIL PROTECTED] wrote in message 00f901c0b0cf$c99e7da0$da604a2b@sony">news:00f901c0b0cf$c99e7da0$da604a2b@sony... Hi, Suppose I want to display HTML code eg "A HREF=home.phpHome/A" How can I do that in php? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to display HTML code?
try: ?php echo htmlentities("A HREF=home.phpHome/A"); ? ""Osman Omar"" [EMAIL PROTECTED] wrote in message 00f901c0b0cf$c99e7da0$da604a2b@sony">news:00f901c0b0cf$c99e7da0$da604a2b@sony... Hi, Suppose I want to display HTML code eg "A HREF=home.phpHome/A" How can I do that in php? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Line breaks in output
Better yet, use "br" for browsers. Or use Jeff's method but use nl2br function to convert new line to br echo nl2br($result); ""JJeffman"" [EMAIL PROTECTED] wrote in message 007f01c0b0d8$212e97a0$5bd4d7c8@jjeffman">news:007f01c0b0d8$212e97a0$5bd4d7c8@jjeffman... Create a variable to concatenate the item values adding a "\n" character between them : $result = $item1."\n".$item2."\n".$item3 ; . echo("input name=text value=".$result . ""); HTH Jayme. -Mensagem Original- De: Martin Skjöldebrand [EMAIL PROTECTED] Para: [EMAIL PROTECTED] Enviada em: segunda-feira, 19 de março de 2001 17:47 Assunto: [PHP-DB] Line breaks in output Newbie here. How do I get line breaks in output from a database? I have a list of things in a file, like: item1``item2``item3 (etc) I want them displyed in a textarea as: item1 item2 item3 Probably very simple, haven't got that far in my book yet. Martin S. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
FW: [PHP-WIN] mime in php
somebody please help!!! I've posted a number of messages about this with no reply. Here are the findings from my research: on windows 2000 under iis 5.0 this is breaking: mail($to, '', '', substr($coverletter, 0, 3990)); while this works: mail($to, $subject, '', substr($coverletter, 0, 3989)); where $coverletter is a message header. I intend this message header to be a mime multipart message. but, for testing purposes, i've tried just any old string in the header. It seems that the mail() function breaks if the length of the header parameter passed to it is too long !!! can someone try this on apache or a unix environment to see if the above line that breaks for me also breaks for you. BEWARE:::if $coverletter contains email addresses those persons might also get the mail. MAKE SURE $coverletter HAS NO EMAIL ADDRESSES! -f -free -Original Message- From: Free Beachler [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 6:01 PM To: Php-Windows Subject: [PHP-WIN] mime in php Has anyone done mime multipart in nt 4+ using iis 4+ (preferrably iis 5)? I can't figure out if my mail() send is breaking because of message length or mime format or what. I think my mail conforms to specification. -free [EMAIL PROTECTED] -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] mail() headers
I believe mail works completely different on unix. It probably doesn't suffer the same problems, because it's a direct call to an external process. Lookup "sendmail" ""Free Beachler"" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Someone else has tested this on Apache on windows 2000. it broke under the described conditions, i.e., 4th parameter of mail() function exceeds approx. 4K. Remember, the 4th paramter is the "add'l headers" parameter and is essential for mime multipart messages. (ok, actually I think that if (the header + message stuff generated by mail()) 4K --then break!!!) can someone try my scenario on unix? furthermore, is there something in the RFCs that limits message headers to 4K??? Seems like there shouldn't be... -fre -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] problems configuring php and postgres - call to undefined function
I am trying to get postgresql (pg) support for php working on my RH7 box. I had a working binary installation of postgres 7.03. I thought I had read that php4 had default support for pg, but my call to pg_connect() gave me a "Call to undefined function" error. So, next I tried to re ./configure and add --with-pgsql=/usr/local/pgsql. That would not compile, bombing when it looked for "postgres.h". I did not have the pg source (since this was a binary installation) so I installed that next (in /usr/src, if that matters) I deleted my existing binary installation of pg, and ran ./configure; gmake; gmake install with no errors, and I added an entry in /etc/ld.so.conf as stated in the pg INSTALL. Pg is running fine with several db and I can remotely connect, so I think thats ok. After finishing with the source installation of pg, I re- ./configure php, make and get the same error looking for "postgres.h" kludge I then manually edited the ./configure file and added the include path to /usr/src/postgres/install/kludge After this, I could successfully make php, then make install. I restarted apache, but I am still getting "Call to undefined function". Any thoughts? I'm pretty much out of ideas right now. Regards, Gary Huntress -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] problems configuring php and postgres - call toundefined function
What kind of binary install did you do? An rpm? If so, simply also install the rpm-devel package and it will compile nicely. -Rasmus On Tue, 20 Mar 2001, Gary Huntress wrote: I am trying to get postgresql (pg) support for php working on my RH7 box. I had a working binary installation of postgres 7.03. I thought I had read that php4 had default support for pg, but my call to pg_connect() gave me a "Call to undefined function" error. So, next I tried to re ./configure and add --with-pgsql=/usr/local/pgsql. That would not compile, bombing when it looked for "postgres.h". I did not have the pg source (since this was a binary installation) so I installed that next (in /usr/src, if that matters) I deleted my existing binary installation of pg, and ran ./configure; gmake; gmake install with no errors, and I added an entry in /etc/ld.so.conf as stated in the pg INSTALL. Pg is running fine with several db and I can remotely connect, so I think thats ok. After finishing with the source installation of pg, I re- ./configure php, make and get the same error looking for "postgres.h" kludge I then manually edited the ./configure file and added the include path to /usr/src/postgres/install/kludge After this, I could successfully make php, then make install. I restarted apache, but I am still getting "Call to undefined function". Any thoughts? I'm pretty much out of ideas right now. Regards, Gary Huntress -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] RE: [PHP] Query - Grouping Results
The php below illustrates how to print database results from mySQL in PHP. Apologies for the long post. You should be able to extrapolate from here - ie this is generic, you will want to keep track of the usernames and only print them when they change. Dont forget to print the last one if you do this. (Jackson Structured Programming fans - all together now...) Regards Jeff --- ?php # Set these up with the right values $host = 'localhost'; $user = 'me'; $password = 'mine'; $database = 'thedb'; $sql = 'select * from sometable'; # Connect to the database $dbh = mysql_pconnect($host,$user,$password); if (!$dbh) { echo "Unable to connect to database"; exit; } # Run the query on the db $sth = mysql_db_query($database,$sql,$dbh); if (!$sth) { echo "DB Error:($database) $sqlBR\n", mysql_error($dbh); exit; } # Check how may items came back $rows = mysql_num_rows( $sth ); if ( !$rows ) { echo "DB No rows returnedBR($database) $sqlBR\n"; exit; } echo "TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0\n", " TRTDDatabasenbsp;/TDTD$database/TD/TR\n", " TRTDStatementnbsp;/TDTD$sql/TD/TR\n", " TRTDRecordsnbsp;/TDTD$rows/TD/TR\n", "TABLE\n\n"; # print the results in an HTML table echo "TABLE BORDER=1 CELLPADDING=1 CELLSPACING=0\n"; $row_count=0; while ( $rec = mysql_fetch_array( $sth, MYSQL_ASSOC ) ) { # Print a header row, first time only if(!$row_count) { echo "TR\n"; foreach ($rec as $column = $value) { echo " TH$columnnbsp;/TH\n"; } echo "/TR\n"; } # print the results echo "TR\n"; foreach ($rec as $column = $value) { echo " TD$valuenbsp;/TD\n"; } echo "/TR\n"; $row_count++; } echo "/TABLE\n\n"; ? -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 3:03 PM To: Jeff Armstrong Cc: PHP Database Mailing List; PHP General Mailing List Subject: Re: [PHP] Query - Grouping Results Sorry, the query works fine, but how do I print it out to the browser so that it looks like: John Dates go here Bob Dates go here Gill Dates go here I hope that's clear, Thanks, Jord On Monday 19 March 2001 14:44, you wrote: works fine for me. what error do you get. -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 2:39 PM To: Jeff Armstrong Cc: PHP Database Mailing List; PHP General Mailing List Subject: Re: [PHP] Query - Grouping Results Doesn't seem to work, how would I print that out with PHP? On Monday 19 March 2001 13:52, you wrote: how about something like select distinct name, date_format(time, "%W %D %M %Y") as login from users, user_logins where user_logins.user_id = users.id order by name,time -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 1:43 PM To: PHP Database Mailing List; PHP General Mailing List Subject: [PHP] Query - Grouping Results Hi, I've got a table like: id user_id ip time 1 2 127.0.0.1 20010316105018 Etc, etc. I do a join on the this table and the users table to get the coresponding username to user_id like this: SELECT users.name AS name, user_logins.ip AS ip, UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE user_logins.user_id = users.id ORDER BY time ASC How can I display the results grouped by username? So, I want to be able to display: Logins for John Thursday 10th Friday 12th Monday 23rd Logins for Bob Monday 1st Tuesday 2nd Saturday 31st Thanks for any help, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Query - Grouping Results
Sorry, the query works fine, but how do I print it out to the browser so that it looks like: John Dates go here Bob Dates go here Gill Dates go here I hope that's clear, Thanks, Jord On Monday 19 March 2001 14:44, you wrote: works fine for me. what error do you get. -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 2:39 PM To: Jeff Armstrong Cc: PHP Database Mailing List; PHP General Mailing List Subject: Re: [PHP] Query - Grouping Results Doesn't seem to work, how would I print that out with PHP? On Monday 19 March 2001 13:52, you wrote: how about something like select distinct name, date_format(time, "%W %D %M %Y") as login from users, user_logins where user_logins.user_id = users.id order by name,time -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 1:43 PM To: PHP Database Mailing List; PHP General Mailing List Subject: [PHP] Query - Grouping Results Hi, I've got a table like: id user_id ip time 1 2 127.0.0.1 20010316105018 Etc, etc. I do a join on the this table and the users table to get the coresponding username to user_id like this: SELECT users.name AS name, user_logins.ip AS ip, UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE user_logins.user_id = users.id ORDER BY time ASC How can I display the results grouped by username? So, I want to be able to display: Logins for John Thursday 10th Friday 12th Monday 23rd Logins for Bob Monday 1st Tuesday 2nd Saturday 31st Thanks for any help, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Can PHP for Oracle randomly access rows in a result set?
On Mon, Mar 19, 2001 at 01:19:44PM +1030, Andrew Halliday wrote: Can PHP for Oracle randomly access rows in a result set? I have read documentation for both Oracle functions (ora_*) and Oracle 8 functions (OCI_*) but cant seem to find a way to randomly access rows in a result set like you can with PostgreSQL or MySQL ... whats the story here?! Are we FORCED to access the result set sequentially with an Oracle database? Is that a restriction of the DB or PHP? that's an oracle restriction. tc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Query - Grouping Results
Hi, I've got a table like: id user_id ip time 1 2 127.0.0.1 20010316105018 Etc, etc. I do a join on the this table and the users table to get the coresponding username to user_id like this: SELECT users.name AS name, user_logins.ip AS ip, UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE user_logins.user_id = users.id ORDER BY time ASC How can I display the results grouped by username? So, I want to be able to display: Logins for John Thursday 10th Friday 12th Monday 23rd Logins for Bob Monday 1st Tuesday 2nd Saturday 31st Thanks for any help, Jord -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] RE: [PHP] Query - Grouping Results
how about something like select distinct name, date_format(time, "%W %D %M %Y") as login from users, user_logins where user_logins.user_id = users.id order by name,time -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Monday, March 19, 2001 1:43 PM To: PHP Database Mailing List; PHP General Mailing List Subject: [PHP] Query - Grouping Results Hi, I've got a table like: id user_id ip time 1 2 127.0.0.1 20010316105018 Etc, etc. I do a join on the this table and the users table to get the coresponding username to user_id like this: SELECT users.name AS name, user_logins.ip AS ip, UNIX_TIMESTAMP(user_logins.time) AS time FROM users, user_logins WHERE user_logins.user_id = users.id ORDER BY time ASC How can I display the results grouped by username? So, I want to be able to display: Logins for John Thursday 10th Friday 12th Monday 23rd Logins for Bob Monday 1st Tuesday 2nd Saturday 31st Thanks for any help, Jord -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Re: [PHP] Query - Grouping Results
Doesn't seem to work, how would I print that out with PHP? The results will come back sorted by name, then time. While processing each row, you'll need to keep track of when the username changes, something like this (this is just rough code, not quite valid PHP): $username = ''; while ($data = fetchrow) { if ($username != $data['name']) { $username = $data['name']; print "Logins for " . $username . "\n\n"; } print $login . "\n"; } Keep track of the current user. As you examine each record, check if it's different than the current one. If it is, save it as the current username, and print the login info. If it's the same, just print the login info. - Darryl -- Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED] Education Research Technology Services, http://gollum.usask.ca/ Department of Computing Services, University of Saskatchewan -- "Go not to the Elves for counsel, for they will say both no and yes" -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] RE: [PHP] Can PHP for Oracle randomly access rows in a result set?
The OCIFetchStatement() function returns a resultset to PHP that is actually a multi-dimensional array. You can randomly access this array however you like. -Original Message- From: Thies C. Arntzen [mailto:[EMAIL PROTECTED]] Sent: 19 March 2001 10:43 To: Andrew Halliday Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Can PHP for Oracle randomly access rows in a result set? On Mon, Mar 19, 2001 at 01:19:44PM +1030, Andrew Halliday wrote: Can PHP for Oracle randomly access rows in a result set? I have read documentation for both Oracle functions (ora_*) and Oracle 8 functions (OCI_*) but cant seem to find a way to randomly access rows in a result set like you can with PostgreSQL or MySQL ... whats the story here?! Are we FORCED to access the result set sequentially with an Oracle database? Is that a restriction of the DB or PHP? that's an oracle restriction. tc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]