Bradley_James Posted May 28, 2011 Share Posted May 28, 2011 My website is built, and it allows users to input three things, two of which are generic text, and one of which is a link to their website/Facebook page/etc. My question is that I've got it set up where someone may go to my site, search for someone who has inputed data (as said above), and it'll display that data. However, I want the first two sets of inputted information to display as regular text, and the website URL to be clickable when displayed. In my PHP code, is this solved by having that third text field something other than "varchar" or is it an entirely different line of code? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/ Share on other sites More sharing options...
fugix Posted May 29, 2011 Share Posted May 29, 2011 why dont you simply wrap the third the third text field in anchor tags as each one is drawn out of the db? Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1221757 Share on other sites More sharing options...
Bradley_James Posted May 29, 2011 Author Share Posted May 29, 2011 What would the anchor tags be specifically? Isn't the code you posted "<ul>" a list tag? What would be a tag to change the text to an active URL? Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1221846 Share on other sites More sharing options...
Bradley_James Posted May 29, 2011 Author Share Posted May 29, 2011 echo "<td>" . $row['website'] . "</td>"; That's the line the search posts in the fetch array when a user types in anything into the search bar, and I want 'website' to be the active link always. Where do I post the code? Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1221876 Share on other sites More sharing options...
fugix Posted May 29, 2011 Share Posted May 29, 2011 I didn't post any code. The code I have is simply part of my signature. Echo "<td><a href=''>".$row['website']."</a></td> Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1221903 Share on other sites More sharing options...
fugix Posted May 29, 2011 Share Posted May 29, 2011 And actually you would want your $row['website'] to be your href. Just make sure to add http:// if it doesn't have it already Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1221907 Share on other sites More sharing options...
Bradley_James Posted May 29, 2011 Author Share Posted May 29, 2011 That works! Thanks a million man! Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1221948 Share on other sites More sharing options...
Bradley_James Posted May 29, 2011 Author Share Posted May 29, 2011 Ahh jeez, the fun just doesn't stop! I'm getting the following error when I type out what you gave me. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/vhosts/practice-space.6te.net/search.php on line 48 Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1221955 Share on other sites More sharing options...
fugix Posted May 29, 2011 Share Posted May 29, 2011 im guessing that this occurs when you assign $row['website'] to you href...you either need to wrap it in curly brackets eg {$row['website'] } or assign it to a variable e.g $website = $row['website'] ; then use $website in your href instead of $row['website'] Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1222027 Share on other sites More sharing options...
Bradley_James Posted May 30, 2011 Author Share Posted May 30, 2011 Alright it officially works, thanks again! But I also appreciate your patience with my SQL/PHP incompetence; for I have ONE MORE question. Now that users can post, I guess I never really figured out how to add a "delete" feature to the posts, where they can push "delete" and delete their post if they did it incorrectly. Again, thank you; I'm just a fun bundle of questions. Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1222346 Share on other sites More sharing options...
fugix Posted May 30, 2011 Share Posted May 30, 2011 Yocan assign a button to run code when clicked. Using a delete clause found http://dev.mysql.com/doc/refman/5.0/en/delete.html Quote Link to comment https://forums.phpfreaks.com/topic/237734-simple-sql-help/#findComment-1222538 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.