Getting parse error in sql statement

I getting a parse error in my sql statement.  Could someone tell me what I missed?

$SQL = mysql_query("UPDATE tblAdspace SET "
       $SQL = $SQL . "strProviderservice = '" . $strProviderservice . "', "  <--- Parse error
     $SQL = $SQL . "strCompanyname='" . $strCompanyname . "', "
     $SQL = $SQL . "strOwner='" . $strOwner . "', "
       $SQL = $SQL . "strAddress='" . $strAddress . "', "
     $SQL = $SQL . "strTown='" . $strTown . "', "
       $SQL = $SQL . "strZipcode='" . $strZipcode . "', "
       $SQL = $SQL . "strPhone='" . $strPhone . "', "
     $SQL = $SQL . "str2ndphone='" . $str2ndphone . "', "
     $SQL = $SQL . "strMobile='" . $strMobile . "', "
     $SQL = $SQL . "strPager='" . $strPager . "', "
     $SQL = $SQL . "strFax='" . $strFax . "', "
     $SQL = $SQL . "strEmail='" . $strEmail . "', "
     $SQL = $SQL . "strWebsite='" . $strWebsite . "', "
     $SQL = $SQL . "strLicense='" . $strLicense . "', "
     $SQL = $SQL . "strInsured='" . $strInsured . "', "
     $SQL = $SQL . "strBonded='" . $strBonded . "', "
     $SQL = $SQL . "strHours='" . $strHours . "', "
     $SQL = $SQL . "str24houremerg='" . $str24houremerg . "', "
     $SQL = $SQL . "strOtherServices='" . str_replace(str_replace("'","''", $strOtherservices), "vbcrlf", "<br>") . "', "
     $SQL = $SQL . "strServicearea='" . $strServicearea . "', "
     $SQL = $SQL . "strInbusiness_since='" . $strInbusiness_since . "', "
     $SQL = $SQL . " strServicesOffered='" . str_replace(str_replace("'","''", $strServicesoffered), "vbcrlf", "<br>") . "', "
       $SQL = $SQL . "strFreeestimate='" . $strFreeestimate . "', "
     $SQL = $SQL . "strWorkguaranteed='" . $strWorkguaranteed . "', "
       $SQL = $SQL . "strProvidertagline='" . str_replace(str_replace("'", "''", $strProvidertagline), "vbcrlf", "<br>") . "', " 
     $SQL = $SQL . "strAd_size='" . $strAd_size . "', "
       $SQL = $SQL . "strImage='" . strImage . "'"
     $SQL = $SQL . " WHERE strCompanyname = '" . strCompanyname . "'");
}
LVL 1
pingeyegAsked:
Who is Participating?
 
