RE: [PHP-DB] versioning a database
-Original Message- From: Chris Wagner [mailto:[EMAIL PROTECTED] what i want to do is version a database. i am not sure if i am using the right word for this, but... [snip] * where, in the MySQL database could i store a version number? i know Tables have a comment field, which could store a version, but the database itself does not have this... * how can i bring the database up-to-date without losing all rows? is there a way to create a table if it doesn't exist, or remove extra columns and add needed columns if it does exist. * OR, is there a better way to do what i want to do, *altogether*??? snip Yes, there is a 'create table foo if not exist' command, and you can easily 'alter table' and the other alter commands to add drop and modify columns. There's no real reason not to store the versioning information in its own table. Have a 'header' type file to your script always check it and bounce off a warning telling the user how to run the sql command, so the admin can run the script (don't want it to just be run-able from anyone anywhere). I do a similar thing, although as noone external is deploying my app I don't have any convenience for it. I have a directory which holds resources for a given release version. Any added tables and columns go in there, and then entire table exports also go there (for tables that hold metadata/etc. about the app) if any of those tables have changed. The table exports could just be stored as alter statements, but they're done within the application so it's more trouble than it's worth to try and track them individually. They also can't be done on the live version - so I don't have to worry that there are actual values to be lost in those tables. So - in summary - header to check, imo version(s) in a separate table, you could even store the version number each page needs - and just give a small general warning if the script on the whole doesn't match the required database version - but still allow using the 'old' parts of the site. That, however, may be more micromanagement than you want, so maybe best just to make it an entire 'block' scenario. The alter statements could, of course, also update the version number as their last command. All vanilla SQL. Cheers, - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL error...
-Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] I have been using a PHP page to update a database table for a long time now. Unfortunately, I have noticed that frequently when I perform an update I get back an error saying Table 'tablename' doesn't exist. This is becoming more and more annoying. [snip] $query = SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime IS NOT NU LL AND ctime IS NULL ORDER BY rtime ASC; $result = mysql_query($query, $Prod) or die(mysql_error()); ? snip Strange behavior, can't say I've ever heard of/seen it - however... IS NOT NU LL is not, strictly speaking, valid sql. If that's not just a weird line wrapping issue - that may point to part of your problem. If the error you're getting back is literally Table 'tablename' doesn't exist - then you're looking in the wrong code, and somewhere you have code that says tablename instead of $tablename. You may want to grep for tablename to try to track that down. Cheers, - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Data from a pull down menu
I have a pull down menu that gathers a list of people from the database. What I am trying to do from there is after scrolling through and finding the correct record and selecting it, the page will then display that records information. I have done some searching and I am assuming that is right under my nose. If there is some material out there on this can someone point me in the right direction or show some sample coding? -- Jason Davidson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP-DB] Data from a pull down menu
-- Forwarded message -- From: Joseph Crawford [EMAIL PROTECTED] Date: Fri, 10 Dec 2004 16:00:33 -0500 Subject: Re: [PHP-DB] Data from a pull down menu To: [EMAIL PROTECTED] well are you looking for an automatic page refresh when a name is selected? If so you need to look into javascript for some help. If you have a go button or something like that what i would do is make the drop down use the person's id and name such as select name=person option value=3Joe Crawford/option /select when the form is posted the value of $_POST['person'] will be 3, i would use that to query the database and display any intormation that i needed displayed. -- Joseph Crawford Jr. Codebowl Solutions [EMAIL PROTECTED] -- Joseph Crawford Jr. Codebowl Solutions [EMAIL PROTECTED] For a GMail account contact me OFF-LIST -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL error...
No... That is just some strange error generated by the cut and paste. The IS NOT NU LL that is... The other issue with 'tablename'... I simply typed 'tablename' in the e-mail because I didn't remember the exact tablename when I was typing the e-mail. It does actually provide the name of the table that the script is working with. Thanks for the feedback. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: Norland, Martin [mailto:[EMAIL PROTECTED] Sent: Friday, December 10, 2004 2:34 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL error... -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] I have been using a PHP page to update a database table for a long time now. Unfortunately, I have noticed that frequently when I perform an update I get back an error saying Table 'tablename' doesn't exist. This is becoming more and more annoying. [snip] $query = SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime IS NOT NU LL AND ctime IS NULL ORDER BY rtime ASC; $result = mysql_query($query, $Prod) or die(mysql_error()); ? snip Strange behavior, can't say I've ever heard of/seen it - however... IS NOT NU LL is not, strictly speaking, valid sql. If that's not just a weird line wrapping issue - that may point to part of your problem. If the error you're getting back is literally Table 'tablename' doesn't exist - then you're looking in the wrong code, and somewhere you have code that says tablename instead of $tablename. You may want to grep for tablename to try to track that down. Cheers, - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL error...
I have been using a PHP page to update a database table for a long time now. Unfortunately, I have noticed that frequently when I perform an update I get back an error saying Table 'tablename' doesn't exist. This is becoming more and more annoying. The table obviously exists as the page that I hit the update button on is populated from this same page. Additionally, if I backout and reload the page most of the time it will work. Any help would be greatly appreciated. Mysql 3.23.49 PHP 4.2.3 ?php require_once('useraccounts.lib.php'); session_start(); if (!isset($_SESSION['valid_user'])) { echo You must be logged in to use this application. br; $return_url = $_SERVER['PHP_SELF']; session_register(return_url); echo Please a href=\../sa_login.php\ login/a now. br; exit(); } else { $sbcuid = $valid_user; } while(isset($entry[0])) { $tmp = $entry[0]; $update = UPDATE accounts SET ctime=NOW() WHERE id_sys='.$tmp.'; $results = mysql_query($update, $Prod) or die(mysql_error()); array_shift($entry); } mysql_select_db($database, $Prod); $query = SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime IS NOT NU LL AND ctime IS NULL ORDER BY rtime ASC; $result = mysql_query($query, $Prod) or die(mysql_error()); ? html head titleSBCLD User Account Request System/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body bgcolor=#CC p align=centerfont color=#0033CC size=6strongAdministration/strong /font/p p align=centerfont size=4Here are the details for the accounts approved and pending creation:/font/p p align=center form method=post action=account_details.php table width=90% bgcolor=#CC cellspacing=0 tr bordercolor=#CC td width=20% height=23div align=centerfont color=#CC size= 3Requesting User/font/div/td td width=10% valign=topdiv align=centerfont color=#CCSyste m/font/div/td td width=10% valign=topdiv align=centerfont color=#CCPrima ry Group/font/div/td td width=10% valign=topdiv align=centerfont color=#CCD efault Shell/font/div/td td width=30% valign=topdiv align=centerfont color=#CCReque st Time/font/div/td td width=10% valign=topdiv align=centerfont color=#CCC ompleted/font/div/td /tr ?php do { $entry = $list['id_sys']; $id = split('-', $list['id_sys']); $sbcuid = $id[0]; $sys = $id[1]; if (isset($list['id_sys'])) { echo trtd width=\20%\div align=\center\.$sbcuid./div/t d; echo td width=\10%\div align=\center\.$sys./div/td; echo td width=\15%\div align=\center\.$list['gid']./div/ td; echo td width=\15%\div align=\center\.$list['shell']./div /td; echo td width=\30%\div align=\center\.$list['atime']./div /td; echo td width=\10%\div align=\center\input name=\entry[]\ type=\checkbox\ value=$entry/div/td/tr; } } while ($list = mysql_fetch_assoc($result)); ? /table p align=centerPlacing a check in the completed box will update the databas e entry for this request with a completed time and remove this entry from this page upon clicking the Update button below./p div align=center input type=submit value=Update /div /form /body /html Thanks in advance. This is really beginning to bug the crap out of me. 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
RE: [PHP-DB] Data from a pull down menu
form action='somepage.php' method='post' select name='myselect' onChange='form.submit();' option... /select bastien From: Jason T. Davidson [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] Data from a pull down menu Date: Fri, 10 Dec 2004 14:28:31 -0600 I have a pull down menu that gathers a list of people from the database. What I am trying to do from there is after scrolling through and finding the correct record and selecting it, the page will then display that records information. I have done some searching and I am assuming that is right under my nose. If there is some material out there on this can someone point me in the right direction or show some sample coding? -- Jason Davidson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php