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

  • SEARCH
  • Home
  • 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 4346126
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:07:54+00:00 2026-05-21T12:07:54+00:00

I have a test page I am playing around with and maybe it is

  • 0

I have a test page I am playing around with and maybe it is just too early in the morning, but I seem to be running into something strange:

I have this url:
http://www.comehike.com/outdoors/trip_story.php?hike_id=108

to log in
login: test@comehike.com
password: password

I do this to get the hike_id parameter:

$hike_id = mysql_real_escape_string($_GET['hike_id']);
$errors = array();
if ( isset ( $hike_id ) && !empty ($hike_id)  )
{
   $errors[] = 'Hike id was empty.  Could not get the hike information';
}

But the hike id is 0 as is shown later on the page when I output things to the screen. So since the hike_id is 0, it passes that validation test which is a bug. Any idea why that would happen since the hike_id that is passed is 108?

  • 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-21T12:07:55+00:00Added an answer on May 21, 2026 at 12:07 pm

    You have a flaw on your logic. what your if statement really asks is this:

    “if $hike_id as set, and is not empty, throw an error”

    0 is empty and so your statement wont throw an error. Try with another value, for example 1, and see what happens.

    In addition, why do you use mysql_real_escape_string there? Wait with escaping until you use the value in a SQL query. Note that mysql_real_escape_string requires an active connection to the database, otherwise it will return false (which is interpreted as zero in numeric context; maybe that’s why 108 is converted to 0?)

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

Sidebar

Related Questions

I have this test page [edited by poster after question was answered] and something
We have been playing around with the canvas element, but are encountering sluggishness on
I'm playing around with an iframe that embeds a second page and just displays
I've been playing around with postMessage just to have a better understanding of how
I'm just playing around with JSP. I just wanted to test some <jsp:useBean> stuff,
I'm just playing around with jqGrid this afternoon, and have it working fairly well
Note: I'm using Google Chrome Currently I have this test page http://www.evecakes.com/doodles/canvas_size_issue.htm It should
I have a very simple test page for PHP session. <?php session_start(); if (isset($_SESSIONS['views']))
I am setting up a simple test page in Python. I only have two
I have a Test Class, that test the access of all page with different

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.