glcumminsCommented:
This is the same problem again. The '$SQL = $SQL .' statements are throwing you off. Try this:

     $SQL = mysql_query("INSERT INTO tblAdspace VALUES"
     . "("
     . "strProviderservice, strCompanyname, strOwner, strAddress, strTown, "
     . "strZipcode, strPhone, str2ndphone, "
     . "strMobile, strPager, strFax, "
     . "strEmail, strWebsite, strLicense, "
     . "strBonded, strHours, str24houremerg, "
     . "strOtherservices, strServicearea, strFreeestimate, strWorkguaranteed, strProvidertagline, strAd_size"
if ($strimage <> "") {
        . ", strimage "

Also note that I added the word 'VALUES' on the first line of this update. You may have to alter other parts of your code in this manner. When you are creating the query within the parenthesis of the mysql_query() function, do not try to assign the string to the variable $SQL.
0
 
glcumminsCommented:
Can you try this:

$SQL = mysql_query("UPDATE tblAdspace SET "
       . "strProviderservice = '" . $strProviderservice . "', "
     . "strCompanyname='" . $strCompanyname . "', "
     . "strOwner='" . $strOwner . "', "
       . "strAddress='" . $strAddress . "', "
     . "strTown='" . $strTown . "', "
       . "strZipcode='" . $strZipcode . "', "
       . "strPhone='" . $strPhone . "', "
     . "str2ndphone='" . $str2ndphone . "', "
     . "strMobile='" . $strMobile . "', "
     . "strPager='" . $strPager . "', "
     . "strFax='" . $strFax . "', "
     . "strEmail='" . $strEmail . "', "
     . "strWebsite='" . $strWebsite . "', "
     . "strLicense='" . $strLicense . "', "
     . "strInsured='" . $strInsured . "', "
     . "strBonded='" . $strBonded . "', "
     . "strHours='" . $strHours . "', "
     . "str24houremerg='" . $str24houremerg . "', "
     . "strOtherServices='" . str_replace(str_replace("'","''", $strOtherservices), "vbcrlf", "<br>") . "', "
     . "strServicearea='" . $strServicearea . "', "
     . "strInbusiness_since='" . $strInbusiness_since . "', "
     . " strServicesOffered='" . str_replace(str_replace("'","''", $strServicesoffered), "vbcrlf", "<br>") . "', "
       . "strFreeestimate='" . $strFreeestimate . "', "
     . "strWorkguaranteed='" . $strWorkguaranteed . "', "
       . "strProvidertagline='" . str_replace(str_replace("'", "''", $strProvidertagline), "vbcrlf", "<br>") . "', "
     . "strAd_size='" . $strAd_size . "', "
       . "strImage='" . strImage . "'"
     . " WHERE strCompanyname = '" . strCompanyname . "'");
0
 
pingeyegAuthor Commented:
Not sure what's going on now because the error message is on a perfectly good line.  Below is the entire update page.

<?php

if ($_SERVER['REQUEST_METHOD'] == "POST") {

$conn = mysql_connect("", "", "");
mysql_select_db("providers", $conn);

            $strProviderservice = $_REQUEST['strProviderservice'];
            $strCompanyname = $_REQUEST['strCompanyname'];
            $strOwner = $_REQUEST['strOwner'];
            $strAddress = $_REQUEST['strAddress'];
            $strTown = $_REQUEST['strTown'];
            $strZipcode = $_REQUEST['strZipcode'];
            $strPhone = $_REQUEST['strPhone'];
            $str2ndphone = $_REQUEST['str2ndphone'];
            $strMobile = $_REQUEST['strMobile'];
            $strPager = $_REQUEST['strPager'];
            $strFax = $_REQUEST['strFax'];
            $strEmail = $_REQUEST['strEmail'];
            $strWebsite = $_REQUEST['strWebsite'];
            $strInbusiness_since = $_REQUEST['strInbusiness_since'];
            $strLicense = $_REQUEST['strLicense'];
            $strInsured = $_REQUEST['strInsured'];
            $strBonded = $_REQUEST['strBonded'];
            $strHours = $_REQUEST['strHours'];
            $str24houremerg = $_REQUEST['str24houremerg'];
            $strServicesoffered = $_REQUEST['strServicesoffered'];
            $strOtherservices = $_REQUEST['strOtherservices'];
            $strServicearea = $_REQUEST['strServicearea'];
            $strFreeestimate = $_REQUEST['strFreeestimate'];
            $strWorkguaranteed = $_REQUEST['strWorkguaranteed'];
            $strProvidertagline = $_REQUEST['strProvidertagline'];
            $strAd_size = $_REQUEST['strAd_size'];

$SQL = mysql_query("SELECT * FROM tblAdspace where strCompanyname = '" .$strCompanyname. "'");

if ($row = mysql_fetch_array($SQL)) {

$SQL = mysql_query("UPDATE tblAdspace SET "
       . "strProviderservice = '" . $strProviderservice . "', "
     . "strCompanyname='" . $strCompanyname . "', "
     . "strOwner='" . $strOwner . "', "
       . "strAddress='" . $strAddress . "', "
     . "strTown='" . $strTown . "', "
       . "strZipcode='" . $strZipcode . "', "
       . "strPhone='" . $strPhone . "', "
     . "str2ndphone='" . $str2ndphone . "', "
     . "strMobile='" . $strMobile . "', "
     . "strPager='" . $strPager . "', "
     . "strFax='" . $strFax . "', "
     . "strEmail='" . $strEmail . "', "
     . "strWebsite='" . $strWebsite . "', "
     . "strLicense='" . $strLicense . "', "
     . "strInsured='" . $strInsured . "', "
     . "strBonded='" . $strBonded . "', "
     . "strHours='" . $strHours . "', "
     . "str24houremerg='" . $str24houremerg . "', "
     . "strOtherServices='" . str_replace(str_replace("'","''", $strOtherservices), "vbcrlf", "<br>") . "', "
     . "strServicearea='" . $strServicearea . "', "
     . "strInbusiness_since='" . $strInbusiness_since . "', "
     . " strServicesOffered='" . str_replace(str_replace("'","''", $strServicesoffered), "vbcrlf", "<br>") . "', "
       . "strFreeestimate='" . $strFreeestimate . "', "
     . "strWorkguaranteed='" . $strWorkguaranteed . "', "
       . "strProvidertagline='" . str_replace(str_replace("'", "''", $strProvidertagline), "vbcrlf", "<br>") . "', "
     . "strAd_size='" . $strAd_size . "', "
       . "strImage='" . strImage . "'"
     . " WHERE strCompanyname = '" . strCompanyname . "'");
                    
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
"<head>\n";
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n";
"<title>Ask2bsure.com - (Admin Section) Edit Provider</title>\n";
"<link style=\"text/css\" href=\"/css/style.css\" rel=\"stylesheet\">\n";
"</head>\n";
"<body>\n";
"<table align=\"center\" id=\"admin\">\n";
"<tr><td align=\"center\" colspan=\"2\">\n";
"<img src=\"/images/sublogo_2.png\"><br />\n";
"<span style=\"font-size: 12px; color: #0000FF\">(Admin Section)</span>\n";
"</td></tr>\n";
"<tr><td valign=\"top\">\n";
"<div id=\"navlist\">\n";
"<a href=\"/admin/\">Home</a>\n";
"<a href=\"/admin/add_provider.php\">Add Provider</a>\n";
"<a href=\"/admin/list_providers.php?list=list\">Delete / Edit Provider</a>\n";
"<a href=\"/admin/list_providers.php?review=review\">Toggle / Edit Reviews</a>\n";
"<a href=\"/index.php\">Back To Website</a>\n";
"</div>\n";
"</td><td width=\"625\">\n";
"<table id=\"main_admin\" align=\"center\" border=\"0\">\n";
"<tr><td align=\"center\">\n";
"The selected provider has now been updated.\n";
"</td></tr>\n";
"</table>\n";
"</td></tr>\n";
"</table>\n";
"</body>\n";
"</html>"

} else {
     $SQL = mysql_query("INSERT INTO tblAdspace "
     $SQL = $SQL . "("
     $SQL = $SQL . "strProviderservice, strCompanyname, strOwner, strAddress, strTown, "
     $SQL = $SQL . "strZipcode, strPhone, str2ndphone, "
     $SQL = $SQL . "strMobile, strPager, strFax, "
     $SQL = $SQL . "strEmail, strWebsite, strLicense, "
     $SQL = $SQL . "strBonded, strHours, str24houremerg, "
     $SQL = $SQL . "strOtherservices, strServicearea, strFreeestimate, strWorkguaranteed, strProvidertagline, strAd_size"
if ($strimage <> "") {
        $SQL = $SQL . ", strimage "
}

      $SQL = $SQL . ") "
      $SQL = $SQL . "VALUES("
      $SQL = $SQL . "'" . $strProviderservice . "',"
      $SQL = $SQL . "'" . $strCompanyname . "',"
      $SQL = $SQL . "'" . $strOwner . "',"
      $SQL = $SQL . "'" . $strAddress . "',"
      $SQL = $SQL . "'" . $strTown . "',"
      $SQL = $SQL . "'" . $strZipcode . "',"
      $SQL = $SQL . "'" . $strPhone . "',"
      $SQL = $SQL . "'" . $str2ndphone . "',"
      $SQL = $SQL . "'" . $strMobile . "',"
      $SQL = $SQL . "'" . $strPager . "',"
      $SQL = $SQL . "'" . $strFax . "',"
      $SQL = $SQL . "'" . $strEmail . "',"
      $SQL = $SQL . "'" . $strWebsite . "',"
      $SQL = $SQL . "'" . $strLicense . "',"
      $SQL = $SQL . "'" . $strBonded . "',"
      $SQL = $SQL . "'" . $strHours . "',"
      $SQL = $SQL . "'" . $str24houremerg . "',"
      $SQL = $SQL . "'" . str_replace("'", "''", $strOtherservices) . "',"
      $SQL = $SQL . "'" . $strServicearea . "',"
      $SQL = $SQL . "'" . $strFreeestimate . "',"
      $SQL = $SQL . "'" . $strWorkguaranteed . "',"
      $SQL = $SQL . "'" . str_replace("'", "''", $strProvidertagline) . "',"
      $SQL = $SQL . "'" . $strAd_size . "'"
if ($strImage <> "") {
      $SQL = $SQL . ",'" . $strImage . "'"
}
      $SQL = $SQL . ") ");
}

echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
"<head>\n";
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n";
"<title>Ask2bsure.com - (Admin Section) Edit Provider</title>\n";
"<link style=\"text/css\" href=\"/css/style.css\" rel=\"stylesheet\">\n";
"</head>\n";
"<body>\n";
"<table align=\"center\" id=\"admin\">\n";
"<tr><td align=\"center\" colspan=\"2\">\n";
"<img src=\"/images/sublogo_2.png\"><br />\n";
"<span style=\"font-size: 12px; color: #0000FF\">(Admin Section)</span>\n";
"</td></tr>\n";
"<tr><td valign=\"top\">\n";
"<div id=\"navlist\">\n";
"<a href=\"/admin/\">Home</a>\n";
"<a href=\"/admin/add_provider.php\">Add Provider</a>\n";
"<a href=\"/admin/list_providers.php?list=list\">Delete / Edit Provider</a>\n";
"<a href=\"/admin/list_providers.php?review=review\">Toggle / Edit Reviews</a>\n";
"<a href=\"/index.php\">Back To Website</a>\n";
"</div>\n";
"</td><td width=\"625\">\n";
"<table id=\"main_admin\" align=\"center\" border=\"0\">\n";
"<tr><td align=\"center\">\n";
"The selected provider has now been updated.\n";
"</td></tr>\n";
"</table>\n";
"</td></tr>\n";
"</table>\n";
"</body>\n";
"</html>"

}
}

?>      
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
pingeyegAuthor Commented:
The error occurs on the else statment halfway down the page.
0
 
glcumminsCommented:
Also, this:

      $SQL = $SQL . ") "
      $SQL = $SQL . "VALUES("
      $SQL = $SQL . "'" . $strProviderservice . "',"
      $SQL = $SQL . "'" . $strCompanyname . "',"
      $SQL = $SQL . "'" . $strOwner . "',"
      $SQL = $SQL . "'" . $strAddress . "',"
      $SQL = $SQL . "'" . $strTown . "',"
      $SQL = $SQL . "'" . $strZipcode . "',"
      $SQL = $SQL . "'" . $strPhone . "',"
      $SQL = $SQL . "'" . $str2ndphone . "',"
      $SQL = $SQL . "'" . $strMobile . "',"
      $SQL = $SQL . "'" . $strPager . "',"
      $SQL = $SQL . "'" . $strFax . "',"
      $SQL = $SQL . "'" . $strEmail . "',"
      $SQL = $SQL . "'" . $strWebsite . "',"
      $SQL = $SQL . "'" . $strLicense . "',"
      $SQL = $SQL . "'" . $strBonded . "',"
      $SQL = $SQL . "'" . $strHours . "',"
      $SQL = $SQL . "'" . $str24houremerg . "',"
      $SQL = $SQL . "'" . str_replace("'", "''", $strOtherservices) . "',"
      $SQL = $SQL . "'" . $strServicearea . "',"
      $SQL = $SQL . "'" . $strFreeestimate . "',"
      $SQL = $SQL . "'" . $strWorkguaranteed . "',"
      $SQL = $SQL . "'" . str_replace("'", "''", $strProvidertagline) . "',"
      $SQL = $SQL . "'" . $strAd_size . "'"
if ($strImage <> "") {
      $SQL = $SQL . ",'" . $strImage . "'"
}
      $SQL = $SQL . ") ");
}

