Re: [PHP-DB] newbie question
On Fri, 13 Feb 2004, t wrote: > hi, > > i am relatively new to php and new to this email list. > > i have what i think are fairly simple questions about using mysql and > php. i have done some research and can't seem to find the answer i > need. > > # 1. i want to set the date format to display dates in a format other > than the standard mysql -mm-dd format. i have tried using the mysql > DATE_FORMAT but i can's seem to get it to work... > > ideally i'd like to display dates as 2 digit date followed by three > letter month abbreviation and leave the year off completely... > > example: 13 feb Use date() Documentation: http://php.net/date > # 2. i want to hide entries that are newer than the current date AND > hide entries older than 365 days. Limit your SQL to ... where date>now() and dateunix_timestamp() and date<(unix_timestamp()-(365*86400)) ... Documentation: http://mysql.com/date_sub (should redirect to http://www.mysql.com/doc/en/Date_and_time_functions.html) --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] newbie question
hi, i am relatively new to php and new to this email list. i have what i think are fairly simple questions about using mysql and php. i have done some research and can't seem to find the answer i need. # 1. i want to set the date format to display dates in a format other than the standard mysql -mm-dd format. i have tried using the mysql DATE_FORMAT but i can's seem to get it to work... ideally i'd like to display dates as 2 digit date followed by three letter month abbreviation and leave the year off completely... example: 13 feb # 2. i want to hide entries that are newer than the current date AND hide entries older than 365 days. i apologize if this is the wrong place to ask these questions. if someone could point me in the right direction i would appreciate it. here is the url and code (minus the login info) http://www.broadcastatic.com $db = mysql_connect("localhost", "[loginnamehere]", "[passwdhere]"); mysql_select_db("[databasenamehere]",$db); // display individual record if ($date) { $result = mysql_query("SELECT * FROM [tablenamehere] WHERE date= '$date' ",$db); $myrow = mysql_fetch_array($result); // do not use now printf("\n", $myrow["date"]); printf("hosted by %s\n", $myrow["dj"]); printf("broadcast on %s\n", $myrow["date"]); printf("%s\n", $myrow["location"]); printf("--> %s\n", $myrow["entry"]); printf("mp3 link\n", $myrow["date"]); include("archive/index/$date.php"); } else { // display list of shows by date $result = mysql_query("SELECT * FROM [tablenamehere] WHERE 1 ORDER BY 'date' DESC",$db); if ($myrow = mysql_fetch_array($result)) { // display list if there are records to display do { printf("%s %s%s\n", $PHP_SELF, $myrow["date"], $myrow["date"], $myrow["date"], $myrow["dj"], $myrow["entry"]); } while ($myrow = mysql_fetch_array($result)); } else { // no records to display echo "Sorry, no records were found!"; } } ?> THANKS! tommy birchett http://www.broadcastatic.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Paging large recordsets
On Fri, 13 Feb 2004, Robert Twitty wrote: > If you are not opearating in a stateless environment, then you could use a > cursor. The web is a stateless environment, and therefore the record set > needs to be cached either to disk or memeory. The other alternative is to > rerun the query for each page request. Using disk space to store query > results for the purpose of paging over the web is commonly done by search > engines, and even some database engines use disk space for cursor > implementation. I agree that using session variables for this purpose is > not ideal, but what's the alternative in PHP? Storing only the > identifiers instead of all the data significantly lessons the impact. > > I agree, it should be avoided if possible. If you are running it out of a DB, limiting the results to result 1-10 or 91-100 is pretty fast; caching results seems like more of a headache to me, and depending on how loaded your DB is, not worth the effort. If the query takes 3-5 seconds, then either your DB is configured wrong (no indexes), or your SQL is not written well, or you should consider some sort of DB query caching. Look to the manual for that. --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Paging large recordsets
One way that I have found - but never used is... http://sqlrelay.sourceforge.net/ It can cache result sets in a file for later use. You can then use It does a whole bunch of other stuff too. I really need to install this and start working with it. - Paul -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 1:59 PM To: Paul Miller Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Paging large recordsets If you are not opearating in a stateless environment, then you could use a cursor. The web is a stateless environment, and therefore the record set needs to be cached either to disk or memeory. The other alternative is to rerun the query for each page request. Using disk space to store query results for the purpose of paging over the web is commonly done by search engines, and even some database engines use disk space for cursor implementation. I agree that using session variables for this purpose is not ideal, but what's the alternative in PHP? Storing only the identifiers instead of all the data significantly lessons the impact. I agree, it should be avoided if possible. -- bob On Fri, 13 Feb 2004, Paul Miller wrote: > In no way I am trying start some long thread here. But I have always > heard it was bad to store that much data in a session array? I could > just be really off here and not understanding what I have read. I > know PHP stores the sessions as text files. The only reason I can > come up with why one should not store large amounts of data would be > disk write/read speed per user. > > Can someone clarify this for me? > > - Paul > > -Original Message- > From: Robert Twitty [mailto:[EMAIL PROTECTED] > Sent: Friday, February 13, 2004 12:34 PM > To: Karen Resplendo > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Paging large recordsets > > > Most of the PHP solutions I have seeen require the use of session > variables. You could create an array containing only the unique > identifiers of all the records, and then store it into a session > variable. You would then use another session variable to retain the > page size, and then include the page numbers in the "Next", "Prev", > "First", "Last" and "Absolutr" page links. Printing is probably best > done with dynamically generated PDF instead of HTML. > > -- bob > > On Fri, 13 Feb 2004, Karen Resplendo wrote: > > > I guess the time has come that my boss wants "Next", "Previous", > > "First", "Last" paging for our data displays of large recordsets or > > datasets. > > > > Any good solutons out there already? I have pieces of a few > > examples. > > > > Also, how to deal with printing? I would assume that the ideal page > > size is not the ideal printed page size. oi vay! > > > > TIA > > > > > > - > > Do you Yahoo!? > > Yahoo! Finance: Get your refund fast by filing online > > -- > 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] Paging large recordsets
If you are not opearating in a stateless environment, then you could use a cursor. The web is a stateless environment, and therefore the record set needs to be cached either to disk or memeory. The other alternative is to rerun the query for each page request. Using disk space to store query results for the purpose of paging over the web is commonly done by search engines, and even some database engines use disk space for cursor implementation. I agree that using session variables for this purpose is not ideal, but what's the alternative in PHP? Storing only the identifiers instead of all the data significantly lessons the impact. I agree, it should be avoided if possible. -- bob On Fri, 13 Feb 2004, Paul Miller wrote: > In no way I am trying start some long thread here. But I have always > heard it was bad to store that much data in a session array? I could > just be really off here and not understanding what I have read. I know > PHP stores the sessions as text files. The only reason I can come up > with why one should not store large amounts of data would be disk > write/read speed per user. > > Can someone clarify this for me? > > - Paul > > -Original Message- > From: Robert Twitty [mailto:[EMAIL PROTECTED] > Sent: Friday, February 13, 2004 12:34 PM > To: Karen Resplendo > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Paging large recordsets > > > Most of the PHP solutions I have seeen require the use of session > variables. You could create an array containing only the unique > identifiers of all the records, and then store it into a session > variable. You would then use another session variable to retain the page > size, and then include the page numbers in the "Next", "Prev", "First", > "Last" and "Absolutr" page links. Printing is probably best done with > dynamically generated PDF instead of HTML. > > -- bob > > On Fri, 13 Feb 2004, Karen Resplendo wrote: > > > I guess the time has come that my boss wants "Next", "Previous", > > "First", "Last" paging for our data displays of large recordsets or > > datasets. > > > > Any good solutons out there already? I have pieces of a few examples. > > > > Also, how to deal with printing? I would assume that the ideal page > > size is not the ideal printed page size. oi vay! > > > > TIA > > > > > > - > > Do you Yahoo!? > > Yahoo! Finance: Get your refund fast by filing online > > -- > 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] Paging large recordsets
On Fri, 13 Feb 2004, Paul Miller wrote: > I have always heard it was bad to store that much data in a session array? > > Can someone clarify this for me? IMO It is bad to store lots of data in session variables. The $_REQUEST var for the post/get should be enough. URL: search.php?page=10 code: $conf['maxresultsperpage'] = 10; $ref = mysql_query("select count(*) as c from table where subject like '%foo%'"); list($cnt) = mysql_fetch_array($ref); // will assoc work here? dunno, didn't test echo "Displaying ".($conf['maxresultsperpage']*$_REQUEST['page'])-9." through ".($conf['maxresultsperpage']*$_REQUEST['page'])."."; $ref = mysql_query("select subject, data from table where subject like '%foo%' limit ".$conf['maxresultsperpage'].", ".($conf['maxresultsperpage']*$_REQUEST['page'])-10); // loop through array returned from mysql echo "Next"; I think. It might need some tweaking, but you get the idea (I hope). No need to store variables here. Beckman > -Original Message- > From: Robert Twitty [mailto:[EMAIL PROTECTED] > Sent: Friday, February 13, 2004 12:34 PM > To: Karen Resplendo > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Paging large recordsets > > > Most of the PHP solutions I have seeen require the use of session > variables. You could create an array containing only the unique > identifiers of all the records, and then store it into a session > variable. You would then use another session variable to retain the page > size, and then include the page numbers in the "Next", "Prev", "First", > "Last" and "Absolutr" page links. Printing is probably best done with > dynamically generated PDF instead of HTML. > > -- bob > > On Fri, 13 Feb 2004, Karen Resplendo wrote: > > > I guess the time has come that my boss wants "Next", "Previous", > > "First", "Last" paging for our data displays of large recordsets or > > datasets. > > > > Any good solutons out there already? I have pieces of a few examples. > > > > Also, how to deal with printing? I would assume that the ideal page > > size is not the ideal printed page size. oi vay! > > > > TIA > > > > > > - > > Do you Yahoo!? > > Yahoo! Finance: Get your refund fast by filing online > > -- > 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 > --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Paging large recordsets
In no way I am trying start some long thread here. But I have always heard it was bad to store that much data in a session array? I could just be really off here and not understanding what I have read. I know PHP stores the sessions as text files. The only reason I can come up with why one should not store large amounts of data would be disk write/read speed per user. Can someone clarify this for me? - Paul -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 12:34 PM To: Karen Resplendo Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Paging large recordsets Most of the PHP solutions I have seeen require the use of session variables. You could create an array containing only the unique identifiers of all the records, and then store it into a session variable. You would then use another session variable to retain the page size, and then include the page numbers in the "Next", "Prev", "First", "Last" and "Absolutr" page links. Printing is probably best done with dynamically generated PDF instead of HTML. -- bob On Fri, 13 Feb 2004, Karen Resplendo wrote: > I guess the time has come that my boss wants "Next", "Previous", > "First", "Last" paging for our data displays of large recordsets or > datasets. > > Any good solutons out there already? I have pieces of a few examples. > > Also, how to deal with printing? I would assume that the ideal page > size is not the ideal printed page size. oi vay! > > TIA > > > - > Do you Yahoo!? > Yahoo! Finance: Get your refund fast by filing online -- 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] Paging large recordsets
I know phpclasses.org has a few recordset paging classes out there for your convenience. Might want to try on a couple of those too just to see if they fit. Rich > -Original Message- > From: Robert Twitty [mailto:[EMAIL PROTECTED] > Sent: Friday, February 13, 2004 1:34 PM > To: Karen Resplendo > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] Paging large recordsets > > > Most of the PHP solutions I have seeen require the use of session > variables. You could create an array containing only the unique > identifiers of all the records, and then store it into a > session variable. > You would then use another session variable to retain the > page size, and > then include the page numbers in the "Next", "Prev", "First", > "Last" and > "Absolutr" page links. Printing is probably best done with > dynamically > generated PDF instead of HTML. > > -- bob > > On Fri, 13 Feb 2004, Karen Resplendo wrote: > > > I guess the time has come that my boss wants "Next", > "Previous", "First", "Last" paging for our data displays of > large recordsets or datasets. > > > > Any good solutons out there already? I have pieces of a few > examples. > > > > Also, how to deal with printing? I would assume that the > ideal page size is not the ideal printed page size. oi vay! > > > > TIA > > > > > > - > > Do you Yahoo!? > > Yahoo! Finance: Get your refund fast by filing online > > -- > 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] Paging large recordsets
Most of the PHP solutions I have seeen require the use of session variables. You could create an array containing only the unique identifiers of all the records, and then store it into a session variable. You would then use another session variable to retain the page size, and then include the page numbers in the "Next", "Prev", "First", "Last" and "Absolutr" page links. Printing is probably best done with dynamically generated PDF instead of HTML. -- bob On Fri, 13 Feb 2004, Karen Resplendo wrote: > I guess the time has come that my boss wants "Next", "Previous", "First", "Last" > paging for our data displays of large recordsets or datasets. > > Any good solutons out there already? I have pieces of a few examples. > > Also, how to deal with printing? I would assume that the ideal page size is not the > ideal printed page size. oi vay! > > TIA > > > - > Do you Yahoo!? > Yahoo! Finance: Get your refund fast by filing online -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Paging large recordsets
On Fri, 13 Feb 2004, Karen Resplendo wrote: > I guess the time has come that my boss wants "Next", "Previous", "First", > "Last" paging for our data displays of large recordsets or datasets. First, do a query to find out how many rows. select count(*) from table where (your where clauses for the query); That's your # of records. Then do: select count(*) from table where (your clauses) limit ($pagenum*$itemlimit)-$itemlimit), $itemlimit; so if your $itemlimit = 10 items per page, and you are on page 3, it would be ... limit 20, 10 page #1, limit 0,10 etc > Also, how to deal with printing? I would assume that the ideal page size > is not the ideal printed page size. oi vay! In IE 6, this works: Even if your text follows, IE will print a page break. Haven't researched how to do it in Mozilla or Netscape. Beckman --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Paging large recordsets
I guess the time has come that my boss wants "Next", "Previous", "First", "Last" paging for our data displays of large recordsets or datasets. Any good solutons out there already? I have pieces of a few examples. Also, how to deal with printing? I would assume that the ideal page size is not the ideal printed page size. oi vay! TIA - Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online
Re: [PHP-DB] Japanese characters.
Use the odbtp extension. It provides the best, easiest and maybe only support for SQL Server's UNICODE data fields within PHP. -- bob On Fri, 13 Feb 2004, Juan Torres wrote: > How can I read from a SQL Server DB, a field of type 'nvarchar'. This field > contais japanese characters. > > thanks! > > -- > 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] ODBTP 1.1 Released for MSSQL, Access, FoxPro & ODBC
Hi Alain It is very safe. The ODBTP service has been running on a production machine that is also running SQL Server 2000. It has been running without failure since 12/15/2003, and has served over 1.5 million connections. A single ODBTP server is being used to connect to several MSSQL 6.5, MSSQL 7.0, MSSQL 2000, FoxPro and Access databases. Your admin can go to http://www.ushmm.org/wlc/en and http://www.ushmm.org/namesearch/ to view example sites that are using ODBTP. Both sites are hosted on a Solaris server running Apache/PHP, and communicate with a Win 2000 server running ODBTP & SQL Server 2000. -- bob On Fri, 13 Feb 2004, Alain [iso-8859-15] Barthélemy wrote: > Le jeudi 12 février 2004, 10:04:12 ou environ Robert Twitty <[EMAIL PROTECTED]> a > écrit: > > Hi Alain > > > > > Documentation is just to manage and understand odbtp_set_attr(...) and so on > > > > Documentation for all of the odbtp functions is available in > source>/docs. You can alos view it online at > > http://odbtp.sourceforge.net/phpext-index.html > > > > -- bob > > > > Hi Bob, > > Thank you for the Url of the ODBTP documentation. Now I can work usefully. I > already transferred some FTP pages that were working without problems before > on a Linux host with FreeTDS and suddenly stopped working without reason. Now > it works! > > The only left problem is practical. I am working in a windows-addicted > environment (sorry! Just a way of speaking) and I have to use my dual-boot PC > to install ODBTP and my own old Toshiba PII labtop to install Apache/PHP/ODBTP > client. And I would like to recover the Linux partition of my DeskTop PC. It is > stupid to block a PC just to host ODBTP. > > One question: is it safe to install the ODBTP service on the MsSQL servor? It > sounds logical for me but I have to convince the Admin to do it. Then the ODBTP > and MsSQL servor addresses will be the same. > > Thanks, > > -- > Alain Barthélemy > [EMAIL PROTECTED] > http://bartydeux.be > Linux User #315631 > > -- > 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] ODBC with SQL Server
You cannot use the odbc & mssql extensions to read nvarchar & ntext fields. You will have to use the odbtp extension located at http://odbtp.sourceforge.net. It provides support for UNICODE data. -- bob On Fri, 13 Feb 2004, Juan Torres wrote: > Hello, > > I have a connectoin ODBC with a SQL Server database. A table has a field of > type 'nvarchar'. This field contains japanese characters. > How can I read these japanese characteres? When I read (with: "select name > from data") only read '?' character. > > Thaks very much. > Juan Torres. > > -- > 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: Subject: MySQL query question
I think you just have to 'alias' the result count, so that ORDER BY knows what to use to do the ordering - it needs a column name, but an alias is equivalent to a column name. So : $mostcomquery = SELECT artid, COUNT(*) AS hitcount FROM comments GROUP BY artid ORDER BY hitcount DESC Should work fine. HTH - Neil. At 10:31 13/02/2004 +, you wrote: Message-ID: <[EMAIL PROTECTED]> From: "js" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Date: Fri, 13 Feb 2004 02:40:08 -0600 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_NextPart_000_0009_01C3F1DA.B1D6BA30" Subject: MySQL query question i want to search the table called comments, and i want to count the number of times artid appears. then i want to group them all together, but then i want to order them by most appearances to fewest. so if artid 1 appeared 40 times and it was the most, i want that to be retrieved first. if artid 3 appeared 38 times and it was second most, i want that retrieved second... etc and so on. this code ive given is wrong, but i know that it has to be something like this or that im close. if any of you could help me id really appreciate it. if theres a shortcut with this code that would be great, otherwise i have to run my php around in a ton of different mysql queries trying to find out which has the most and have it ordered from highest to lowest. thank you for your help. ive tried mysql.com too and i cant find a thing there. plus the mailing lists for mysql, no one ever responds! thank you php list, you are my only hope. ;P -james $mostcomquery = "SELECT artid, COUNT(*) FROM comments GROUP BY artid ORDER BY (COUNT(*)) DESC LIMIT 5"; CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player. VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ODBTP 1.1 Released for MSSQL, Access, FoxPro & ODBC
Le jeudi 12 février 2004, 10:04:12 ou environ Robert Twitty <[EMAIL PROTECTED]> a écrit: > Hi Alain > > > Documentation is just to manage and understand odbtp_set_attr(...) and so on > > Documentation for all of the odbtp functions is available in source>/docs. You can alos view it online at > http://odbtp.sourceforge.net/phpext-index.html > > -- bob > Hi Bob, Thank you for the Url of the ODBTP documentation. Now I can work usefully. I already transferred some FTP pages that were working without problems before on a Linux host with FreeTDS and suddenly stopped working without reason. Now it works! The only left problem is practical. I am working in a windows-addicted environment (sorry! Just a way of speaking) and I have to use my dual-boot PC to install ODBTP and my own old Toshiba PII labtop to install Apache/PHP/ODBTP client. And I would like to recover the Linux partition of my DeskTop PC. It is stupid to block a PC just to host ODBTP. One question: is it safe to install the ODBTP service on the MsSQL servor? It sounds logical for me but I have to convince the Admin to do it. Then the ODBTP and MsSQL servor addresses will be the same. Thanks, -- Alain Barthélemy [EMAIL PROTECTED] http://bartydeux.be Linux User #315631 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Japanese characters.
How can I read from a SQL Server DB, a field of type 'nvarchar'. This field contais japanese characters. thanks! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Sql Server
Hello, I have a connectoin ODBC with a SQL Server database. A table has a field of type 'nvarchar'. This field contains japanese characters. How can I read these japanese characteres? When I read (with: "select name from data") only read '?' character. Thaks very much. Juan Torres. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ODBC with SQL Server
Hello, I'm working with a DB SQL Server. This DB has a table with Japanese characters. When I read a field (with Japanese characters) with function mssql_fetch_array(), always it return characters '?'. If I put 'print("(Japanese characters)");', these Japanese characters are shown correctly. My PHP file has follow code to work with Japanese characters: mb_internal_encoding("EUC-JP"); mb_http_output("EUC-JP"); mb_http_input("EUC-JP"); mb_language("Japanese"); My question: How can I show correctly the Japanese characters from a SQL Server DataBase? Thanks very much! Juan Torres. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ODBC with SQL Server
Hello, I have a connectoin ODBC with a SQL Server database. A table has a field of type 'nvarchar'. This field contains japanese characters. How can I read these japanese characteres? When I read (with: "select name from data") only read '?' character. Thaks very much. Juan Torres. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem with SQL Server.
Hello, I'm working with a DB SQL Server. This DB has a table with Japanese characters. When I read a field (with Japanese characters) with function mssql_fetch_array(), always it return characters '?'. If I put 'print("(Japanese characters)");', these Japanese characters are shown correctly. My PHP file has follow code to work with Japanese characters: mb_internal_encoding("EUC-JP"); mb_http_output("EUC-JP"); mb_http_input("EUC-JP"); mb_language("Japanese"); My question: How can I show correctly the Japanese characters from a SQL Server DataBase? Thanks very much! Juan Torres. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Optimize Table
sorry i have a great error in my last post, when i say: PhpmyAdmin or any other php script can be scheduled, i mean: PhpmyAdmin or any other php script _CAN_ _NOT_ be scheduled, it happends. - Original Message - From: "Ricardo Lopes" <[EMAIL PROTECTED]> To: "Ng Hwee Hwee" <[EMAIL PROTECTED]> Cc: "PHP DB" <[EMAIL PROTECTED]> Sent: Friday, February 13, 2004 10:30 AM Subject: Re: [PHP-DB] Optimize Table > For the overhead i can't tell you anything, probably you will have something > in the mysql manual. > > About the locking i supose that your users will be able to select from the > table, but wont be able to do updates, etc.. while the optimization ocurrs. > The database will probably put those instruction on hold till the > optimization ends, só you probably wont even have to care with that. > > But the optimization is an expensive operation (consume many resources), so > the best it to do it in a time when the operations on the database are > minimal or none. PhpmyAdmin or any other php script can be scheduled, they > only execute when a client request the page. But you can schedule a job in > you operative system to do that cron / at for *nix/linux, windows also have > schedule managers. > > Hope it helps. > Ricardo Lopes > > - Original Message - > From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> > To: "DBList" <[EMAIL PROTECTED]> > Sent: Friday, February 13, 2004 2:04 AM > Subject: [PHP-DB] Optimize Table > > > Hi all > > I read that it is neccessary and good to optimize my DB tables frequently.. > I am using phpMyAdmin-2.5.4 to maintain my database and the program showed > me that my overhead for some tables is over 5000. Can i know when would be > good for me to optimise my tables? For example, once I have an overhead of > 1000, I should optimise my tables? > > Another of my concern is that, when I optimise tables, I read that my tables > will be locked. Does it mean that my customers cannot do a select statement > on the table? In this case, can I schedule phpMyAdmin to optimise the table > at a certain time, say 3am when there is very little traffic?? > > Thank you so much! > > kind regards, > hwee > > -- > 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] Optimize Table
For the overhead i can't tell you anything, probably you will have something in the mysql manual. About the locking i supose that your users will be able to select from the table, but wont be able to do updates, etc.. while the optimization ocurrs. The database will probably put those instruction on hold till the optimization ends, só you probably wont even have to care with that. But the optimization is an expensive operation (consume many resources), so the best it to do it in a time when the operations on the database are minimal or none. PhpmyAdmin or any other php script can be scheduled, they only execute when a client request the page. But you can schedule a job in you operative system to do that cron / at for *nix/linux, windows also have schedule managers. Hope it helps. Ricardo Lopes - Original Message - From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> To: "DBList" <[EMAIL PROTECTED]> Sent: Friday, February 13, 2004 2:04 AM Subject: [PHP-DB] Optimize Table Hi all I read that it is neccessary and good to optimize my DB tables frequently.. I am using phpMyAdmin-2.5.4 to maintain my database and the program showed me that my overhead for some tables is over 5000. Can i know when would be good for me to optimise my tables? For example, once I have an overhead of 1000, I should optimise my tables? Another of my concern is that, when I optimise tables, I read that my tables will be locked. Does it mean that my customers cannot do a select statement on the table? In this case, can I schedule phpMyAdmin to optimise the table at a certain time, say 3am when there is very little traffic?? Thank you so much! kind regards, hwee -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL query question
i want to search the table called comments, and i want to count the number of times artid appears. then i want to group them all together, but then i want to order them by most appearances to fewest. so if artid 1 appeared 40 times and it was the most, i want that to be retrieved first. if artid 3 appeared 38 times and it was second most, i want that retrieved second... etc and so on. this code ive given is wrong, but i know that it has to be something like this or that im close. if any of you could help me id really appreciate it. if theres a shortcut with this code that would be great, otherwise i have to run my php around in a ton of different mysql queries trying to find out which has the most and have it ordered from highest to lowest. thank you for your help. ive tried mysql.com too and i cant find a thing there. plus the mailing lists for mysql, no one ever responds! thank you php list, you are my only hope. ;P -james $mostcomquery = "SELECT artid, COUNT(*) FROM comments GROUP BY artid ORDER BY (COUNT(*)) DESC LIMIT 5";