Jump to content

Recommended Posts

I'm kind of a beginner so bear with me here.  Ive just created an Administrative Control Panel for a site and also set up most of the front end code to pull up the info onto the page.  But I'm having a small problem with my links, when called they don't display as a link but just as plain text.  Here's my base code if anyone knows what you add to preserve the URL when calling it up.

 

<?php

// open connection to MySQL server

$connection = mysql_connect('localhost', 'guest', 'tQIfkRS3')

or die ('Unable to connect!');

 

// select database for use

mysql_select_db('guest') or die ('Unable to select database!');

 

// create and execute query

$query = 'SELECT * FROM links';

$result = mysql_query($query)

or die ('Error in query: $query. ' . mysql_error());

 

// check if records were returned

if (mysql_num_rows($result) > 0)

{

// iterate over record set

// print each field

while($row = mysql_fetch_row($result))

{

 

echo $row[0] . " - " . $row[1] . "\n";

}

}

else

{

// print error message

echo 'No rows found!';

}

 

// once processing is complete

// free result set

mysql_free_result($result);

 

// close connection to MySQL server

mysql_close($connection);

?>

Link to comment
https://forums.phpfreaks.com/topic/131148-database-url-issue/
Share on other sites

Ok ill clarify.  The control panel submits the "name" and "url" to the database.  I need a code that will bring them all up correctly on the web page, and not with specific <a href> tags because the links will be ever changing.  And bring them up as links, and not text.

Link to comment
https://forums.phpfreaks.com/topic/131148-database-url-issue/#findComment-680949
Share on other sites

Ok ill clarify.  The control panel submits the "name" and "url" to the database.  I need a code that will bring them all up correctly on the web page, and not with specific <a href> tags because the links will be ever changing.  And bring them up as links, and not text.

Is your DB query working? Because this sounds like a PHP issue.

Link to comment
https://forums.phpfreaks.com/topic/131148-database-url-issue/#findComment-681452
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.