Becomes:

      . ") "
      . "VALUES("
      . "'" . $strProviderservice . "',"
      . "'" . $strCompanyname . "',"
      . "'" . $strOwner . "',"
      . "'" . $strAddress . "',"
      . "'" . $strTown . "',"
      . "'" . $strZipcode . "',"
      . "'" . $strPhone . "',"
      . "'" . $str2ndphone . "',"
      . "'" . $strMobile . "',"
      . "'" . $strPager . "',"
      . "'" . $strFax . "',"
      . "'" . $strEmail . "',"
      . "'" . $strWebsite . "',"
      . "'" . $strLicense . "',"
      . "'" . $strBonded . "',"
      . "'" . $strHours . "',"
      . "'" . $str24houremerg . "',"
      . "'" . str_replace("'", "''", $strOtherservices) . "',"
      . "'" . $strServicearea . "',"
      . "'" . $strFreeestimate . "',"
      . "'" . $strWorkguaranteed . "',"
      . "'" . str_replace("'", "''", $strProvidertagline) . "',"
      . "'" . $strAd_size . "'"
if ($strImage <> "") {
      . ",'" . $strImage . "'"
}
      . ") ");
}
0
 
elfe69Commented:
Your script is missing some ; beginning at "<html>" just before your else statement and then after all the lines where you construct $SQL after the else
0
 
