RE: [PHP-DB] Populating a dropdown list with ENUM values...
Did you see the very last user contributed comment at http://www.php.net/manual/en/function.mysql-fetch-field.php? It'll help you immensely. Christopher S. Cosby SciCare Software Services 770.236.1128 -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 26, 2002 3:38 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Populating a dropdown list with ENUM values... I am working on an application that has several different fields that are populated dropdown lists. In every case, this data is simply data from a MySQL table column and works great. I have run into a new difficulty though... One field that I am wanting to populate in a dropdown list is an ENUM field. I am trying to figure out how to do this. I have seen a couple ideas in the newsgroups, but most are pretty complex and about a year or so old. I am hoping for a simpler solution that may have been developed since these posts. Thanks in advance. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
RE: [PHP-DB] Last ID from database?
-Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 26, 2002 3:57 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Last ID from database? Hi there everyone, How Can I grab just the LAST ID from a database in MySQL with PHP easily? Which LAST ID? There are several meanings there. I'll try a couple. 1) If the column is the only auto_increment column in a table, and you want to know the value of that column after an INSERT, just use the following to get the value that was inserted. ? $dbh = mysql_connect($host, $user, $pass); mysql_select_db($db, $dbh); mysql_query(INSERT INTO table (id, col1, col2) VALUES ('','val1','val2'), $dbh); $lastid = mysql_insert_id($dbh); ? 2) Just want to get the highest value in a column? Try this. ? $dbh = mysql_connect($host, $user, $pass); mysql_select_db($db, $dbh); $result = mysql_query(SELECT MAX(columnname) FROM tablename, $dbh); if ( $row = mysql_fetch_object($result) ) { $lastid = $row-columnname; } ? Thanks you :-) Chris --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
RE: [PHP-DB] what the heck? (elementary question)
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 7:47 PM To: Cosby, Christopher; [EMAIL PROTECTED] Subject: Re: [PHP-DB] what the heck? (elementary question) I will regularly use large echo style statements to generate HTML, especially SELECT tags and result tables. Oops...I forgot some key phraseology here. IN MY OPINION, it's cleaner and easier to read if you don't use echo style statements to generate HTML, especially if it's tags where you have to do everywhere. It's just annoying (again, IMHO *8-]) to have to escape quotes and such (additionally, if you use an editor that does syntax highlighting, it looks purtier). As far as the POST/GET question, you technically can use POST and GET methods simultaneously, but it's nasty. For best results, stay away from the register_globals functionality and use $HTTP_POST_VARS[] and $HTTP_GET_VARS[] instead. Both of which are deprecated. =( _GET _POST are the new ones. Good to know. Hard to break old habits. Thanks for the additional info. chris - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
RE: [PHP-DB] email format: meeting request
I'll dig up some old code I have lying around that did this (may take a while to find). In the meantime, I did it like this: 1) Create an event in Outlook. 2) File - Save As... - event.ics 3) event.ics is a plain text calendar file. The dates are a pain in the @$$ (DTSTART, DTEND), but the rest is pretty straight-forward. Enjoy, I dig for code. chris -Original Message- From: Dib, Walid (MED, Stagiaire GEMS) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 25, 2002 4:38 AM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] email format: meeting request Hello, I have a little bit difficult question, I need to send email under format meeting request to automatically update the calendar in outlook, how can I do that with PHP and what parameters use?? Thank you Walid -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
RE: [PHP-DB] Re: never seen this before..
Must be an old or broken version of mysql. I'm running 3.23.50 and it won't even allow the `id' field to be a varchar(255). Change it to int() and watch the magic. -Original Message- From: Jas [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 1:05 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: never seen this before.. Here is the db table structure... CREATE TABLE demo_sessions ( id varchar(255) NOT NULL auto_increment, ipaddy varchar(255) NOT NULL, date varchar(255) NOT NULL, PRIMARY KEY (id) ); Let me know if this is correct, I have a feeling that the varchar is my problem but I could be wrong. TIA Jas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... TIA -- column in your table denotes your primary key? After that, how is it incremented? Is it auto or do you have some other form of it. I think your code is correct so the error seems to be how the data ID is generated. gl -- Seth Jas wrote: I am getting an error when inserting data into a mysql database table. It is telling me that there is a duplicate entry in the database everytime it gets 10 records inserted to the table, if I flush the table and try it again it works fine. Is there some kind of limit on some tables? Here is the error php outputs once the table gets 10 records: Duplicate entry '10' for key 1 Here is the code... require '/home/web/b/bignickel.net/scripts/admin/db.php'; $table = demo_sessions; $sql_insert = INSERT INTO $table (ipaddy,date) VALUES ('$ipaddy','$date') or die('Could not insert client info'); $result = @mysql_query($sql_insert,$dbh) or die(MYSQL_ERROR()); Any help on this would be great TIA Jas -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
RE: [PHP-DB] what the heck? update
Try the PHP documentation, see if it helps. If not, come back with a tiny bit more detail. The fact that `lastname' and `submit' are both being passed to the next page is correct, you're not seeing things. $submit is just another variable in the world of PHP. http://www.php.net/manual/en/language.variables.external.php chris -Original Message- From: Matthew Crouch [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 2:59 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] what the heck? update I changed method to GET and the value of $lastname seems to be getting passed but so is $submit, with the value Search for Last Name as you might expect. Probably this ain't the answer Matthew Crouch wrote: this bit from my index page is giving me 2 headaches: 1. it isn't passing anything into the URL 2. the page that gets called (name.php) sits and tries to load forever. it looks like it's even filling up my hard drive with data (?!) Note: it does this (#2) even if I type in the URL with a variable and value, like name.php?lastname=smith ? printf (form method=\post\ action=\name.php?lastname=%s\, $lastname); ? div align=center input type=Text name=lastname size=75 input type=Submit name=submit value=Search for Last Name /div /form /div -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.
RE: [PHP-DB] what the heck? (elementary question)
I don't want to start a tangent here, but the most accepted way for generating HTML with PHP is to NOT generate HTML with PHP. Thus, the original code should be written like this: :: BEGIN input.html :: div style=position: relative; text-align: center; form method=post action=name.php input type=text name=lastname size=75 input type=submit name = submit value=Search for Last Name /form /p :: END input.html :: :: BEGIN name.php :: ? /* * HTTP_POST variables from form: * 1) $lastname * * Access them with: * 1) $HTTP_POST_VARS[lastname] */ ? p You searched for b?= $HTTP_POST_VARS[lastname] ?/b and something happened. /p :: END name.php :: As far as the POST/GET question, you technically can use POST and GET methods simultaneously, but it's nasty. For best results, stay away from the register_globals functionality and use $HTTP_POST_VARS[] and $HTTP_GET_VARS[] instead. Last thing: Go to WeSellBooksByTheMillions and buy a good PHP book for reference. They have lots of basics like this in them. I prefer most anything from Wrox Press (http://www.wrox.com/) chris - - - - - - - Appended by Scientific-Atlanta, Inc. - - - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.