Jump to content

URL adds a ' making it invalid


Jennmc75

Recommended Posts

I've been working on adding a direct link in an automated email.  For some reason the url link adds a ' and makes the link invalid.  I can't figure out why the ' is added.

 

The link comes back like http://www.twcslibrary.com/user.php?action=revres&reviewid='revid

when I want it to be http://www.twcslibrary.com/user.php?action=revres&reviewid=revid

$mailquery= dbquery("SELECT ap.newreviews,"._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$author' ".(!empty($coauthors) ? " OR ".findclause(_UIDFIELD, $coauthors) : ""));
			while($mail = dbassoc($mailquery)) {
				if($mail['newreviews']) {
					include_once("includes/emailer.php");
					$subject = _REVEMAIL1.$title;
					 $mailtext = sprintf(_REVEMAIL2, "type=$type&item=$item", $review);
					//$mail['email'] = '[email protected]';
					$gname = $_SESSION[usrname];
					//echo $mailtext."mail text is there";
					//echo $substitute= substr($mailtext,50);
					//echo "select reviewid from " .TABLEPREFIX."fanfiction_reviews where review ='$review' && reviewer = '$gname' order by reviewid DESC"; 
					 $qry= dbquery("select reviewid from " .TABLEPREFIX."fanfiction_reviews where review ='$review' && reviewer = '$gname' order by reviewid DESC");
					$qry1 = dbrow($qry);
					 $revid = $qry1['reviewid'];
					$str = "<b>A review from"." ".$_SESSION[usrname]."</b><br>";
					 $mailtext= $str.$mailtext;
					 $revreply = "<br><br> Review can be responded <a href=http://www.twcslibrary.com/user.php?action=revres&reviewid='$revid'>by clicking here</a>";
					  $mailtext = $mailtext.$revreply;
					 $result = sendemail($mail['penname'], $mail['email'], $sitename, $siteemail, $subject, $mailtext, "html");

Link to comment
https://forums.phpfreaks.com/topic/203193-url-adds-a-making-it-invalid/
Share on other sites

Try that.

 

$mailquery= dbquery("SELECT ap.newreviews,"._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$author' ".(!empty($coauthors) ? " OR ".findclause(_UIDFIELD, $coauthors) : ""));









while($mail = dbassoc($mailquery)) {











if($mail['newreviews']) {













include_once("includes/emailer.php");













$subject = _REVEMAIL1.$title;













$mailtext = sprintf(_REVEMAIL2, "type=$type&item=$item", $review);













//$mail['email'] = '[email protected]';













$gname = $_SESSION[usrname];













//echo $mailtext."mail text is there";













//echo $substitute= substr($mailtext,50);













//echo "select reviewid from " .TABLEPREFIX."fanfiction_reviews where review ='$review' && reviewer = '$gname' order by reviewid DESC"; 













$qry= dbquery("select reviewid from " .TABLEPREFIX."fanfiction_reviews where review ='$review' && reviewer = '$gname' order by reviewid DESC");













$qry1 = dbrow($qry);













$revid = $qry1['reviewid'];













$str = "<b>A review from"." ".$_SESSION[usrname]."</b><br>";













$mailtext= $str.$mailtext;













$revreply = "<br><br> Review can be responded <a href=http://www.twcslibrary.com/user.php?action=revres&reviewid=" . $revid . " '>by clicking here</a>";













  $mailtext = $mailtext.$revreply;













$result = sendemail($mail['penname'], $mail['email'], $sitename, $siteemail, $subject, $mailtext, "html");

   $mailquery= dbquery("SELECT ap.newreviews,"._EMAILFIELD." as email, "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$author' ".(!empty($coauthors) ? " OR ".findclause(_UIDFIELD, $coauthors) : ""));
                while($mail = dbassoc($mailquery)) {
                    if($mail['newreviews']) {
                        include_once("includes/emailer.php");
                        $subject = _REVEMAIL1.$title;
                         $mailtext = sprintf(_REVEMAIL2, "type=$type&item=$item", $review);
                        //$mail['email'] = '[email protected]';
                        $gname = $_SESSION[usrname];
                        //echo $mailtext."mail text is there";
                        //echo $substitute= substr($mailtext,50);
                        //echo "select reviewid from " .TABLEPREFIX."fanfiction_reviews where review ='$review' && reviewer = '$gname' order by reviewid DESC"; 
                         $qry= dbquery("select reviewid from " .TABLEPREFIX."fanfiction_reviews where review ='$review' && reviewer = '$gname' order by reviewid DESC");
                        $qry1 = dbrow($qry);
                         $revid = $qry1['reviewid'];
                        $str = "<b>A review from"." ".$_SESSION[usrname]."</b><br>";
                         $mailtext= $str.$mailtext;
                         $revreply = "<br><br> Review can be responded <a href='http://www.twcslibrary.com/user.php?action=revres&reviewid=".$revid."'>by clicking here</a>";
                          $mailtext = $mailtext.$revreply;
                         $result = sendemail($mail['penname'], $mail['email'], $sitename, $siteemail, $subject, $mailtext, "html");

Just looked more closely at your code - you're opening the $revreply assignment with a double-quote, and then putting single-quotes around the variable.  The double-quote aren't terminated by the single quotes.  Try this:

 

$revreply = "<br><br> Review can be responded <a href='http://www.twcslibrary.com/user.php?action=revres&reviewid=$revid'>by clicking here</a>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.