pingeyegAuthor Commented:
I like the change you had me do, I can read a bit better now, but I'm still getting the same error on this line:

} else {  <---- This line
     $SQL = mysql_query("INSERT INTO tblAdspace VALUES"
0
 
glcumminsCommented:
What is the error?
0
 
glcumminsCommented:
Ah, I see it. Look two lines before the '} else {' line. You are missing a semicolon.

"</html>"

Should be:

"</html>";
0
 
pingeyegAuthor Commented:
Ok, thanks for that, but now all of a sudden the page went entirely blank.
0
 
glcumminsCommented:
I think I am misunderstanding what you are trying to do with the following section:

echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
"<head>\n";
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n";
"<title>Ask2bsure.com - (Admin Section) Edit Provider</title>\n";
"<link style=\"text/css\" href=\"/css/style.css\" rel=\"stylesheet\">\n";
"</head>\n";
"<body>\n";
"<table align=\"center\" id=\"admin\">\n";
"<tr><td align=\"center\" colspan=\"2\">\n";
"<img src=\"/images/sublogo_2.png\"><br />\n";
"<span style=\"font-size: 12px; color: #0000FF\">(Admin Section)</span>\n";
"</td></tr>\n";
"<tr><td valign=\"top\">\n";
"<div id=\"navlist\">\n";
"<a href=\"/admin/\">Home</a>\n";
"<a href=\"/admin/add_provider.php\">Add Provider</a>\n";
"<a href=\"/admin/list_providers.php?list=list\">Delete / Edit Provider</a>\n";
"<a href=\"/admin/list_providers.php?review=review\">Toggle / Edit Reviews</a>\n";
"<a href=\"/index.php\">Back To Website</a>\n";
"</div>\n";
"</td><td width=\"625\">\n";
"<table id=\"main_admin\" align=\"center\" border=\"0\">\n";
"<tr><td align=\"center\">\n";
"The selected provider has now been updated.\n";
"</td></tr>\n";
"</table>\n";
"</td></tr>\n";
"</table>\n";
"</body>\n";
"</html>";

It looks like you are trying to make each line an individual echo statement, in which case you need to add the word 'echo' before each line.

If, however, you want this to be one big echo statement, you need to remove the semicolon from after every line but the last, and add a perid in front of every line but the first.

0
 
glcumminsCommented:
"period" rather than "perid".
0
 
pingeyegAuthor Commented:
Do I keep the \n in front of each line?
0
 
glcumminsCommented:
That is up to you. It will just make your HTML source look better if someone views it.
0
 
elfe69Commented:
You just echo the HTML header, every line beginning with " should begin with echo ".

Look at that:
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
"<head>\n";

It should be replaced by (add echo at beginning of each line):
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
echo "<head>\n";

Or by (replace ; by , at end of each line except the last):

echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n",
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n",
"<head>\n";
0
 
pingeyegAuthor Commented:
I was trying to make it into one entire echo statement, which it now displays after taking out the semicolons except for the last ones.  The problems now are 1) Nothing gets updated into the db 2) The page shows two rows of the same html table displaying "Your record has now been updated" even though nothing got updated.
0
 
