Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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 September 14th, 2006, 08:49 PM
Registered User
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Undefined variable

while ($row = mysql_fetch_array($result)){
    $Part_Number= $row['Part_Number'];
  $Mask_Set= $row['Mask_Set'];
  $Released_Product = $row['Released_Product'];
  $display_block .= "

    <tr><td><a href='sDetails_byid.php?Part_Number=$Part_Number'> $Part_Number</a></td><td>$Released_Product</td><td>$Mask_Set</td>
    </tr>";

the error mistake is "Undefined variable: display_block in c:\easyphp1-8\easyphp1-8\www\staff_id.php on line 38"

i am a beginner hope to get solution here thanks

 
Old October 31st, 2006, 06:07 PM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey adel_88,

Can you post all of your code ? (especially lines 37-39!)

Cheers

--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com
 
Old July 9th, 2007, 03:21 PM
Registered User
 
Join Date: Oct 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

$display_block is followed by .=
The period means that the value in the variable will be appended. In the while loop the parser generates an error since the variable has not yet been assigned. On my machine the code still worked as it should.
To get rid of the error message assign the variable a null text string value before the loop.

$display_block = ""
while ($row = mysql_fetch_array($result)) {

Namaste,

Kevin Tough






Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined Variable aspire Beginning PHP 4 July 12th, 2006 07:00 AM
Undefined variable najib Beginning PHP 4 July 1st, 2005 08:12 AM
undefined variable !! cody44 Beginning PHP 3 January 20th, 2005 05:47 PM
Undefined Variable fpolan Beginning PHP 9 July 15th, 2004 06:24 AM
Undefined Variable Some Help! knight Beginning PHP 7 February 19th, 2004 07:07 AM





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