List Info

Thread: Selecting individual record...




Selecting individual record...
user name
2006-05-23 20:59:10
Hi
You should check for $_GET['id'] or $_REQUEST['id'] here
>>> if ($id) {  and in the queries.
Check help for global arrays. By default you have no direct
access to posted/get values by their post name.
Good luck!
Vania



 >-------- Оригинално писмо --------
 >От:  "NL" <nafelloydgmail.com>
 >Относно: [PHP - MASTERS] Selecting individual record...
 >До: "PHP-Masters" <PHP-Mastersgooglegroups.com>
 >Изпратено на: Вторник, 2006, Май 23 14:33:26 EEST
 >----------------------------------
 >
 >
 >Hi Group,
 >
 >I've not posted here before, so I hope I'm not
breaking any policies.
 >
 >Here is some code I'm using to try and select
individual records from
 >mySQL database..
 >
 ><?php
 >
 >include("dbinfo.inc.php") ;
 >
 >mysql_connect(localhost,$username,$password);
 >mysql_select_db($database) or die("Unable to
select Database");
 >
 >//display individual record
 >
 >if ($id) {
 >
 >
 >	$result = mysql_query("SELECT * FROM Artist
WHERE ID='$id'");
 >
 >	$myrow = mysql_fetch_array($result);
 >
 >	printf("Code: %s\n<br>",
$myrow["Code"]);
 >	printf("Name: %s\n<br>",
$myrow["Name"]);
 >
 >         } else {
 >
 >    // show employee list
 >
 >   $result = mysql_query("SELECT * FROM
Artist");
 >
 >    if ($myrow = mysql_fetch_array($result)) {
 >
 >      // display list if there are records to display
 >
 >      do {
 >
 >        printf("<a
href=\"%s?id=%s\">%s
%s</a><br>\n", $PHP_SELF,
 >$myrow["ID"], $myrow["Code"],
$myrow["Name"]);
 >
 >      } while ($myrow = mysql_fetch_array($result));
 >
 >    } else {
 >
 >      // no records to display
 >
 >      echo "Sorry, no records were found!";
 >
 >    }
 >
 >}
 >
 >?>
 >
 >
 >
 >Whenever i click on a link,i get the same page of all
of my records
 >instead of the individual record that i clicked on.
 >
 >Any ideas?
 >
 >
 > >
 >

------------------------------------------------------------
-----
http://www.sportni.bg
/worldcup/ - Германия 2006 - Световното първенство по
футбол наближава!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "PHP-Masters" group.
To post to this group, send email to PHP-Mastersgooglegroups.com
To unsubscribe from this group, send email to
PHP-Masters-unsubscribegooglegroups.com
For more options, visit this group at http://gro
ups.google.com/group/PHP-Masters
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )