Jump to content

Recommended Posts

hi i have stored in my database a url

say http://www.thisisatest.com

say i call it from the database

$sql = "SELECT * FROM tableInMysql;";

then i have

while
{

echo $sql

}

it echos http://www.thisisatest.com

but wat i want is, to remove the http://www. which i already have a function for and when the page says

index.php?letter=t

it will select the website cause it beggings with t

and echo

thisisatest.com

any ideas of how i can get the $sql to select the letter?

thanks...
Link to comment
https://forums.phpfreaks.com/topic/34805-using-first-letter/
Share on other sites

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 add

SELECT * FROM table WHERE wwwfield like 'http://www.t%' limit 1

if the "http://www." is not stored in the database then you can just say: where wwwfield like 't%'

Dave.
Link to comment
https://forums.phpfreaks.com/topic/34805-using-first-letter/#findComment-164039
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.