using PHP with mySQL, or ASP with msAccess 2000 on a win2000Server web server; also using a "rich text format" utility to allow formatting of text in a text area: when i use the mySQL command "UPDATE", and data from the textarea is written to the database, it adds erroneous spaces in various places, as well as other characters like "?", blocks, etc. However, simply displaying data I add manually into the database field is fine, until the UPDATE is used. Using windows 2000 server, msAccess 2000, mySQL 5.x. current rich text formatting

my latest ASP code:

<!--#include file="../includes/db-connect-admin.asp"-->

If Request.Form("submit") ="Update Homepage" Then
    Dim strMessage
    Dim sConnString, connection, sSQL

    strMessage = replace(Request.Form("msgContent"), "'", "''")

    Set rsHomepage = Server.CreateObject("ADODB.Recordset")
    strSQLHomepage = "UPDATE homepage SET message ='" & strMessage & "'"

    'response.write strSQLHomepage
    rsHomepage.Open strSQLHomepage, adoCon

    Set rsMessage = Server.CreateObject("ADODB.Recordset")
    strSQLmsg1 = "SELECT * FROM homepage"
    rsMessage.Open strSQLmsg1, adoCon

    If rsMessage.BOF _
       And rsMessage.EOF Then 
    strSQLmsg2 = "INSERT into homepage (message) values (" & strMessage & ")"
        strSQLmsg2 = "UPDATE homepage SET message = '" &  strMessage & "'"
    End If  

    rsHomepage.Open strSQLmsg2, adoCon

    Set adoCon = Nothing
    Response.Redirect "test3.asp"
    Dim adoCon        
    Dim rsHomepage   
    Dim strSQL  

    Set rsHomepage = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM homepage"
    rsHomepage.Open strSQL, adoCon

    Set rsHomepage2 = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM homepage"
    rsHomepage2.Open strSQL, adoCon
    If rsHomepage2.BOF _
       And rsHomepage2.EOF Then 
       message = ""
        message = rsHomepage2("message")
    End If

End If

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>INSIDECSH Barry's Admin Utility</title>
<link rel="stylesheet" type="text/css" href="css/4style.css">
<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
    mode : "textareas",
    theme: "advanced",
    invalid_elements : "strong,em,table,td,tr,font,span,img",
    content_css : "../css/main.css"

<div id="contentMain"><br />

<form name="frmMessage" action="test3.asp" method="post">

<textarea name="msgContent" id="msgContent" cols="40" rows="10" wrap="hard">
<% 'Connect to the .mdb, located in "db" of the root directory
Response.Write message

        <input type="submit" name="submit" value="Update Homepage">
        <!--end of "contentMain" -->


it displays what is in the database, and the UPDATE appears to work "successfully", of course with the erroneous data.

help would be greatly, greatly appreciated!!

This occurs with English text?? or Arabic\Indian or non-English text?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.