new_england Posted January 23, 2009 Share Posted January 23, 2009 I am pulling my hair out trying to add an email link into this query. I almost had it, but it seems to link everything from email down and without the email address being linked. This is NOT the same question I had before if someone is wondering why I started a new thread. This is completely a different link issue. Here's my query and you'll see email half way through the string. Oh, and you're probably wondering why I mingled html in the CONCAT query. Long story!!! Here's the string and thanks $query = "SELECT CONCAT(yacht_name, '<p><br><b>Position:</b></p> ', position, '<p><br><b>Motor or Sail:</b></p> ', motor_sail, '<p><br><b>Length of Yacht:</b></p> ', length, '<p><br><b>Salary:</b></p> ', salary, '<p><br><b>Location:</b></p> ', location, '<p><br><b>Start Date:</b></p> ', start_date, '<p><br><b>Comments:</b></p> ', comments, '<td valign=top><p><br><b>Name of Contact:</b></p> ', name_contact, '<p><br><b>Phone 1:</b></p> ', phone_1, '<p><br><b>Phone 2:</b></p> ', phone_2, '<p><br><b>E-Mail:</b></p> ', email, '<p><br><b>Ticket(s) Required:</b></p> ', ticket, '<p><br><b>Position Filled:</b></p> ', position_filled, '<p><br><b>Date Registered:</b></p> ', DATE_FORMAT(registration_date, '%d %M %Y')) FROM users WHERE user_id=$id"; Link to comment https://forums.phpfreaks.com/topic/142157-adding-a-link-in-this-concat-query-mingled-with-html/ Share on other sites More sharing options...
gevans Posted January 23, 2009 Share Posted January 23, 2009 It would make far more sense with something this size to pull each field out individually and build it outside the query Link to comment https://forums.phpfreaks.com/topic/142157-adding-a-link-in-this-concat-query-mingled-with-html/#findComment-744822 Share on other sites More sharing options...
new_england Posted January 24, 2009 Author Share Posted January 24, 2009 Hi. Thanks for your reply. I tried to do that, and it is fouled up. It's most annoying. Other than that the script runs fine Link to comment https://forums.phpfreaks.com/topic/142157-adding-a-link-in-this-concat-query-mingled-with-html/#findComment-744933 Share on other sites More sharing options...
xtopolis Posted January 24, 2009 Share Posted January 24, 2009 $query = "SELECT yacht_name, position, motor_sail, length, salary, location, start_date, comments, name_contact, phone_1, phone_2, email, ticket, position_filled, DATE_FORMAT(registration_date, '%d %M %Y') FROM users WHERE user_id=$id;" $result = mysql_query($query) or die(mysql_error()); while(list($yacht_name, $position, $motor_sail, $length, $salary, $location, $start_date, $comments, $name_contact, $phone_1, $phone_2, $email, $ticket, $position_filled, $regDate) = mysql_fetch_array($result)){ echo "$yacht_name"; echo "<p><br><b>Position: $position</b></p>"; echo "<p><br><b>Motor or Sail: $motor_sail</b></p>"; echo "<p><br><b>Length of Yacht: $length</b></p>"; echo "<p><br><b>Salary: $salary</b></p>"; echo "<p><br><b>Location: $location</b></p>"; echo "<p><br><b>Start Date: $start_date</b></p>"; echo "<p><br><b>Comments: $comments</b></p>"; echo "<td valign=top><p><br><b>Name of Contact: $name_contact</b></p>"; echo "<p><br><b>Phone 1: $phone_1</b></p>"; echo "<p><br><b>Phone 2: $phone2</b></p>"; echo "<p><br><b>E-Mail: $email</b></p>"; echo "<p><br><b>Ticket(s) Required: $ticket</b></p>"; echo "<p><br><b>Position Filled: $position_filled</b></p>"; echo "<p><br><b>Date Registered: $regDate</b></p>"; } Something like that would probably work. I'm pretty sure you're using CONCAT() incorrectly, and it made me cry to look at all that HTML in the MYSQL query. If you use my example, you can fix the HTML to be however you want, I just formatted it that way. Link to comment https://forums.phpfreaks.com/topic/142157-adding-a-link-in-this-concat-query-mingled-with-html/#findComment-745035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.