brown2005 Posted January 18, 2007 Share Posted January 18, 2007 hi i have stored in my database a urlsay http://www.thisisatest.comsay i call it from the database$sql = "SELECT * FROM tableInMysql;";then i havewhile{echo $sql}it echos http://www.thisisatest.combut wat i want is, to remove the http://www. which i already have a function for and when the page saysindex.php?letter=t it will select the website cause it beggings with tand echothisisatest.comany ideas of how i can get the $sql to select the letter?thanks... Quote Link to comment https://forums.phpfreaks.com/topic/34805-using-first-letter/ Share on other sites More sharing options...
Crimpage Posted January 18, 2007 Share Posted January 18, 2007 How many websites will be in the database that start with t? or any particular letter.Your sql would want to look like this.SELECT * FROM table WHERE wwwfield like 'http://www.t%'If you only want 1 result then you would addSELECT * FROM table WHERE wwwfield like 'http://www.t%' limit 1if the "http://www." is not stored in the database then you can just say: where wwwfield like 't%'Dave. Quote Link to comment https://forums.phpfreaks.com/topic/34805-using-first-letter/#findComment-164039 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.