Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post

    triple nested quotes?

    this seams really simple but I can't figure it out.

    I have the following code:

    Code:
    $mess = "Welcome to Money4Every1! If you would like to learn how to use our site, you can visit the tutorial found here - <a href='http://money4every1.net/offer101.php'>http://money4every1.net/offer101.php</a>"; //welcome message to site users. This message gets sent to a users inbox when they login.
    and it takes the $mess and puts it inside this:

    Code:
    $msg = mysql_query("INSERT INTO `messages` (`to`, `from`, `subject`, `message`, `status`, `date`) VALUES(\"$u\", 'admin', 'Welcome', '$mess', 'unread', '$date')");
    and I think because i have HTML inside my $mess it isn't sending correctly.. help?

    do i just put \' for the a href?
    Last edited by markman641; 11-12-2011 at 11:01 PM.

  • #2
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post
    yep, figured it out. just had to put

    Code:
    <a href=\'http://money4every1.net/offer101.php\'>

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    You are better off using mysql_real_escape_string rather than hard coding the backslashes as then you don't have to strip the backslashes out later.

    Even better would be to use prepare/bind to separate the data from the query and then you wouldn't have triple nested quotes any more.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •