First off, this is a PHP development issue, not necessarily a mysql issue. Nonetheless, I have included some comments.
On Mon, 2003-06-16 at 07:33, sgannon60 wrote: > I am using PHP, Mysql on IIS5. > > Process > 1 - submit a unique user name, password > 2- check against database and if successful enter details in database which > creates a primary key which is the constant between the client details table > and the projects > 3 - when a successful login if the first time a blank client details form, > or if an existing client an update form with list of projects. > > > I do not understand how to get the primary key generated after the initial > submission to be available on each page to tie all the elements to the right > client. Assuming the primary key is an auto_increment field, you can run: SELECT LAST_INSERT_ID(); In your php code, to retrieve this you can do the following: <? mysql_pconnect('h','u','p'); mysql_select_db('d'); mysql_query("INSERT INTO foo(bar) VALUES('abc')"); print "Insert ID: " . mysql_insert_id() . "<br />"; ?> > > I am thinking if I send the unique username as a form variable or http > variable I can use that to filter the password table to finfd the unique ID > > Mind you if I do that why don't I just use the username as the unique > Element???? > Having the username be unique is a plus, but remember too that a character string takes more time to SELECT than say an unsigned integer. When you have tables that require information about the user (say the user that created record X), it is slightly more efficient to use an unsigned int as the primary key rather than the varchar username. > The problem now is that something that my book is telling m,e is dead simple > aint so simple for me. > > When I try to read the form variable I get ---- > Notice: Undefined index: username in c:\inetpub\wwwroot\ias_php\success.php > on line 9 > > I have tried altering this parameter to 1 for an IIS server with no joy. > cgi.rfc2616_headers = 0 > This isn't what you're looking for at all. > > This is the page in question. > > <html> > <head> > <title>Untitled Document</title> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > </head> > > <body> > <p>seuceees > <?php $HTTP_POST_VARS['username']; ?> > The undefined index you are getting is because $HTTP_POST_VARS['username'] is not set, try running something like this: <?php if (isset($HTTP_POST_VARS['username'])) { print "HTTP_POST_VARS<br />"; } elseif (isset($_POST['username'])) { print "POST<br />"; } else { phpinfo(); } ?> Here, I use the 'isset()' routine to verify that the variable is set (which will get rid of that 'undefined index' error message you are seeing). Additionally, if $HTTP_POST_VARS and $_POST variables aren't set, it dumps a phpinfo(); My guess is that you aren't posting to the page, so it's not being registered. > </p> > <p> </p> > </body> > </html> > > Any pointers or answers will be much appreciated > Hopefully this information has helped a bit, however please note that the issues noted above are not mysql issues but php issues. This email was sent to the mysql lists. > Steve > > Thanks, Ryan Yagatich -- ,_____________________________________________________, \ Ryan Yagatich [EMAIL PROTECTED] \ / Pantek Incorporated (877) LINUX-FIX / \ http://www.pantek.com/security (440) 519-1802 \ / Are your networks secure? Are you certain? / \___A9062F5C3EAE81D54A28A8C1289943D9EE43015BD8BC03F1___\ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]