Re: [PHP-DB] SQL omit record if ever had value set
On Mon, Jun 18, 2012 at 6:26 PM, Matijn Woudt wrote: > On Mon, Jun 18, 2012 at 11:56 PM, Dee Ayy wrote: >> I would like a query that lists records where a column has not taken >> on a specific value when grouped by another column. >> >> N V >> n1 v1 >> n1 v2 >> n2 v1 >> n2 v2 >> n2 v3 >> n3 v1 >> >> If v3 has ever been set for N, do not list N. So the result would be n1, n3 >> >> If v2 has ever been set for N, do not list N. So the result would be only n3 >> >> MSSQL >> >> TIA >> > > I guess this should work in MSSQL too: > > SELECT N FROM table WHERE N NOT IN (SELECT N FROM table WHERE v = v3) > > - Matijn Thank you. So simple. I must have had Monday afternoon burnout. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SQL omit record if ever had value set
I would like a query that lists records where a column has not taken on a specific value when grouped by another column. N V n1 v1 n1 v2 n2 v1 n2 v2 n2 v3 n3 v1 If v3 has ever been set for N, do not list N. So the result would be n1, n3 If v2 has ever been set for N, do not list N. So the result would be only n3 MSSQL TIA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Settings to Allow Precise File Upload Bytes
My browser is claiming it is still busy from a 1MB (1030001 bytes) upload where I was trying to find out if it is setting $_FILES['attachment']. Thanks Maciek. It makes sense that I should be looking at $_FILES['attachment']['error'] before the size. I'm just surprised it's still hanging. I'm using jquery mobile which has extra file upload concerns (although there is no problem when the file is small enough). The MySQL part was included so that this post could help others if they missed a setting in their LAMP/AJAX stack, but I had narrowed my specific issue down to PHP $_FILES['attachment']. Thanks for all your help Jim. On Fri, Jan 20, 2012 at 2:38 PM, Maciek Sokolewicz wrote: > Answers are inside the mail > > On 20 January 2012 21:18, Dee Ayy wrote: >> >> Obviously I don't want a Flash/Gears solution. >> >> FYI: Your #6 should be: >> The server uploads... > > No, the server downloads, the client uploads. Downloading is performed by > the receiving end (in this case, the server), while uploading is done by the > serving end (in this case, the client). But that's a minor thing. > >> >> Even though I do not want a Flash/Gears solution, I would be happy >> with your #8 stating: >> I won't fail silently, I'll report the problem to the user. >> >> Do you know the correct settings on any applicable LAMP/AJAX stack to >> get the error you claim is available in your step #8 and where to look >> for this error? Is $_FILES['attachment'] supposed to be set and >> hopefully something is in $_FILES['attachment']['error']? >> I decided to post here instead of trying various permutations. > > >> >> >> MySQL max_allowed_packet was mentioned because even if you correct #8, >> MySQL can choke on what Apache allowed through, and I included the DB >> list. > > After rereading your post I noticed I had failed to read correctly. I'm > sorry. However, I still believe that the MySQL settings are not of any > interest here. The limitation should IMO be performed by PHP (or even > apache). By the time it gets to MySQL, all such checks should already have > been done. So let's ignore MySQL for now. > > As for PHP: > $_FILES['attachment']['error'] should be 0 if the file is uploaded > correctly. If it's > 0, then you should throw an error regardless of size. > So, assuming $_FILES['attachment']['error'] == 0, > $_FILES['attachment']['size'] will give you the exact filesize in bytes. > Check against this number, and you should be fine. > > However, if the upload size was higher than php.ini's upload_max_filesize, > $_FILES['attachment']['error'] will have the value 1 (constant: > UPLOAD_ERR_INI_SIZE), and will not be available to handle. > > So, in short, with code like: >> >> define('CUSTOM_MAX_UPLOAD_SIZE', (10*1024*1024) ); // 10MB >> if( isset($_FILES['attachment']) && $_FILES['attachment']['error'] <= 1 ) >> { >> if( ($_FILES['attachment']['error'] == 1) or >> ($_FILES['attachment']['error'] == 0 && $_FILES['attachment']['size'] > >> CUSTOM_MAX_UPLOAD_SIZE) ) { >> exit('ERROR: upload too big'); >> } else { >> // process the upload, store it, etc. >> } >> } else { >> // something went wrong while uploading >> } > > You should be fine. > Of course, you should also check that your max request body size is large > enough in Apache, though usually it allows requests far larger than PHP > does. > > Hope this helps, and sorry if I sounded rude at first, > - Tul > >> >> I never claimed I want to know the file size before upload, just that >> some solutions may do this. >> >> >> On Fri, Jan 20, 2012 at 11:50 AM, Maciek Sokolewicz >> wrote: >> > Your problem here is the fact that you do not seem to grasp what is >> > hapenning when a file is being uploaded, hence your question. So let me >> > explain: >> > 1. A user goes to your page by entering it into the browser. >> > 2. The page is downloaded to the client, and the connection is closed. >> > 3. The user chooses to upload a file via an HTML control (ie. an HTML >> > input >> > element of type="file". >> > 4. The user submits the form >> > 5. The browser makes a connection to the server containing a header >> > saying >> > "the follow
[PHP-DB] Re: Settings to Allow Precise File Upload Bytes
Obviously I don't want a Flash/Gears solution. FYI: Your #6 should be: The server uploads... Even though I do not want a Flash/Gears solution, I would be happy with your #8 stating: I won't fail silently, I'll report the problem to the user. Do you know the correct settings on any applicable LAMP/AJAX stack to get the error you claim is available in your step #8 and where to look for this error? Is $_FILES['attachment'] supposed to be set and hopefully something is in $_FILES['attachment']['error']? I decided to post here instead of trying various permutations. MySQL max_allowed_packet was mentioned because even if you correct #8, MySQL can choke on what Apache allowed through, and I included the DB list. I never claimed I want to know the file size before upload, just that some solutions may do this. On Fri, Jan 20, 2012 at 11:50 AM, Maciek Sokolewicz wrote: > Your problem here is the fact that you do not seem to grasp what is > hapenning when a file is being uploaded, hence your question. So let me > explain: > 1. A user goes to your page by entering it into the browser. > 2. The page is downloaded to the client, and the connection is closed. > 3. The user chooses to upload a file via an HTML control (ie. an HTML input > element of type="file". > 4. The user submits the form > 5. The browser makes a connection to the server containing a header saying > "the following data is a file". > 6. The server downloads all of the data from the user > 7. The server parses the data, finds the header stating that the content is > a file > 8. The server invokes your PHP script, which decides "whoa! wait a minute, > that file is too large" and shows an error. > 9. The server removes the file from memory / temporary storage > 10. The server sends back the error to the client, and closes the > connection. > > The point I am trying to make here is the fact that the server does not know > the size of the file, until it has fully downloaded it, since it is not > given in any way. Good browsers let the server know what size to *expect*, > but even then, you can't rely on it. > > All checking of how large a file is has to happen client-side. Due to > security reasons, languages such as javascript are not allowed to view any > details about files on your disk, and thus can't be used to determine the > filesize before sending anything to the server. > > The reason flash and gears can do this, is because these are designed > differently and actually form a separate program inside your browser, which > is not limited in its activity, as javascript (and vbscript in IE) are. > > So... you can use Flash and Gears to prevent upload of a too large file to > your server. But not plain HTML and/or javascript. Since the server does not > check the size until AFTER it has fully downloaded the file, there is no > setting in Apache, PHP, MySQL (which has absolutely nothing to do with > uploading at all), etc. Which are all server-side and ran after the upload > has finished. > > In other words: use the Flash/Gears solution, or just decide you don't mind > if a large file is uploaded. In the last case you can always reject the file > afterwards. > > - Tul > > > On 20-01-2012 18:15, Dee Ayy wrote: >> >> Please advise the proper settings (Apache/PHP/HTML/MySQL/Anything else >> I missed) to allow a specific byte size upload and to deny 1 byte over >> with error reporting in LAMP/AJAX. I've heard of Flash and Gears >> solutions, but these require additional installs for the user -- just >> to know the file size before an upload. >> >> The server is Apache 2. >> PHP is 5.1.6 >> HTML has >> >> >> >> >> PHP ini : >> file_uploads On On >> upload_max_filesize 2M 2M >> post_max_size 8M 8M >> >> I believe MySQL max_allowed_packet 1,048,576 was affecting the MySQL >> INSERT, so I changed MAX_FILE_SIZE to 103 above. >> >> Now I am seeing cases where >> if(isset($_FILES['attachment'])&& $_FILES['attachment']['size']> 0){ >> >> evaluates to FALSE >> >> How can I know that a file upload was attempted yet failed or will fail? >> >> My last test case had the web page still claiming it was busy, yet I >> noticed that the above condition must have evaluated to FALSE, failing >> silently due to missing error reporting on my part (or the system's >> part). >> >> I am willing to make 2 requests: >> 1) just to find out if the attempted upload will fail and inform the user. >> 2) for the actual upload if it should succeed. >> >> >> TIA > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Settings to Allow Precise File Upload Bytes
Please advise the proper settings (Apache/PHP/HTML/MySQL/Anything else I missed) to allow a specific byte size upload and to deny 1 byte over with error reporting in LAMP/AJAX. I've heard of Flash and Gears solutions, but these require additional installs for the user -- just to know the file size before an upload. The server is Apache 2. PHP is 5.1.6 HTML has PHP ini : file_uploadsOn On upload_max_filesize 2M 2M post_max_size 8M 8M I believe MySQL max_allowed_packet 1,048,576 was affecting the MySQL INSERT, so I changed MAX_FILE_SIZE to 103 above. Now I am seeing cases where if(isset($_FILES['attachment']) && $_FILES['attachment']['size'] > 0){ evaluates to FALSE How can I know that a file upload was attempted yet failed or will fail? My last test case had the web page still claiming it was busy, yet I noticed that the above condition must have evaluated to FALSE, failing silently due to missing error reporting on my part (or the system's part). I am willing to make 2 requests: 1) just to find out if the attempted upload will fail and inform the user. 2) for the actual upload if it should succeed. TIA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] One table, multiple queries?
It sounds like you are wanting to "transpose" rows and columns. But you used the terms convert and fields, so google may not be helping you. I found this: http://forums.mysql.com/read.php?86,23026,25752#msg-25752 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Aborting long running DB queries with browser "Stop" button
On Fri, Feb 6, 2009 at 5:10 AM, G wrote: > I've done extensive web searches, read all of the PHP manual pages beginning > with mysql_, wasted days on trial-and-error experimenting (signal handling > etc.), seen the "[PHP-DB] Long running db queries and the "STOP" button" > thread from the end of 2005, but my problem remains. > > Help! Please? If I understand you, using AJAX http://xajaxproject.org/ you could setup your own "STOP button" (rather than somehow hooking the web browser's built-in Stop button) and have it call your abort code. Although maybe there is some cross-browser technique to hook the built-in stop button (and still make your AJAX call). -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] INSERT img+ID
On Sat, Jan 24, 2009 at 7:01 AM, Emiliano Boragina wrote: > > I want to insert a JPG image ($creacion) with the ID (from the data base, > MEDIUMINT AUTOINCREMENT): 23image.jpg in the data base, and send the > information to a e-mail addres. How do I do that? > > Thanks a lot, > > > > + _ > // Emiliano Boragina _ > // Diseño & Comunicación // mysql_insert_id http://us3.php.net/manual/es/function.mysql-insert-id.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: MySQL Conditional Trigger
On Fri, Oct 31, 2008 at 11:09 AM, Dee Ayy <[EMAIL PROTECTED]> wrote: > ... > IF OLD.ShipDate != NEW.ShipDate AND NEW.ShipDate IS NOT NULL THEN > ... The following seems to work. Is it correct and not too verbose? IF (OLD.StatusShipDate IS NULL AND NEW.StatusShipDate IS NOT NULL) OR (OLD.StatusShipDate != NEW.StatusShipDate AND NEW.StatusShipDate IS NOT NULL) THEN -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL Conditional Trigger
I don't think my trigger likes a comparison with a variable which is NULL. The docs seem to have a few interesting variations on playing with NULL and I was hoping someone would just throw me a fish so I don't have to try every permutation (possibly using CASE, IFNULL, etc.). If my ShipDate (which is a date datatype which can be NULL) changes to a non-null value, I want my IF statement to evaluate to TRUE. IF NULL changes to aDate : TRUE IF aDate changes to aDifferentDate : TRUE IF anyDate changes to NULL : FALSE In my trigger I have: ... IF OLD.ShipDate != NEW.ShipDate AND NEW.ShipDate IS NOT NULL THEN ... Which only works when ShipDate was not NULL to begin with. I suppose it evaluates the following to FALSE IF NULL != '2008-10-31' AND '2008-10-31' IS NOT NULL THEN (not liking the "NULL != '2008-10-31'" part) Please give me the correct syntax. TIA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Probleme with MySQL queries
> On Wed, Sep 3, 2008 at 8:35 PM, David DURIEUX <[EMAIL PROTECTED]> wrote: >> Bonjour, >> >> I have always the problem, select = 0 rows and it delete it like if >> delete is before the select :/ >> >> Cordialement, >> >> David DURIEUX Your SELECT has a terminating semicolon. Your DELETE does not. Some configurations of PHP do not execute from the mysql_query function if the query is terminated with a semicolon. What version of PHP are you using? I wish I knew what flags to also ask about that affect the semicolon. If in fact your problem is the semicolon. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Probleme with MySQL queries
On Wed, Sep 3, 2008 at 1:05 PM, Evert Lammerts <[EMAIL PROTECTED]> wrote: > On Wed, Sep 3, 2008 at 7:58 PM, Evert Lammerts <[EMAIL PROTECTED]> wrote: >> On Wed, Sep 3, 2008 at 7:41 PM, Dee Ayy <[EMAIL PROTECTED]> wrote: >>> When using mysql_query, the SQL string to be executed should not end >>> in a semicolon. >> >> Ending a query with a semicolon should not be a problem - the string >> is parsed by the mysql server, which handles it fine. > > The manual does mention it, I'm a little too quick with my replies. I > personally never had a problem with it though. Plus, it seemed to work > some mails ago. > > David, did I understand well that your problem is solved? > I have run into problems with it, and it is in the manual. But a test case today did not display the problem on PHP version 4.1.2 and version 5.1.6. As I understood, this is/was a security feature so that SQL injection could not terminate the real query, and add additional hacker queries to the real query. Now I'd like to know why it _IS_ executing _WITH_ a semicolon _DESPITE_ what the manual says. Perhaps some easily_forgettable_magic_flag.ini setting? Gotta love PHP for that. Can we really rely completely on mysql_real_escape_string? When David said the SELECT did not work, but the DELETE worked, I thought for sure the semicolon was the problem. Also, that maybe he just removed the SELECT part so he could move on. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Probleme with MySQL queries
When using mysql_query, the SQL string to be executed should not end in a semicolon. Your initial post did not have a semicolon (but you obviously edited it to make it generic). Perhaps this was the initial problem? Subsequent posts had you terminating your queries with a semicolon. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] I want to remove the last comma
What I would do is change var tinyMCEImageList = new Array(\n"; to have a space and then the newline character at the end like so var tinyMCEImageList = new Array( \n"; then change your last $out line $out .= ");\n"; to strip the last 2 characters (which always gets called) and closes the Array opening parenthesis. $out = substr($out, 0, -2) . ");\n"; And your Javascript will always be able to be parsed even if there are no elements in the array. http://php.he.net/manual/en/function.substr.php BTW, this is more of a general list question though, not a php-db question. On Tue, Aug 12, 2008 at 2:27 PM, A. Joseph <[EMAIL PROTECTED]> wrote: > This the script > $dir = "images"; > $d = opendir($dir); > $out = " > var tinyMCEImageList = new Array(\n"; > while(false != ($entry = readdir($d))) { >if(preg_match("/(.jpg|.gif|.png)$/", $entry) != false) { >$out .= "['{$entry}', '{$dir}/{$entry}'],\n"; >} > > } > $out .= ");\n"; > > This the out put > > var tinyMCEImageList = new Array( > ['1_h_1.gif', 'images/1_h_1.gif'], > ['1_h_2.gif', 'images/1_h_2.gif'], > ['rss_2.jpg', 'images/rss_2.jpg'], > ['spacer.gif', 'images/spacer.gif'], # I want to remove this comma > ); > > if the last element (['spacer.gif', 'images/spacer.gif'],) contain comma, > javascript will return error, so i want to remove it. > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
On Sat, Aug 9, 2008 at 1:32 AM, Niel Archer <[EMAIL PROTECTED]> wrote: > Hi > > You do not say how you identify the last call (there is no date/time > field for example), so a complete answer is not really possible With the "id (auto incremented int)", the last record of either table would be the largest id in a particular group. > Do not use "NOT LIKE 'Completed'", it's an inefficient way of doing "!= > 'Completed'" I'll modify that as you said. My real concern is that $theHugeListOfIncidentIds keeps growing and is used in the "Calls.id IN ($theHugeListOfIncidentIds)". Even if the $theHugeListOfIncidentIds was replaced with an actual MySQL query instead of first being processed by PHP, I think that is a bad approach (but maybe that is the solution if I only change this query and do not change/add columns or states). -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Help to improve MySQL query
On Fri, Aug 8, 2008 at 5:25 PM, Micah Gersten <[EMAIL PROTECTED]> wrote: > How about "select Incidents.* from Incidents inner join Calls on > Incidents.id=Calls.incidentid where Calls.status='Open'"? ... > > Dee Ayy wrote: ... >> The status column never has the text "Open". ... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help to improve MySQL query
A database was designed with the following tables: Incidents _ id (auto incremented int) ... Calls _ id (auto incremented int) incidentId (foreign key) status (varchar 32) ... The status of the last Call is the status of the related Incident. Statuses can be "Not started" through various states up to "Completed". The status column never has the text "Open". If the last Call for the related Incident is not "Completed", then it is considered to be "Open". My task is to getIncidentsWithStatus("Open") using PHP. The existing inefficient method is in the PHP function getIncidentsWithStatus($status = "Open"), made worse by mingling with PHP and then another MySQL query. It first finds $theHugeListOfIncidentIds of the last Calls OF ALL INCIDENTS, then uses Calls.id IN ($theHugeListOfIncidentIds) AND Calls.status NOT LIKE 'Completed'. The reason this was done was that if Calls.status NOT LIKE 'Completed' was used first, then the result would include all Incidents. A) What would be an efficient MySQL query with the database in the present state to getIncidentsWithStatus("Open")? I can think of two alternatives, which require the database to be modified: 1a) Add a trigger to update a new column named "statusFromCall" in the Incidents table when the Calls.status is updated. 1b) Add PHP code to update the new column named "statusFromCall" in the Incidents table when the Calls.status is updated. 2) Then just query for Incidents WHERE statusFromCall NOT LIKE 'Completed'. B) What would be the MySQL query to create such a trigger in 1a? Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PDO prepared statements and value list for MySQL "IN"
As you already know, you will dynamically create the $contents. See if you can dynamically create the entire prepare statement which includes the $contents, as well as dynamically create the bindValue statement; then see if you can "eval" those dynamically created statements. $commandPrepare = '$stmt = $pdo->prepare(\' select * from mytable where myfield IN ('.$dynamicallyCreatedContents.')\' );'; eval($commandPrepare); $commandBind = '$stmt->bindValue... {escape quotes as needed -- I haven't tested it} eval($commandBind); $stmt->execute(); On Tue, Jul 8, 2008 at 11:55 AM, TK <[EMAIL PROTECTED]> wrote: > I'd like to use a PDO prepared statement to perform a MySQL query that uses > the IN function. > > I.e.: > $stmt = $pdo->prepare(' > select * > from mytable > where myfield IN (:contents) > ); > $stmt->bindValue(':contents', $contents); > $stmt->execute(); > > Here's the problem: > > If $contents is set to a single value, everything's fine: > $contents = 'mystring'; > > How can I include multiple values in here? If $contents is set to an > array, PHP throws an "Array to string conversion" notice. > i.e. $contents = array('mystring1', 'mystring2'); > > If $contents is set to a comma-separated list, no matches are returned > (probably because the entire "list" is being passed to MySQL as a single > value, not multiple values). > I.e. $contents = 'mystring1,mystring2'; > > What's the proper way to do this? Can it be done? (Note that I do not > know how many elements will be in $contents ahead of time, so something like > IN (:contents1, :contents2) wouldn't make sense.) > > Thanks for any help! > > - TK > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP-DB] PHP to MS SQL Package
http://php.he.net/manual/en/mssql.installation.php Installation The MSSQL extension is enabled by adding extension=php_mssql.dll to php.ini. To get these functions to work, you have to compile PHP with --with-mssql[=DIR], where DIR is the FreeTDS install prefix. And FreeTDS should be compiled using --enable-msdblib. Did you actually do a compile ... --with-mssql=/usr/local/freetds ... I saw you asked " ./configure [--with-apxs --with-mysql...] You actually meant mssql, right?" But I didn't see a reply about that. I searched for "--with-mssql" in my emails and did not see that in your thread, but saw Claudio Saavedra's thread from Jan 12, 2007 'Problem with PHP 4.4.4 and MSSQL in Centos' also mentioning "--with-sybase", but his solution was "I fixed it by compiling again php with --with-mssql instead of --with-sybase. Now it works perfectly". So again, I'd recommend compiling "--with-mssql". By the way anybody, why would I compile "--with-sybase" if I want to use MSSQL commands? I just checked my phpinfo on an install that has mysql and mssql. I don't even see a --with-mysql or --with-mssql like on previous servers, but I see "additional .ini files parsed" which mentions /etc/php.d/mssql.ini and /etc/php.d/mysqli.ini. Enjoy!
[PHP-DB] Partial UPDATE execution? Perl DBI MySQL
Has anyone ever seen a partial execution of an UPDATE statement? I'm using Perl DBI to update a table in MySQL. The strangest thing to me is that a varchar(35) field which holds a custom date/time format was updated correctly, but other tinyint(1) fields were not set correctly, and 1 of 3 text fields which were supposed to add the new "log" to existing logs in the 3 fields did not appear in the 1 field, but did in the other 2. I found the query in the mysql query log file and some of the text had newlines. So I thought the query may have failed at this point, BUT when manually executing the query in phpMyAdmin, it executed fine. I thought the whole query would fail due to possibly not escaping some characters. BUT, like I said before, even this logic is incorrect because some fields were updated before my manual attempt at testing the query. The only similar behavior I've seen is using C/C++ with printf and sometimes you need to add a "flush" statement so the text really prints. Basically for 5 years, this script has used the following sequence (prepare, execute, finish). But there have been recent changes to the script. Only one record is showing this strange behavior (but it most likely touches code that other records do not). After the successful manual execution of the statement, the 3 text fields do not verify my claim that 1 in 3 had previously failed. BUT the custom date/time field was confirmed by a few people to have been updated (when other fields were not), so I may not be going crazy. This is a single UPDATE statement. No transactions are involved. TIA
[PHP-DB] Fun with MySQL collation, HTML charset and PHP utf8_encode
How do I avoid having so much fun using utf8_encode throughout my document? I was thinking of using output buffering and then making 1 call to utf8_encode, but I think a better question is, how do I stop using utf8_encode completely? The docs say that utf8_encode "Encodes an ISO-8859-1 string to UTF-8". So if I start with a UTF-8 string, why should I need to use utf8_encode? Am I really starting with a UTF-8 string if I set MySQL to utf_unicode_ci for that field, set the content type with header('Content-type: text/html; charset=utf-8'); and set the HTML charset with ? In MySQL 5.0.22, I had a Type text, Collation latin1_swedish_ci field (default settings, I believe) which I pasted the character "é" from the French Keyboard Viewer on a Mac Leopard machine into phpMyAdmin 2.11.1.2. This is an e with an accent on top (in case it is not rendered properly in your email client). Hmm, pulling the phpMyAdmin version reveals: MySQL charset: UTF-8 Unicode (utf8) MySQL connection collation: utf_unicode_ci I retrieve the field using mysql_fetch_assoc and display it in an HTML page rendered by PHP with and without header('Content-type: text/html; charset=utf-8'); and The document was originally saved in Dreamweaver 8 as a Unicode Normalization Form: C (Canonical Decompositon, followed by Canonical Composition) without "Include Unicode Signature (BOM)" -- great more encoding to worry about in my editor. The rendered view I see in Firefox 2.0.0.12 is a question mark "?" where the French character should have appeared. If I use utf8_encode, the character appears as it should. I had changed the MySQL Collation to utf8_general_ci and utf8_unicode_ci and I still have to use utf8_encode to see the character appear properly. Luckily I'm on PHP 4.3.10, so I can't see what mb_check_encoding would report -- if that would even help normally. Don't you just love Monday fun? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Query Across DBMS Boundaries (Linked Database Servers?)
Wow! I just found the Federated Storage Engine. http://dev.mysql.com/tech-resources/articles/mysql-federated-storage.html It's not in our SHOW ENGINES though. I still welcome comments. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Query Across DBMS Boundaries (Linked Database Servers?)
Is there something which can perform a query across different database systems? It would extend the database.table.field notation to maybe dbms.database.table.field and allow queries across MySQL and MSSQL such as: //$sql = SELECT MySQLidentifier.aDatabase.aTable.aField, MSSQLidentifier.anotherDatabase.anotherTable.anotherField FROM MySQLidentifier.aDatabase.aTable, MSSQLidentifier.anotherDatabase.anotherTable WHERE MySQLidentifier.aDatabase.aTable.aKeyField = MSSQLidentifier.anotherDatabase.anotherTable.anotherKeyField //Or through JOINS, etc. I've seen the linked server option in MSSQL. Technically I can write to MSSQL, but company policy prohibits it. To steer clear of ambiguity, personally I've decided that I will also not create triggers (or any object) on MSSQL (which is a write in my mind). Basically I will only read information from MSSQL. I was thinking of PDO, which raises an interesting distinction of data-access abstraction layer versus database abstraction (which as I understand means no SQL rewrite or missing feature emulation -- SQL rewrite example: "TOP n" prefix versus "LIMIT n" suffix). The PDO developers may be close to creating such a feature. $MySQLidentifier = new PDO('mysql:host=localhost;dbname=test', $user, $pass); $MSSQLidentifier = new PDO('mssql:host=localhost;dbname=test', $user, $pass); $dbh = new PDO_LinkedServers($MySQLidentifier, $MSSQLidentifier); $dbh->exec("$sql"); Looking at MSSQL's OPENQUERY syntax, I don't even know if MSSQL provides this extended query notation. It just seems to allow a query on a remote (or distributed) server. Regards. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Command-line PHP script CPU usage goes sky-high, stays there--why?
The only thing that comes to my mind about this is to create a table index. Just a thought. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Form mail() problem
Normally I'd say, "If it's been working fine for 3 months; then just stopped working; don't get angry at the PHP programmer; check with the network admin as to what changed." But it's interesting that your error came from an MS Windows machine, while you have links at the bottom from an Apple machine. Did someone move your working code from one machine to another? > Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 > Unable to relay for [EMAIL PROTECTED] in C:\Domains\logosunlimited.com.au > \wwwroot\contact\processquote3.php on line 284 > home | href="file:///Macintosh > HD/Users/DF/Sites/Logos Unlimited Website/Logos Root Folder/wwwroot/ > clothing/clothing.html">clothing | embroidery | printing | promotional | signage | contact -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: passing a mysqli object via globals
> no worries I give up. It is really weird I know Hope some day I > will get enlighted. > > In one file, any method within a class is happy with the global > $db...on a different (same file !!!) class no method is happy with > accessing $db via global... So you confirmed that you are using "global" instead of what you posted to the list as "globals"? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: passing a mysqli object via globals
On Dec 3, 2007 10:26 AM, julian <[EMAIL PROTECTED]> wrote: > Dee Ayy wrote: > > Hopefully your only issue is the keyword global versus globals ? > > > Not sure what you mean. global $db should bring to local scope a > reference to the object that has the data base connection. > > PHP complaints that it cannot access properties or methods of that > object in the obj/f1/ scope > > I tried using the $GLOBALS['db'] with same results. In the one that failed, you used the invalid keyword "globals". In the one that worked, you used the valid keyword "global". When I said "hopefully", I was wondering if you could use $GLOBALS['db'] but there may be other issues since you said that also failed. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: passing a mysqli object via globals
Hopefully your only issue is the keyword global versus globals ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sending value to another page...
I just tested ?'OrderNumber'=TEST222808 and it works with and without quotes. The problem is you have echo (['OrderNumber']) when you need echo $_GET['OrderNumber']; or possibly echo ($_GET['OrderNumber']); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Sending value to another page...
I was going to guess: echo ($_GET['OrderNumber']); But I don't use that form. I use echo $_GET['OrderNumber']; But now I need to check out that quoted URL ... ?'OrderNumber'=TEST222808 as well. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php