[PHP-DB] connecting to a remote db?
Hi there everyone, I have a secure server and another separate servr, both use PHP and MySQL however, I need to connect to a db off of the secure server, how can I do this? I normally use localhost if its on the same machine, but how can I connect the DB to a DB on my other machine as I cannot use this particular DB on my secure server? Thanks everyone Chris --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002
RE: [PHP-DB] Executing Queries from a File Using PHP
Thanks. Since it would take me forever to write, and I don't know thing well enough to make sure I have all the possibilities covered, I was hoping there was some source code somewhere I can use. --Bruce -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 11:34 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Executing Queries from a File Using PHP On Thursday 13 June 2002 10:48, Bruce Vander Werf wrote: Is there a PHP routine anywhere to execute a series of MySQL queries in a text file? I know how to do this via the command line or by using PHPMyAdmin, but I need to do it in my own PHP script, and some of the queries span more than one line. There are no built-in functions to do so. You need to read in the file yourself, parse it appropriately then send the queries to mysql. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Thank you for observing all safety precautions. */ -- 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] Executing Queries from a File Using PHP
all you have to do is put one query per line in the file, it may be hard to read, but who cares. and then it is as simple as. $contents = file(sql.txt); //file function reads file into array while (list ($qry)) = each($contents)) { mysql_query($qry); } Just a thought Jeff Bruce Vander WerfTo: [EMAIL PROTECTED] brucev@cyberl cc: ink.com Subject: RE: [PHP-DB] Executing Queries from a File Using PHP 06/13/2002 08:39 AM Please respond to brucev Thanks. Since it would take me forever to write, and I don't know thing well enough to make sure I have all the possibilities covered, I was hoping there was some source code somewhere I can use. --Bruce -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 11:34 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Executing Queries from a File Using PHP On Thursday 13 June 2002 10:48, Bruce Vander Werf wrote: Is there a PHP routine anywhere to execute a series of MySQL queries in a text file? I know how to do this via the command line or by using PHPMyAdmin, but I need to do it in my own PHP script, and some of the queries span more than one line. There are no built-in functions to do so. You need to read in the file yourself, parse it appropriately then send the queries to mysql. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Thank you for observing all safety precautions. */ -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how is it possible to read data from an excel workbook ?
i need to read data from a sheet in M$ Excel to update some databases in M$ Acess ... but how ??? thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Executing Queries from a File Using PHP
although this goes without saying but in my petty need for completion, i feel i must writethere is obviously SO much more that can be done where i put the mysql_query($qry), whether it be updating, inserting, selecting etc... but that can be a starting point. i feel better, thank you for your indulgence. :) - Forwarded by Jeffrey N Dyke/CORP/Keane on 06/13/2002 09:30 AM - Jeffrey N Dyke To: [EMAIL PROTECTED] 06/13/2002 cc: [EMAIL PROTECTED] 09:00 AM Subject: RE: [PHP-DB] Executing Queries from a File Using PHP(Document link: Jeff Dyke) all you have to do is put one query per line in the file, it may be hard to read, but who cares. and then it is as simple as. $contents = file(sql.txt); //file function reads file into array while (list ($qry)) = each($contents)) { mysql_query($qry); } Just a thought Jeff Bruce Vander WerfTo: [EMAIL PROTECTED] brucev@cyberl cc: ink.com Subject: RE: [PHP-DB] Executing Queries from a File Using PHP 06/13/2002 08:39 AM Please respond to brucev Thanks. Since it would take me forever to write, and I don't know thing well enough to make sure I have all the possibilities covered, I was hoping there was some source code somewhere I can use. --Bruce -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 11:34 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Executing Queries from a File Using PHP On Thursday 13 June 2002 10:48, Bruce Vander Werf wrote: Is there a PHP routine anywhere to execute a series of MySQL queries in a text file? I know how to do this via the command line or by using PHPMyAdmin, but I need to do it in my own PHP script, and some of the queries span more than one line. There are no built-in functions to do so. You need to read in the file yourself, parse it appropriately then send the queries to mysql. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Thank you for observing all safety precautions. */ -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP-DB] how is it possible to read data from an excel workbook ?
thanks for your attention the question is that im 'working' on a software to automate a weekly employee task that resumes to import a excel file that comes in zip format from the mother-company with new prices and products, to update an accounting software that uses M$ access db. there are already access databases that import the file, merge the new data with the old and update the databases ... ( i made a vb aplication to fire up the databases in the right sequence ) but its very complicated to the person in question so i thinked of a php aplication to upload the file and replace the work made by Acess -Mensagem original- De: Jeremy Peterson [mailto:[EMAIL PROTECTED]] Enviada: quinta-feira, 13 de Junho de 2002 14:41 Para: [EMAIL PROTECTED] Assunto: Re: [PHP-DB] how is it possible to read data from an excel workbook ? Why use PHP to do this, there are plenty of tools to in Access to import from Excel. Unless there are other considerations, use Access to pull that data. (Hint: Link the excel spreadsheet and run an (update or append) query. Jeremy At 02:34 PM 6/13/2002 +0100, you wrote: i need to read data from a sheet in M$ Excel to update some databases in M$ Acess ... but how ??? thanks -- 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] Re: Error Loading File -- Sort of Fixed
Ok, if anyone else is having the same trouble with PHP 4.2.1, David Robley's suggestion (Thank you David!) works. I am not to proud to have missed the obvious :) If you are having trouble loading files (LOAD INFILE...) with PHP into MySQL, just do a chmod($file, 0777), and it works. Not sure why this version of PHP doesn't give full permissions in the /tmp directory, but. Thanks all. David Robley wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Whoops :), Yes, this is using phpMyAdmin, trying to use the Insert data from a textfile into table function, which uploads a file and the attempts to LOAD DATA INFILE. Like I said below, it worked on PHP 4.1.2, then when upgraded to PHP 4.2.1, it gave the error : The file '/tmp/phpr4WYQY' must be in the database directory or be readable by all I ran through the phpMyAdmin scripts and watched it up until it tried to load the file, and it wouldn't read it. The /tmp directory is drwxrwxrwx and the files in it are -rw--, but I don't know how to get those changed in PHP. Anyway, on a different server, I could have sworn I got the same problem but the uploaded files in the /tmp directory were -rwxrwxrwx. Any ideas? Thanks David Robley wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... I am getting this error with a new install of PHP4.2.1 and Zend Optimizer 1.3.1: The file '/tmp/phpr4WYQY' must be in the database directory or be readable by all I just updated PHP and the Zend Optimizer, and it had worked previously with PHP4.1.2, Any ideas?? Because you are asking on the db list, I'll guess that you are trying to use LOAD DATA INFILE? The file you are trying to load needs to be world readable if it isn't in the database directory. If this isn't the problem, can you be a bit more specific about the circumstances in which this error appears? chmod() ??
[PHP-DB] MySQL timestamp field in different time zone
How do I get a MySQL timestamp field to update itself when the server is in a different time zone, i.e., I want it to have the date for my time zone. The field updates itself automatically, of course, without being referenced in the SQL query. I'd like to avoid having to change every query to include tweaking the field for the different time zone. kind regards, bill hollett -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL timestamp field in different time zone
I had a similar issue where I wanted timestamps to be relative to the user. I didn't find any better way then to create some profile data that contained their timezone and allow them to save that data. Then anytime I displayed a timestamp I added the timezone shift to the stamp. It would be nice if the browser sent timezone information in the header, but as far as I know it does not. Ryan -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 8:55 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL timestamp field in different time zone How do I get a MySQL timestamp field to update itself when the server is in a different time zone, i.e., I want it to have the date for my time zone. The field updates itself automatically, of course, without being referenced in the SQL query. I'd like to avoid having to change every query to include tweaking the field for the different time zone. kind regards, bill hollett -- 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] MySQL timestamp field in different time zone
BTW... are you saying that you plan to move the MySQL server around to different time zones? Why would you do that? -Original Message- From: Ryan Jameson (USA) Sent: Thursday, June 13, 2002 9:44 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL timestamp field in different time zone I had a similar issue where I wanted timestamps to be relative to the user. I didn't find any better way then to create some profile data that contained their timezone and allow them to save that data. Then anytime I displayed a timestamp I added the timezone shift to the stamp. It would be nice if the browser sent timezone information in the header, but as far as I know it does not. Ryan -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 8:55 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL timestamp field in different time zone How do I get a MySQL timestamp field to update itself when the server is in a different time zone, i.e., I want it to have the date for my time zone. The field updates itself automatically, of course, without being referenced in the SQL query. I'd like to avoid having to change every query to include tweaking the field for the different time zone. kind regards, bill hollett -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] problem with login script
hi adding the ? ?in func.php still returns this. my functions script is -function auuser($login,$passwd) { global $db_server,$http_host,$db,$db_user,$db_pass,$doc_root; if(!( $connect=pg_pconnect(host=$db_server dbname=$db user=$db_user password=$db_pass)) { Displayerrmsg(sprintf(internal error %s\n,pg_ErrorMessage($connect)); return 0; } $query=select passwd from login where usr='$login'; $result=pg_exec($connect,$query) or die(ERROR IN QUERY:$query.pg_last_error($connect) ); if (!$result) { Displayerrmsg(sprintf(internal error %s\n,pg_ErrorMessage($connect)); return 0; } if( ($arr=pg_fetch_array($result,0,PGSQL_BOTH)) ($passwd==$arr[passwd] $passwd!=) ) return 1; else return 0; } - my login.php file is ?include 'functions.php'; $user=$_POST['login']; $passwd=$_POST['passwd']; $result=auuser($user,$passwd); if(!$result) { setcookie(cookie_passwd,$passwd); setcookie(cookie_user,$user); . . } -- when i run these i get this error Parse error: parse error, unexpected ';' in /usr/local/apache/htdocs/sims/php/functions.php on line 12 Fatal error: Call to undefined function: auuser() in /usr/local/apache/htdocs/sims/php/login1.php on line 8 what is the prob suman -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL timestamp field in different time zone
No, it is similar to your situation. Server is in another time zone from the user. I want the timestamp to be relative to the user, not the server. Maybe do something in grenwich time, then interpret all queries from the db . . . ? kind regards, bill Ryan Jameson wrote: BTW... are you saying that you plan to move the MySQL server around to different time zones? Why would you do that? -Original Message- From: Ryan Jameson (USA) Sent: Thursday, June 13, 2002 9:44 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL timestamp field in different time zone I had a similar issue where I wanted timestamps to be relative to the user. I didn't find any better way then to create some profile data that contained their timezone and allow them to save that data. Then anytime I displayed a timestamp I added the timezone shift to the stamp. It would be nice if the browser sent timezone information in the header, but as far as I know it does not. Ryan -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 8:55 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL timestamp field in different time zone How do I get a MySQL timestamp field to update itself when the server is in a different time zone, i.e., I want it to have the date for my time zone. The field updates itself automatically, of course, without being referenced in the SQL query. I'd like to avoid having to change every query to include tweaking the field for the different time zone. kind regards, bill hollett -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] MySQL timestamp field in different time zone
Well then, the client needs to do the work since the client is the only side that knows the users timezone. Assuming you have a browser for a client I think you're stuck with the solution I had which was require the user to store (in the db, or in a cookie) their timezone and do the calculation either on the sql or upon displaying but it has to happen on the client. Ryan -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 2:03 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL timestamp field in different time zone No, it is similar to your situation. Server is in another time zone from the user. I want the timestamp to be relative to the user, not the server. Maybe do something in grenwich time, then interpret all queries from the db . . . ? kind regards, bill Ryan Jameson wrote: BTW... are you saying that you plan to move the MySQL server around to different time zones? Why would you do that? -Original Message- From: Ryan Jameson (USA) Sent: Thursday, June 13, 2002 9:44 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL timestamp field in different time zone I had a similar issue where I wanted timestamps to be relative to the user. I didn't find any better way then to create some profile data that contained their timezone and allow them to save that data. Then anytime I displayed a timestamp I added the timezone shift to the stamp. It would be nice if the browser sent timezone information in the header, but as far as I know it does not. Ryan -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 13, 2002 8:55 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL timestamp field in different time zone How do I get a MySQL timestamp field to update itself when the server is in a different time zone, i.e., I want it to have the date for my time zone. The field updates itself automatically, of course, without being referenced in the SQL query. I'd like to avoid having to change every query to include tweaking the field for the different time zone. kind regards, bill hollett -- 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 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] Book about Metabase
Hello, Just thought you would like to know that a new book named PHP and XML was released with a whole chapter dedicated to Metabase. Despite the book is about XML, the Metabase chapter talks about its use of XML to describe schemas to be installed automatically by Metabase and also the database independent access to databases using Metabase API. A review of the book will be published in the next weeks here not by me (I don't want you to think it would be biased) but by Alex Black of BinaryCloud fame. http://www.phpclasses.org/products.html/id/0735712271.html -- Regards, Manuel Lemos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Displaying results from JOIN
Hello, With some help from the mysql list, I've been able to get this query working from the command line SELECT * FROM outings as o INNER JOIN pics AS p1 ON o.pic1_id=p1.pic_id INNER JOIN pics AS p2 ON o.pic2_id=p2.pic_id INNER JOIN pics AS p3 ON o.pic3_id=p3.pic_id INNER JOIN pics AS p4 ON o.pic4_id=p4.pic_id; But when I plug it in to my script ?php $result = mysql_query(SELECT * FROM outings as o INNER JOIN pics AS p1 ON o.pic1_id=p1.pic_id INNER JOIN pics AS p2 ON o.pic2_id=p2.pic_id INNER JOIN pics AS p3 ON o.pic3_id=p3.pic_id INNER JOIN pics AS p4 ON o.pic4_id=p4.pic_id,$db) or die(mysql_error()); if ($myrow = mysql_fetch_array($result)) { do { print tdimg src=$myrow[path]/td; } while ($myrow = mysql_fetch_array($result)); } ? It will display only one of the paths not all four. I think I have to somehow alias in the SELECT part of the query, but I haven't been able to figure out how. Thanks in advance for the help, Mike --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.330 / Virus Database: 184 - Release Date: 2/28/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] auto increment
Hi guys, The auto_increment field of my MySQL table gives me 258, although the higher value at the moment is 241. I deleted the latest records, thinking that also the auto_increment would decrease, but this is not. I would like to know if there is a way to bring the auto_increment back to the higher value + 1. Cheers Daniele -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how is it possible to read data from an excel workbook ?
Hi, The majority of the problems arise when you try to do something that's not idiomatic to the language or endemic to the environment. MS Excel PHP do not co-exist, and you will have a lot of headaches whenever you try using some M$ product with a non-M$ technology. However that being said...here is where I see some hope: a) Use COM and access MS Excel. Ofcourse your PHP code will not be portable and you will have to learn to use COM. b) I'm not sure if Excel is accessible as an ODBC database. IIRC, VB used to allow me to use MS Excel as a file database. c) Have the excel file converted to CSV file by some programmatic meansVB... office macro whatever and then import the CSV via PHP into Access. HTH, -Srini -- http://symonds.net/~sriniram/ - Original Message - From: José Moreira [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 13, 2002 7:04 PM Subject: [PHP-DB] how is it possible to read data from an excel workbook ? i need to read data from a sheet in M$ Excel to update some databases in M$ Acess ... but how ??? thanks -- 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] problem with login script
On Friday 14 June 2002 03:23, suman wrote: hi adding the ? ?in func.php still returns this. my functions script is - You need: ? function auuser($login,$passwd) { ... } ? This ?include 'functions.php'; Should be: ? include 'functions.php'; when i run these i get this error Parse error: parse error, unexpected ';' in /usr/local/apache/htdocs/sims/php/functions.php on line 12 In future please indicate which is line 12! -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* To thine own self be true. (If not that, at least make some money.) */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php