How to get urls from the database to go to the social networks

some how this script is not letting me to go out the root to access outside url can some one help me out or point me where im going wrong.

$sql = 'SELECT * 
		FROM social';
											
		$query = mysqli_query($conn, $sql);

		if (!$query) {
			die ('SQL Error: ' . mysqli_error($conn));
		}
		
		while ($row = mysqli_fetch_array($query))
		{
										
			echo '<li><a href="'.$row['social_url'].'/'.$row['social_name'].'" target="blank"><i class="fa  '.$row['social_icon'].'"></i></a></li>';

										
		}
	?> 

Can you describe a bit more detail on what it’s not doing that it should? It seems as if it create a URL based on the information coming out of the query though I’m a bit rusty on HTML and not exactly sure what it will display inside the <a> tags.

@droopsnoot Thanks for your time for trying to help me out with this . its simple i want to create a link based on the user fed information from the database eg. social_url is facebook.com and the ‘social_name’ would be the username xyz, here what i’m looking for is it should execute something like this www.facebook.com/xyz but thats not happening in my case, the execution is like this 192.168.1.101/www.facebook.com/xyz wherein its an invalid link.

That looks like an IP address at the beginning of your URL.
What does the data for social_url look like in the actual database?

www. facebook .com this how it will be

What have you in your database for social_url it looks like either your social_url is 192.168.1.101/www.facebook.com/xyz or your name is facebook.com/wfdtech

got it fixed thanks

What was the problem and fix?

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.