Grow your CSS skills. Land your dream job.

PHP $GET

  • # November 19, 2009 at 6:02 pm

    Hi People i was wondering if anyone could help me,

    I want to get a variable out of the address bar and use it with my database content selection as a hazardous guess i tried

    Code:
    $page = $GET['pages'];

    SELECT * FROM database WHERE title=’$page’

    Before anyone says I know this is totally wrong but worth a try!

    Any help would be greatfully appreciated, or someone to point me in the direction

    Thanks In advance

    Jonathan
    jonleesmith.co.uk

    # November 19, 2009 at 6:54 pm

    It’s $_GET and don’t forget to addslashes() to anything you using a database query.

    Code:
    $page = $_GET['pages'];

    SELECT * FROM database WHERE title=’ . addslashes($page) .’

    http://php.net/manual/en/reserved.variables.get.php
    http://uk3.php.net/manual/en/function.addslashes.php

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".