iarp Posted May 12, 2008 Share Posted May 12, 2008 Hey, function links() { $query = "SELECT config_value FROM " . TBL_CONFIG . " WHERE config_name='site_location'"; $result = mysql_query($query); $row = mysql_fetch_array($result, MYSQL_ASSOC); echo "/" . $row['site_location'] . "/"; } Website coding: echo '<a href="' . links() . 'test.php">Test</a>'; The only outcome i get from that is // Test on the page itself. Oops i forgot one part. function login(){ echo '<a href="./index.php">Home</a><br />'; if (isset($_SESSION['user_id']) AND (substr($_SERVER['PHP_SELF'], -10) != 'logout.php')) { echo '<a href="./logout.php">Logout</a><br /> <a href="./admin/profile.php">Profile</a><br /> <a href="./admin/">Admin Panel</a><br />'; if ($_SESSION['userlevel'] >= 9) { echo '<a href="/todo.php">To do list</a><br /> <a href="./admin/view_users.php">View Users</a><br />'; } } else { // Not logged in. echo ' <a href="register.php">Register</a><br /> <a href="' . links() . 'login.php">Login</a><br /> <a href="forgot_password.php">Forgot Password</a><br /> '; } } thats another function that also calls links() and it doesn't work eithor. Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 12, 2008 Share Posted May 12, 2008 Um, your query is only returning the value for the 'config_value' column and then you are trying to reference the 'site_location' value. change the query to return the value you actually want to use. <?php function links() { $query = "SELECT site_location FROM " . TBL_CONFIG . " WHERE config_name='site_location'"; $result = mysql_query($query); $row = mysql_fetch_array($result, MYSQL_ASSOC); echo "/" . $row['site_location'] . "/"; } ?> Quote Link to comment Share on other sites More sharing options...
iarp Posted May 12, 2008 Author Share Posted May 12, 2008 I figured it out, maybe it was because i was on my laptop and slightly distracted, but $row['site_location'] should have been $row['config_value']; all works now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.