Jump to content

Query based on URL


bravo14

Recommended Posts

Hi Guys

 

I have the following code

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include('includes/connect.php'); 

$sql=("SELECT * FROM `tbl_pages` WHERE `page_address_identifier` = '" . mysql_real_escape_string(intval($_GET['page_id'])) . "' LIMIT 1");
echo $sql;
$result=mysql_query($sql);
if(mysql_num_rows($result)==0) {
die("No record found");
}
$row = mysql_fetch_array($result);
?> 

 

from the following url

http://79.170.44.125/platinumbrides.co.uk/page.php?page_id=events

 

The following query is then perfromed,

SELECT * FROM `tbl_pages` WHERE `page_address_identifier` = '0' LIMIT 1 b

 

I cannot see where the 0 is coming from

 

Any ideas what I have done wrong?

Link to comment
Share on other sites

0 comes from intval() this function return integer if passed variable can be converted into integer number or 0 on failure.

 

Your $_GET['page_id'] is not a number is a string "events" so somewhere in your code instead some id u printing "events" as url parameter

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.