Re: [PHP-DB] Problem with php and mysql
One of our customers has written a php application that we are hosting. Basically, there is a province/state table which populates a combo box. When the form containing this combo box is submitted, the information is added into the database. The problem is that when nothing is selected from the combo box, it adds a number which seems to be random in the database, rather than the province/state ID which it references from the province table. Obviously there are many methods of avoiding this such as javascript to make sure something is selected, or even giving the combo box a default value, but I was wondering if anyone knew why the database itself isn't catching the error (foreign key violation) and accepting the data. Any ideas? Are you using InnoDb tables? Otherwise there are no foreign key restrictions. How about some validation to make sure something is selected? Or, some validation that'll give the value a default if nothing is selected. Validate everything from the user! ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with php and mysql
Hi, thanks for the help, I just had a look at the db and they are just the default tables, so that must be it. I'll let them know to either change them over or add validation. Again, thanks for your help. On Wed, 5 Mar 2003, 1LT John W. Holmes wrote: Date: Wed, 5 Mar 2003 10:07:04 -0500 From: 1LT John W. Holmes [EMAIL PROTECTED] To: Kevin Demers DSL [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP-DB] Problem with php and mysql One of our customers has written a php application that we are hosting. Basically, there is a province/state table which populates a combo box. When the form containing this combo box is submitted, the information is added into the database. The problem is that when nothing is selected from the combo box, it adds a number which seems to be random in the database, rather than the province/state ID which it references from the province table. Obviously there are many methods of avoiding this such as javascript to make sure something is selected, or even giving the combo box a default value, but I was wondering if anyone knew why the database itself isn't catching the error (foreign key violation) and accepting the data. Any ideas? Are you using InnoDb tables? Otherwise there are no foreign key restrictions. How about some validation to make sure something is selected? Or, some validation that'll give the value a default if nothing is selected. Validate everything from the user! ---John Holmes... Thanks, Kevin --- Kevin Demers Technical/Customer Support Internet Access - WORLDWIDE 3 East Main Street Welland, ON Canada L3B 3W4 (905) 714-1400 (800) 560-4560 [EMAIL PROTECTED] www.iaw.on.ca -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] php and local printing
Have you looked into the exec() function? Maybe exec(lpr something or other) may work, though I haven't tried it myself ... Regards, Matthew Moldvan --- System Administrator Trilogy International, Inc http://www.trilogyintl.com/ecommerce/ --- -Original Message- From: Rajesh Fowkar [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 12:21 AM To: PHP-DB Mailing List Subject: Re: [PHP-DB] php and local printing On Tue, Mar 04, 2003 at 06:45:54AM -0800, Mark wrote: It dopesn't seem like you got an answer to this. Spot on. Yours is the first reply. To print locally, you'll need to use Jscript of something similar on the local end. I've only seen this work in IE, but I haven't looked into it too deeply. To print to the server, you'll probably need to shell out to the OS. Using javascript window.print() I get the print dialogue box. But what I needed was I have got a text file which on server I can print using lp filename. Similar thing but without any print dialogue box at the client end. HTH or at least starts a discussion... Hope so. Thank you for the reply. Peace -- Rajesh : [ GNU/Linux One Stanza Tip (LOST) ]### Sub : Linux Commands (#4)LOST #056 For a newbie introduction to Linux commands and shotcuts visit URL: http://sunsite.dk/linux-newbie/Linux_commands.htm [EMAIL PROTECTED]## : -- 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
Re: [PHP-DB] date functions (generates parse error)
Sorry, I forgot to add the part at the bottom where I am calling the function = ? function tips($weekstart){ $start = date('Ymd',strtotime($weekstart)); $query = SELECT * FROM Rota WHERE date = $start and date = ($start + INTERVAL 6 DAY) ORDER BY staffid; $result = mysql_query($query); while ($row = mysql_fetch_array($result)){ if ( isset ( $tips ) ){ if (isset ( $tips[$row[staffid]] ) ){ $hours = $row[finish] - $row[start]; $tips[$row[staffid]] = $tips[$row[staffid]] + $hours; } else{ $tips[$row[staffid]] = $row[finish] - $row[start]; } } else{ $tips = array('$row[staffid]' =( $row[finish] - $row[start] ) ); } } return $tips; } function dbconnect(){ mysql_connect(localhost, filterseveuk, godisadj); mysql_select_db(filterseveuk); } dbconnect(); $date = 2003-03-02; var_dump(tips($date)); ? _ Express yourself with cool emoticons http://messenger.msn.co.uk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ODBC/Paradox
Hi, I am trying access DB Paradox via php/odbc. Only get in W98/PWS or WME/PWS. And without success in Linux/php/odbc and Windows 2K/php/odbc. In W2K's Case, it appears following message: Warning: SQL error: [Microsoft][ODBC DRIVER for Paradox] The table external is not in the waited format., SQL state S1000 in SQLExecDirect in D:\www\chen\quadro.inc on line 4 Unable have runs query. Would anybody have a solution? Thanks Fábio Hur -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] date functions (generates parse error)
This is very weird. What are you using to create this code? If you remove all of the spaces (?) before $query, the code doesn't give a parse error. It shouldn't give one either way, though, if those are spaces or a tab before your $query = ... line. Even if you remove all of the text and only leave ?, ?, and those spaces, PHP will spit something like: Notice: Use of undefined constant - assumed ' ' in c:\inetpub\wwwroot\test.php on line 3 So, the fix is to remove those characters and replace them with spaces or tabs. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: David Rice [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 12:34 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] date functions (generates parse error) Sorry, I forgot to add the part at the bottom where I am calling the function = ? function tips($weekstart){ $start = date('Ymd',strtotime($weekstart)); $query = SELECT * FROM Rota WHERE date = $start and date = ($start + INTERVAL 6 DAY) ORDER BY staffid; $result = mysql_query($query); while ($row = mysql_fetch_array($result)){ if ( isset ( $tips ) ){ if (isset ( $tips[$row[staffid]] ) ){ $hours = $row[finish] - $row[start]; $tips[$row[staffid]] = $tips[$row[staffid]] + $hours; } else{ $tips[$row[staffid]] = $row[finish] - $row[start]; } } else{ $tips = array('$row[staffid]' =( $row[finish] - $row[start] ) ); } } return $tips; } function dbconnect(){ mysql_connect(localhost, filterseveuk, godisadj); mysql_select_db(filterseveuk); } dbconnect(); $date = 2003-03-02; var_dump(tips($date)); ? _ Express yourself with cool emoticons http://messenger.msn.co.uk -- 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
Re: [PHP-DB] php and local printing
On Wednesday 05 March 2003 13:20, Rajesh Fowkar wrote: On Tue, Mar 04, 2003 at 06:45:54AM -0800, Mark wrote: It dopesn't seem like you got an answer to this. Spot on. Yours is the first reply. Not surprising as this question really does not belong here. To print locally, you'll need to use Jscript of something similar on the local end. I've only seen this work in IE, but I haven't looked into it too deeply. To print to the server, you'll probably need to shell out to the OS. Using javascript window.print() I get the print dialogue box. But what I needed was I have got a text file which on server I can print using lp filename. Similar thing but without any print dialogue box at the client end. Exactly, this is a client-side problem (Javascript, ActiveX/script, etc). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* Firmware update in the coffee machine */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Column Sort Question
Hi All, This is a newbie question. I am using PHP Version 4.2.3 with register_globals=off. I am trying to creating a simple address book with mysql as the backend. I have a form that passes what the user wants to query from the address book and it returns everything in a table with column heading just fine. I use $myvar1=$_POST['myvar1']; to pass the info from the form to the php file. I am using the following in the header fields of the table: th nowrap a href=?php echo $PHP_SELF?order_by=FIRSTNAME; ?First Name/a /th This doesn't work (I get a bunch of errors) and I think it's because the variable from $_POST are not staying persistent. I tried playing around with session with no luck. What is the best way to resort on a column? Thanks, Jerry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Column Sort Question
Shouldn't you be using $_GET or, since register_globals are set to off, $order_by should contain FIRSTNAME Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 Pay It Forward mailto:[EMAIL PROTECTED] http://accessingram.com -Original Message- From: Jerry [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 05, 2003 3:40 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Column Sort Question Hi All, This is a newbie question. I am using PHP Version 4.2.3 with register_globals=off. I am trying to creating a simple address book with mysql as the backend. I have a form that passes what the user wants to query from the address book and it returns everything in a table with column heading just fine. I use $myvar1=$_POST['myvar1']; to pass the info from the form to the php file. I am using the following in the header fields of the table: th nowrap a href=?php echo $PHP_SELF?order_by=FIRSTNAME; ?First Name/a /th This doesn't work (I get a bunch of errors) and I think it's because the variable from $_POST are not staying persistent. I tried playing around with session with no luck. What is the best way to resort on a column? Thanks, Jerry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Storing browser stats
Is there a method for storing each users browser stats within a database table. So everytime someone visits the browser info is gathered and stored as a unique row in the 'browser' table in the database. Any advice?? Cheers -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Converting Dates...
Hi, I need help. I need to convert a Date column in MySQL where the date is stored like 2003-01-15 to the following seconds 1042621252 . I'm connecting the database through PHP to third party solution that requires this. Here is the only information that was given: --- - Dates and times are passed in as seconds (not milliseconds) since 1/1/1970 and converted into Date Objects by multiplying by 1000 and then add the TimeZoneOffset to get it to local time: eg: startTime = 10710812; // startTime is the number of seconds between the req'd date and 1/1/1970 startTimeObj = Date(startTime * 1000 + (new Date().getTimezoneOffset() * 6)); - startDate and endDate combine the the date and time of events - I have no idea how to convert my date colums into this type. Any help would be GREATLY appreciated! Thanks, Doug Coning -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php