Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7665931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:42:16+00:00 2026-05-31T14:42:16+00:00

<?php //Sessions starten session_start(); //Include stuff include(‘conf.php’); //’Shortcuts’ maken $sname = $site[‘name’]; $shost =

  • 0
<?php
//Sessions starten
session_start();
//Include stuff
include('conf.php');
//'Shortcuts' maken
$sname = $site['name'];
$shost = $site['host'];
$shostb = $site['hostb'];
//Verbinding maken met DB
$link = mysql_connect($database['host'], $database['username'], $database['password']) or die (mysql_error());
mysql_select_db($database['db'],$link) or die(mysql_error());
//Gegevens uit db halen
if(isset($_GET['page'])){
    $page['title'] = mysql_query("SELECT title FROM pages WHERE page = $_GET[page]");
}
else{
    $page['title'] = mysql_query("SELECT title FROM pages WHERE page = 'index.php'");
}
?>
<!doctype html>
<html lang="nl">
<head>
    <meta charset="utf-8" />
    <title><?php echo $sname;?>•<?php echo $page['title']?></title>

Does somebody know why this doesn’t work? My DB structure is:

page |title

index.php|index

Sorry but I can’t get this clear. The var dump of $page['title'] = resource(5) of type (mysql result). How can I fix this? Thanks for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:42:18+00:00Added an answer on May 31, 2026 at 2:42 pm

    mysql_query returns a resource, you need to use mysql_fetch_array (or similar, e.g. mysql_fetch_assoc) on the resource to get the title value.

    For example:

    $res = mysql_query("SELECT title FROM pages WHERE page = 'index.php'");
    $page = mysql_fetch_assoc($res);
     
    // $page['title'] now contains the value (assuming there's an index.php page in the DB).
    

    Warning: your query is vulnerable to SQL injection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How secure are php Sessions? I am planning to use the native PHP sessions
How can I use a database and PHP sessions to store a user's shopping
Is it possible to configure PHP sessions to never expire? I currently have the
I am looking for a way to maintain PHP sessions across multiple domains on
Sessions in PHP seemed to have changed since the last time I used them,
I'm trying to do a simple test php script for sessions. Basically it increments
I've been working with sessions, MVC design and object oriented PHP. Where should I
I have not changed any of the configuration options for sessions in my php.ini.
I have a Rails application that uses ActiveRecordStore for sessions. I need a PHP
I have a very simple test page for PHP session. <?php session_start(); if (isset($_SESSIONS['views']))

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.