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 77963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:54:46+00:00 2026-05-10T20:54:46+00:00

I am working on my website, and I am trying to get the url

  • 0

I am working on my website, and I am trying to get the url parameter ‘page’ which is an integer that tells which entry to read in the MySQL database that hols the HTML for all the pages. Here is my code, with the MySQL username and password removed for security reasons:

  if ($_GET['page']) {   $con = mysql_connect('localhost','username','password');   if (!$con)   {     die('Could not connect: ' . mysql_error());   }   mysql_select_db('jmurano_pages', $con);   $title=mysql_query('SELECT title FROM pageContent WHERE pageID=' . $_GET['page']);   echo '<title>' . $title . '</title>\n';   echo '</head>\n';   echo '<body>\n';   $content = mysql_query('SELECT content FROM pageContent WHERE pageID=' . $_GET['page']);   echo $content;   echo '\n</body>\n</html>'; } 

This puts the title as ‘Resource id #2’ and the content as ‘Resource id #3’. I can’t think of what I may have done wrong.


I’m still confused. I’m a complete PHP newbie. What exactly do I need to do to access the content and title?

  • 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. 2026-05-10T20:54:46+00:00Added an answer on May 10, 2026 at 8:54 pm

    Apart from the injection vulnerability (see John’s answer) you should get the title from the mysql_query using

     $res = mysql_query('SELECT title FROM pageContent WHERE pageID=' . $escapedpage);  $title = mysql_fetch_assoc($res);  $title = $title['title']  $res2 = mysql_query('SELECT content FROM pageContent WHERE pageID=' . $escapedpage);  $content = mysql_fetch_assoc($res2);  $content = $content['content']; 

    However I think it would be wise if you would follow an online mysql php tutorial.

    EDIT
    even better would be to just use 1 mysql_query like so:

    $res = mysql_query('SELECT title, content FROM pageContent WHERE pageID=' . $escapedpage); $row = mysql_fetch_assoc($res); $title = $row['title']; $content = $row['content']; 

    That would save your script time and resources since there is only need for one mysql query.
    This tutorial is rather good: http://www.freewebmasterhelp.com/tutorials/phpmysql

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

Sidebar

Ask A Question

Stats

  • Questions 78k
  • Answers 78k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Charlie Martin gives you a good dissection and explanation of… May 11, 2026 at 3:41 pm
  • added an answer I think what you mean to ask is: How does… May 11, 2026 at 3:41 pm
  • added an answer barrier_create(*test_barrier_p); Since barrier_create takes address of a barrier_p, this should… May 11, 2026 at 3:41 pm

Related Questions

Preamble So, this question has already been answered, but as it was my first
Background I am writing and using a very simple CGI-based (Perl) content management tool
I am trying a straightforward remote json call with jquery. I am trying to
I joined a new company about a month ago. The company is rather small

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.