> -----Oorspronkelijk bericht-----
> Van: Davy Obdam [mailto:[EMAIL PROTECTED]] 
> Verzonden: woensdag 20 november 2002 17:39
> Aan: 'mike karthauser'
> Onderwerp: RE: [PHP-DB] substituting for $id with globals off (newbie)
> 
> 
> Hi Mike,
> 
> $result = mysql_query("SELECT * FROM address WHERE 
> id=".$_GET['id']."",$db);
> 
> This should work.
> 
> Best regards,
>  
> Davy Obdam
>  
> Obdam w e b d e s i g nC
> Webdesign, application and database development
> tel : +31(0)641 222 385
> mailto:[EMAIL PROTECTED]
> 
> 
> > -----Oorspronkelijk bericht-----
> > Van: mike karthauser [mailto:[EMAIL PROTECTED]]
> > Verzonden: woensdag 20 november 2002 17:18
> > Aan: [EMAIL PROTECTED]
> > Onderwerp: [PHP-DB] substituting for $id with globals off (newbie)
> > 
> > 
> > Hi, thanks for earlier replies regarding php resources. I am
> > currently hitting a brick wall on the script below due to my 
> > lack of understanding of php coupled with my lack of 
> > knowledge about globals.
> >  
> > I replaced $id with $_GET['id'] in line 5 which now allows
> > the user to reach the script to evaluate when presented with 
> > testpage.php?id=n. It now falls over when it tries to run the 
> > query part :
> > 
> > WHERE id=$id
> > 
> > I tried to submit this instance with $_GET['id'] in the query
> > which also fails. In the $_GET['id'] where is the value for 
> > id now stored? Can anyone see where i have gone wrong?
> > 
> > thanks
> > ---
> > my source:
> > 
> > <?PHP
> > $db = mysql_connect("localhost", "root"); 
> > mysql_select_db("bsdb1",$db); // display individual record if 
> > ($_GET['id']) { 
> > $result = mysql_query("SELECT * FROM address WHERE 
> > id=$id",$db); $myrow = mysql_fetch_array($result);
> > printf("Name: %s\n<br>", $myrow["name"]);
> > printf("Address: %s\n<br>", $myrow["address"]);
> > printf("Home Number: %s\n<br>", $myrow["hnum"]);
> > printf("Work Number: %s\n<br>", $myrow["wnum"]);
> > 
> > } else {
> > // show employee list
> > $result = mysql_query("SELECT * FROM address",$db);
> > if ($myrow = mysql_fetch_array($result)) {
> > // display list if there are records to display
> > do { 
> > printf("<a href=\"%s?id=%s\">%s</a><br>\n", 
> > $_SERVER['PHP_SELF'], $myrow["id"], $myrow["name"]); } while 
> > ($myrow = mysql_fetch_array($result)); } else { 
> > // no records to display
> > echo "Sorry, no records were found!";
> > } 
> > } 
> > ?> 
> > -- 
> > Mike Karthauser 
> > Managing Director - Brightstorm Ltd
> > 
> > Email       >> [EMAIL PROTECTED]
> > Web         >> http://www.brightstorm.co.uk
> > Tel         >> 0117 9426653 (office)
> >                07939 252144 (mobile)
> > 
> > Snailmail   >> Unit 8, 14 King Square,
> >                Bristol BS2 8JJ
> > 
> > 
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > ================================================================
> > Deze e-mail is door E-mail VirusScanner van Planet Internet
> > gecontroleerd op virussen. Op http://www.planet.nl/evs staat 
> > een verwijzing naar de actuele lijst waar op wordt gecontroleerd.
> > 
> > 
> 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to