pingeyegAuthor Commented:
elfe69, is that a comma or a period at the end of each line?
0
 
glcumminsCommented:
Should be a period. A comman will result in a parse error.
0
 
elfe69Commented:
a comma in my example, but a period would be ok too.

For your knowledge:

The difference between comma and period ?
- period is the string concatenation operator and all your strings will be concatenated before the echo command is processed
- comma is a separator supported by the echo command to echo multiple strings from one line, it has the advantage to avoid costly string concatenation as each string is echoed independently.

echo "string1", "string2", "string3";
is equivalent to
echo "string1";
echo "string2";
echo "string3";
0
 
elfe69Commented:
glcummins: you are wrong, comma will not result in a parse error and should be preferred as it avoids string concatenation.
0
 
pingeyegAuthor Commented:
Ok, thanks for the info, I will remember that in future coding.  Now back to my problem at hand, 1) Nothing gets updated into the db 2) The page shows two rows of the same html table displaying "Your record has now been updated" even though nothing got updated.
0
 
pingeyegAuthor Commented:
Ok, I fixed the double table, but the record is still not being updated.
0
 
pingeyegAuthor Commented:
Do you think it has anything do with...

$SQL = mysql_query("SELECT * FROM tblAdspace where strCompanyname = '" .$strCompanyname. "'");

