Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 05:53
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Recent Tutorial Support
| |-+  Flash GuestBook Support (Moderators: Flash-db, vesa kortelainen, Ronald Wernecke, Mohsin Sumar, Jorge Solis)
| | |-+  Help with string handling
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Help with string handling  (Read 4660 times)
mooncat
Server what's that
*
Posts: 3


View Profile
« on: 04/06/08, 09:02 »

hello, great work on the guestbook, I really like it!

Just having a problem with apostrophes in the mysql code.  Im very new to mysql but I think

$comment = mysql_real_escape_string($rec['comment']);

might fix this but I dont know where to put it or if it'll work.

any help would be appreciated.

regards.
Logged
mooncat
Server what's that
*
Posts: 3


View Profile
« Reply #1 on: 04/09/08, 08:07 »

Just to clarify the flex2 guestbook doesnt work with apostropes. The amfphp is here;

Quote
<?php
 include_once("inc_sql.php");
class guestbooking{
    var $dbhost = HOSTNAME;
    var $dbname = DATABASE;
    var $dbuser = USERNAME;
    var $dbpass = PASSWORD;

    function guestbooking(){
       $this->conn = mysql_pconnect($this->dbhost, $this->dbuser, $this->dbpass);
        mysql_select_db ($this->dbname);
    }

    function requestPost($which_id){
       return mysql_query("select nombre,comment,imagen,extraurl from guestbook where _id='$which_id'");
    }

    function sendTitles(){
       return mysql_query("select titulo from guestbook");
    }

    function sendComment($wname,$wtitle,$wcomment,$url,$extraurl){
       mysql_query("insert into guestbook (nombre,titulo,comment,imagen,extraurl) values ('$wname','$wtitle','$wcomment','$url','$extraurl')");
       return mysql_query("select titulo from guestbook");
    }


so is it possible to insert

Quote
$comment = mysql_real_escape_string($rec['comment']);

will this allow apostrophes? and how can i insert it? apologies for the lack of basic php skills.
« Last Edit: 04/09/08, 12:21 by mooncat » Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #2 on: 04/09/08, 12:23 »

before you insert it into mysql, you have to addslashes.
Logged

happy flashing
Cool
Ronald
mooncat
Server what's that
*
Posts: 3


View Profile
« Reply #3 on: 04/09/08, 14:00 »

thanks Ronald, if I were to add apostropes to the "comment" row. how far off am I with this?

Quote
<?php
 include_once("inc_sql.php");
class guestbooking{
    var $dbhost = HOSTNAME;
    var $dbname = DATABASE;
    var $dbuser = USERNAME;
    var $dbpass = PASSWORD;
   
    function guestbooking(){
       $this->conn = mysql_pconnect($this->dbhost, $this->dbuser, $this->dbpass);
        mysql_select_db ($this->dbname);
    }

    function requestPost($which_id){
       return mysql_query("select nombre,comment,imagen,extraurl from guestbook where _id='$which_id'");
    }

    function sendTitles(){
       return mysql_query("select titulo from guestbook");
    }

    function sendComment($wname,$wtitle,$wcomment,$url,$extraurl){
       mysql_query("insert into guestbook (nombre,titulo,comment,imagen,extraurl) values ('$wname','$wtitle','$wcomment','$url','$extraurl')");
       return mysql_query("select titulo from guestbook");
    }
    function InsertString($wcomment)
        $st = addslashes($wcomment);

    }
}

I apreciate any time you can give to this.
« Last Edit: 04/09/08, 14:07 by mooncat » Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!