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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:35:52+00:00 2026-06-07T02:35:52+00:00

I will be sending a request to the PHP code through a GET request.

  • 0

I will be sending a request to the PHP code through a GET request. it will have several parameters passed. I will be using these parameters in the WHERE clause of my select statement.

GET REQUEST

http:// localhost/server/person.php?Id=1&age=12&hieght=100

PHP code

<?php
$connection = mysql_connect("localhost","user","pwd");
if (!$connection )
  {
  die('FAIL: ' . mysql_error());
  }
mysql_select_db("db", $connection );
$result = mysql_query("SELECT * FROM Person where hieght='$_GET[hieght]");
$num_rows = mysql_num_rows($result);
?>

i think my PHP code is wrong. I am not sure if this is the way to grab variables from a GET request.

  • 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-06-07T02:35:54+00:00Added an answer on June 7, 2026 at 2:35 am

    To get a variable from $_GET use, as an example to get height from $_GET array you can write

    $height=$_GET['height'];
    

    so you can write

    $result = mysql_query("SELECT * FROM Person where hieght='".$hieght."'");
    

    or you can write

    $result = mysql_query("SELECT * FROM Person where hieght='".$_GET['height']."'");
    

    Update:

    Use mysql_real_escape_string to prevent sql injection, like

    $height=$_GET['height'];
    $result = mysql_query("SELECT * FROM Person where hieght='".mysql_real_escape_string($hieght)."'");
    

    or

    $result = mysql_query("SELECT * FROM Person where hieght='".mysql_real_escape_string($_GET['height'])."'");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP code that will return a image. the link is given
I'm working towards sending an XML request to a URL using cURL in PHP.
Will be sending out e-mails from an application on a scheduled basis. I have
I am writing a nodejs application that will be sending html e-mail using emailjs
When I send html message through an mail sending it will break the design
Possible Duplicate: Sending large files reliably in PHP I will be distributing a PHP
I'm sending an email using javascript. It will be sent via outlook but I
I have got following code witch are sending xml file on HTTP protocol and
i have a javascript code that requests a php page to provide it with
In my test.php file, I sent a request to a Flickr app I have

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.