Jennmc75 Posted May 28, 2010 Share Posted May 28, 2010 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 More sharing options...
.Stealth Posted May 28, 2010 Share Posted May 28, 2010 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"); Link to comment https://forums.phpfreaks.com/topic/203193-url-adds-a-making-it-invalid/#findComment-1064625 Share on other sites More sharing options...
-Karl- Posted May 28, 2010 Share Posted May 28, 2010 $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/#findComment-1064626 Share on other sites More sharing options...
.Stealth Posted May 28, 2010 Share Posted May 28, 2010 The hell happened to mine Link to comment https://forums.phpfreaks.com/topic/203193-url-adds-a-making-it-invalid/#findComment-1064627 Share on other sites More sharing options...
Jennmc75 Posted May 28, 2010 Author Share Posted May 28, 2010 Thanks for your suggestion but it didn't work either. I'm really starting to wonder if I'm not going to be able to have that link work. Link to comment https://forums.phpfreaks.com/topic/203193-url-adds-a-making-it-invalid/#findComment-1064682 Share on other sites More sharing options...
jdavidbakr Posted May 28, 2010 Share Posted May 28, 2010 It's not in the table with the quote, is it? Link to comment https://forums.phpfreaks.com/topic/203193-url-adds-a-making-it-invalid/#findComment-1064820 Share on other sites More sharing options...
Jennmc75 Posted May 28, 2010 Author Share Posted May 28, 2010 I just checked and the field in the table is an auto-increment. No special characters. Link to comment https://forums.phpfreaks.com/topic/203193-url-adds-a-making-it-invalid/#findComment-1064821 Share on other sites More sharing options...
jdavidbakr Posted May 28, 2010 Share Posted May 28, 2010 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>"; Link to comment https://forums.phpfreaks.com/topic/203193-url-adds-a-making-it-invalid/#findComment-1064824 Share on other sites More sharing options...
Jennmc75 Posted May 28, 2010 Author Share Posted May 28, 2010 That worked! Thank you so much! Link to comment https://forums.phpfreaks.com/topic/203193-url-adds-a-making-it-invalid/#findComment-1064836 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.