Wrox Programmer Forums
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 15th, 2005, 03:52 PM
Registered User
Join Date: Nov 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default help needed!

Hi all folks, in this query code from chapter 6 (Beginning Php,apache,Mysql web development), what is the meaning of : '".$_GET['id']."' (I know the meaning of the $_GET array,but why I need the symbols '". ."' ?)

chapter code:
$moviesql = "SELECT * FROM `movie` (why I need the backticks?)
    WHERE `movie`.`movie_id`= '".$_GET['id']."' ";


Old November 16th, 2005, 06:56 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul

Well you write query in string variable, hence in quotes. . i.e., dot is used in string concatenation.

In WHERE clause of SQL, you need put argument in single quotes like id='$id'

In your example, $GET[] variables are joined to SQL query using .. However, PHP can keep value of $ variables in string also, so you may remove dots to make your query easy to understand:

$moviesql = "SELECT * FROM movie WHERE movie.movie_id = '$_GET[\'id\']'";

Backticks ` are not compulsory. Backslash \is used to escape a character (when placed before the character) like '

I hope you understood.

Support Indian students' finances http://scholarship.mediasworks.com/
Old November 16th, 2005, 11:51 AM
Registered User
Join Date: Nov 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

I'm confused but thanks for the post...!Best regards!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help needed ramabharti Javascript How-To 1 December 7th, 2006 06:42 AM
Help needed rrvinod ADO.NET 0 October 5th, 2006 09:44 AM
Help Needed php5 PHP How-To 1 January 15th, 2006 07:29 PM
A Little help needed matthew01 ASP.NET 1.0 and 1.1 Basics 3 November 9th, 2005 11:29 AM
help needed kfarooq Java Databases 1 June 27th, 2003 05:20 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.