Jump to content

Problem with returning values from db


PHPiSean

Recommended Posts

Here's my code

 

<?php session_start(); ?>
<head>
    <link rel="stylesheet" href="includes/css/style.css" type="text/css"/>
    <link rel='stylesheet' href='includes/css/reset.css' type="textcss"/>
    <title>TestStore</title>
</head>

<?php
require('db.inc.php');

$sql = mysql_query("select * from top_links where id > '1'");

echo "<ul>";
echo "<li><a href='http://test.net'>Test</li>";

while(mysql_fetch_array($sql)) {
    $s_name = $sql['name'];
    $s_link = $sql['url'];  
    
        echo "<li><a href='$s_link'>$s_name</a></li>";

}

echo "</ul>";


?>

 

It returns the "Test" I defined, but the query will only returned the bullet points, but not the text nor the url. I looked at my table configuration everything looks right. The column names were "id", "url", and "name". Thanks for the help!

Link to comment
https://forums.phpfreaks.com/topic/244474-problem-with-returning-values-from-db/
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.