Open Source Services

Development Services and Products for Open Source e-Commerce Sites

 
Welcome, Guest
Please Login or Register.    Lost Password?

SQL Error when Saving A Page
(1 viewing) (1) Guest
Support Forum for free version.
Go to bottomPage: 1
TOPIC: SQL Error when Saving A Page
#338
SQL Error when Saving A Page 2 Years, 3 Months ago  
When I type the content into the FCK editor and click to save, I always am frequently receiving this error... and it is not saving to the DB:

Code:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't Have Said It Better Ourselves. Below are just a few of the thousands of satisf' at line 1

update pf_content set pf_name='Testimonials',content='

{DISPLAYS ALL THE TEXT OF THE PAGE}

' where pf_name= 'Testimonials'

[TEP STOP]



It seems whenever a apostrophe sign is used, the error occurs.

Any idea? Thakns!
jw18
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#339
Re:SQL Error when Saving A Page 2 Years, 3 Months ago  
Hi

Thanks a lot for bringing this one to my attention.

To fix it, go into catalog/admin/proforma.php

Find the line:

Code:


saveEdContent($HTTP_POST_VARS['name'], stripslashes($HTTP_POST_VARS['editor_content']));



and replace it with:

Code:


saveEdContent($HTTP_POST_VARS['name'], mysql_real_escape_string($HTTP_POST_VARS['editor_content']));



Let me know if you have any further problems.

Nick
hanuman
Moderator
Posts: 369
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#340
Re:SQL Error when Saving A Page 2 Years, 3 Months ago  
Ok, cool - but now when I click save and where a line break break should be, it inserts a "rn"
jw18
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#341
Re:SQL Error when Saving A Page 2 Years, 3 Months ago  
Hi

The 'rn' issue arises because (I guess) you downloaded Proforma from the osCommerce contributions website and then manually added FCKEditor afterwards.

It is the default FCK Editor behaviour to add these 'rn's, which are annoying to say the least. The free downloadable version of Proforma v0.1 on this website contains a slightly modified version of FCKEditor which does not have this problem.

Your best bet is to downlaod the full package from here
and then copy ONLY the fckeditor folder over to your current installation. That way, its easier to keep what you've already saved on your DB.

The other option, of course, is to upgrade to the Premium version which has none of these problems and a whole lot more features besides

Good Luck.

Nick
hanuman
Moderator
Posts: 369
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#342
Re:SQL Error when Saving A Page 2 Years, 3 Months ago  
Hmmm... I did download the package from this website, and used the edited FCK editor from the package...
jw18
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#343
Re:SQL Error when Saving A Page 2 Years, 3 Months ago  
Sorry for the confusion. You need to do two things.

1) Open catalog/admin/proforma.php

Find the line:

Code:


$oFCKeditor->Value = $arrdetail['content'];



and replace it with:

Code:


$oFCKeditor->Value = stripslashes($arrdetail['content']);



2) Open catalog/admin/includes/functions/proforma_data_access.php

find the lines:

Code:


if(!$arr_pf_query) {
tep_db_query("insert into " . TABLE_PF_CONTENT . " (pf_name, content) values ('" . tep_db_prepare_input($name) . "', '" . tep_db_prepare_input($content) . "')");
} else {
tep_db_query("update " . TABLE_PF_CONTENT . " set pf_name='" . tep_db_prepare_input($name) . "',content='" . tep_db_prepare_input($content) . "'" . " where pf_name= '" . $name . "'");
}



and replace them with:

Code:


if(!$arr_pf_query) {
tep_db_query("insert into pf_content (pf_name, content) values ('" . tep_db_prepare_input($name) . "', '" . $content . "')");
} else {
tep_db_query("update  pf_content set pf_name='" . tep_db_prepare_input($name) . "',content='" . $content . "'" . " where pf_name= '" . $name . "'");
}



This will fix the 'rn' problem.

By default, FCK Editor creates a new paragraph when you press Return in the editor. If you want to change this to a simple carriage return, do the following:

Open up catalog/admin/includes/fckeditor/fckconfig.js

Find the lines:

Code:


FCKConfig.EnterMode = 'p' ; // p | div | br
FCKConfig.ShiftEnterMode = 'br' ; // p | div | br



and REPLACE them with:

Code:


FCKConfig.EnterMode = 'br' ; // p | div | br
FCKConfig.ShiftEnterMode = 'p' ; // p | div | br



I'll update the package with these changes. Thanks again for persevering with this.

Nick
hanuman
Moderator
Posts: 369
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#344
Re:SQL Error when Saving A Page 2 Years, 3 Months ago  
Awesome! That did it... thanks so much for working that out and creating this contrib... it's something that was needed for OSc. Thanks again.
jw18
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1