[PHP-DB] Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='

2005-08-01 Thread Help!
All I got by doing a search on Google are supplemental pages with no 
actual solution.


Here's how the problem starts.
1. Entered Korean characters in a form.
2. Press submit and I receive that error.

Programming Language: PHP 5.0.4
Database: MySQL 4.1.13
Operating System: Windows XP SP2

Charset for the page: UTF-8
Charset for the table: UTF-8
Charset for the database: UTF-8

So where does latin1_swedish_ci come from? I tried entering the same 
string in phpMyAdmin and I didn't receive the error.


SNIPPET:

$query = SELECT `id` FROM `table1` WHERE `column1`='$var';
$result = mysql_query ($query, $link);

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Multi Language

2005-08-01 Thread Shekhar Juneja
Hi,

I am trying to make a dictionary site with multi language support. Can any
one give me a quick head on for that. I mean a short cut article or anything
which I can refer to turn around quick solution. 

Thanks in advance .

Regards
Shekhs

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Duplicate record

2005-08-01 Thread Hallvard
Thanks!

I had already dealt with the problem using unique key, as many others 
suggested. However, the records (post your comment-type) doesn't have any 
natural key, so I had to concotinate several long text strings, which isn't 
nice.

Could you point me in the direction of any code examples for this?

Alexander Veremyev [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 You could use next simple rules to avoid this problem:

 1. Never change anything in your storage (database) by GET HTTP request 
 method.
 2. Never prepare any Web page by POST method.
 3. After Form is processed (with a POST method) use HTTP redirect to 
 corresponding GET page which should produce a result of processing. (it 
 may be the same php script)

 So you will have getters and setters for your Web application.
 Only getters will be stored in a browser history in this case and users 
 will be able to use back/forward/reload browser functionality without any 
 side effects (also without requests to post data again).


 PS Furthermore, such use of GET and POST methods corresponds to their 
 description in HTTP RFC's


 With best regards,
Alexander Veremyev.

 Hallvard wrote:

 I have a page that posts data from a form to a mysql database.

 The problem is that if the user hits the reload button on the browser, 
 the data will be posted again, resulting in a duplicate record.

 How can I avoid that? 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Duplicate record

2005-08-01 Thread Micah Stevens

If its a potentially long message you're storing, you can always create an MD5 
sum during insertion, compare it to existing MD5 sums, and if they don't 
match, there's not duplicates.

Just as an example, if you're inserting message and user data, first see if 
there's duplicates:

if (!mysql_num_rows(mysql_query(select count(*) from table where stored_sum = 
md5(.$message.$user. { // if it's not already there, store it. 
mysql_query(insert into table message = '$message', 'user' = '$user', 
message_sum = md5(.$message.$user.));
} else {
echo Duplicate!;
}

hth,
-Micah 

On Monday 01 August 2005 12:56 pm, Hallvard wrote:
 Thanks!

 I had already dealt with the problem using unique key, as many others
 suggested. However, the records (post your comment-type) doesn't have any
 natural key, so I had to concotinate several long text strings, which isn't
 nice.

 Could you point me in the direction of any code examples for this?

 Alexander Veremyev [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]

  You could use next simple rules to avoid this problem:
 
  1. Never change anything in your storage (database) by GET HTTP request
  method.
  2. Never prepare any Web page by POST method.
  3. After Form is processed (with a POST method) use HTTP redirect to
  corresponding GET page which should produce a result of processing. (it
  may be the same php script)
 
  So you will have getters and setters for your Web application.
  Only getters will be stored in a browser history in this case and users
  will be able to use back/forward/reload browser functionality without any
  side effects (also without requests to post data again).
 
 
  PS Furthermore, such use of GET and POST methods corresponds to their
  description in HTTP RFC's
 
 
  With best regards,
 Alexander Veremyev.
 
  Hallvard wrote:
  I have a page that posts data from a form to a mysql database.
 
  The problem is that if the user hits the reload button on the browser,
  the data will be posted again, resulting in a duplicate record.
 
  How can I avoid that?

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php