Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
| Search | Today's Posts | Mark Forums Read
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 December 4th, 2007, 07:07 AM
Registered User
Join Date: Dec 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning PHP5 (mysql_query) question


This may be a daft question but I'm just beginning AMP. I'm working my way though Beginning PHP.Apache,MySQL Web Dev book. I'm on chapter 4, page 114. I'm just trying to figure out why the $link var is in '$result = mysql_query($query, $link) or die(mysql_error());'code? See example below:

$link = mysql_connect("localhost","root","") or die(mysql_error());
     mysql_select_db("moviesite") or die (mysql_error());

$query = "SELECT movie_id, movie_name,movie_director,movie_leadactor

     $result = mysql_query($query, $link) or die(mysql_error());

The code works OK with the $link removed from the mysql_query code.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning PHP5 - Code Solutions? SM BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 March 22nd, 2009 10:25 AM
Chapter 16 Beginning php5, apache, mysql, web dev charlie2450 Beginning PHP 1 September 13th, 2008 02:07 AM
mysql_query rajuru PHP Databases 10 October 29th, 2004 11:10 AM
Beginning C# Databases question BrentZ Forum and Wrox.com Feedback 1 November 4th, 2003 11:34 AM

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