Jump to content

Database URL Issue


Allenj713

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

Archived

This topic is now archived and is closed to further replies.

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