if ($row = mysql_fetch_array($SQL)) {  <---- This line?

$SQL = mysql_query("UPDATE tblAdspace SET "
       . "strProviderservice = '" . $strProviderservice . "', "
     . "strCompanyname='" . $strCompanyname . "', "
     . "strOwner='" . $strOwner . "', "
       . "strAddress='" . $strAddress . "', "
     . "strTown='" . $strTown . "', "
       . "strZipcode='" . $strZipcode . "', "
       . "strPhone='" . $strPhone . "', "
     . "str2ndphone='" . $str2ndphone . "', "
     . "strMobile='" . $strMobile . "', "
     . "strPager='" . $strPager . "', "
     . "strFax='" . $strFax . "', "
     . "strEmail='" . $strEmail . "', "
     . "strWebsite='" . $strWebsite . "', "
     . "strLicense='" . $strLicense . "', "
     . "strInsured='" . $strInsured . "', "
     . "strBonded='" . $strBonded . "', "
     . "strHours='" . $strHours . "', "
     . "str24houremerg='" . $str24houremerg . "', "
     . "strOtherServices='" . str_replace(str_replace("'","''", $strOtherservices), "vbcrlf", "<br>") . "', "
     . "strServicearea='" . $strServicearea . "', "
     . "strInbusiness_since='" . $strInbusiness_since . "', "
     . " strServicesOffered='" . str_replace(str_replace("'","''", $strServicesoffered), "vbcrlf", "<br>") . "', "
       . "strFreeestimate='" . $strFreeestimate . "', "
     . "strWorkguaranteed='" . $strWorkguaranteed . "', "
       . "strProvidertagline='" . str_replace(str_replace("'", "''", $strProvidertagline), "vbcrlf", "<br>") . "', "
     . "strAd_size='" . $strAd_size . "'"
     . " WHERE strCompanyname = '" . strCompanyname . "'");
0
 
glcumminsCommented:
Add the end of each mysql_* function, add:

or die (mysql_error());

This will report any error that occurs during the execution of the function.

For example,

$SQL = mysql_query("INSERT....") or die(mysql_error());

and

mysql_select_db('your_db') or die(mysql_error());

This will help during the troubleshooting process. As your code stands now, any mysql errors will fail silently.
0
 
pingeyegAuthor Commented:
Ok, I added those at the end of each like you said, but I'm am not getting any error messages being displayed.
0
 
pingeyegAuthor Commented:
Is there an easy way of displaying what the sql statement is doing?  Like echo $SQL; ?
0
 
elfe69Commented:
Yes, you can execute echo $SQL; to see your statement
0
 
pingeyegAuthor Commented:
You know, I tried that, but all I get is:

Resource id #5
0
 
elfe69Commented:
Put your UPDATE statement string into a variable before executing it, so you will be able to echo the statement that you execute.
0
 
elfe69Commented:
Do it this way:

$mySqlStatement = "UPDATE tblAdspace SET "
       . "strProviderservice = '" . $strProviderservice . "', "
     . "strCompanyname='" . $strCompanyname . "', "
     . "strOwner='" . $strOwner . "', "
       . "strAddress='" . $strAddress . "', "
     . "strTown='" . $strTown . "', "
       . "strZipcode='" . $strZipcode . "', "
       . "strPhone='" . $strPhone . "', "
     . "str2ndphone='" . $str2ndphone . "', "
     . "strMobile='" . $strMobile . "', "
     . "strPager='" . $strPager . "', "
     . "strFax='" . $strFax . "', "
     . "strEmail='" . $strEmail . "', "
     . "strWebsite='" . $strWebsite . "', "
     . "strLicense='" . $strLicense . "', "
     . "strInsured='" . $strInsured . "', "
     . "strBonded='" . $strBonded . "', "
     . "strHours='" . $strHours . "', "
     . "str24houremerg='" . $str24houremerg . "', "
     . "strOtherServices='" . str_replace(str_replace("'","''", $strOtherservices), "vbcrlf", "<br>") . "', "
     . "strServicearea='" . $strServicearea . "', "
     . "strInbusiness_since='" . $strInbusiness_since . "', "
     . " strServicesOffered='" . str_replace(str_replace("'","''", $strServicesoffered), "vbcrlf", "<br>") . "', "
       . "strFreeestimate='" . $strFreeestimate . "', "
     . "strWorkguaranteed='" . $strWorkguaranteed . "', "
       . "strProvidertagline='" . str_replace(str_replace("'", "''", $strProvidertagline), "vbcrlf", "<br>") . "', "
     . "strAd_size='" . $strAd_size . "'"
     . " WHERE strCompanyname = '" . strCompanyname . "'");

echo $mySqlStatement;
$SQL = mysql_query($mySqlStatement) or die(mysql_error());
0
 
pingeyegAuthor Commented:
Gotcha.

Maybe there is something wrong with this line on the form page?

<?= str_replace("<br>", "vbCrLf", Trim($strServicesoffered)) ?>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.