Re: [PHP-DB] Is this redundant? {OT}

2003-10-06 Thread David Smith
Robin Kopetzky wrote: Good afternoon. I found this code in a program I'm renovating and think this is very redundant. Also, it does slow queries down while doing all of the conversions. prod_id in the mysql database is declared an integer. SQL above where prod_id = ' . (int)$prod_id . '

Re: [PHP-DB] stripping carrige returns with SQL

2003-09-26 Thread David Smith
If you are trying to replace the carriage return it needs to be \r instead of \ n in your query. Also it may not work because in my experience the replace function under mysql does not replace them in the db but in the query results. If you are looking to replace them permanently you will need a

Re: [PHP-DB] best upload method

2003-09-13 Thread David Smith
); ftp_quit($conn_id); how depends on the application ? - Original Message - From: David Smith [EMAIL PROTECTED] To: open-mind [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, September 12, 2003 9:04 PM Subject: Re: [PHP-DB] best upload method which is the best upload file

Re: [PHP-DB] best upload method

2003-09-12 Thread David Smith
which is the best upload file method ? file uploads or FTP commands from PHP Now that's the most open ended question I've read all day. Here, flip a coin. If it falls heads, FTP. If it falls tails, the other one. Even still, I'm not sure I understand the question: File uploads or FTP command

Re: [PHP-DB] RH 8.0 Mysql help

2003-09-09 Thread David Smith
One comand and you are done: apt-get install mysql-server httpd php php-mysql Don't have apt for RedHat? Download this: http://ftp.freshrpms.net/pub/freshrpms/redhat/8.0/apt/apt-0.5.5cnc6-fr0.rh80.1.i386.rpm and run 'rpm -i' on it. There's no better way to install software than apt.

Re: [PHP-DB] copy tables between db's

2003-09-07 Thread David Smith
Have you tried something like this: insert into database1.tablename select * from database2.tablename; database1 and database2 are the names of the two databases. tablename is the name of the table you want to copy from database1 to database2. In your case I guess this would be: insert

Re: [PHP-DB] copy tables between db's

2003-09-07 Thread David Smith
David Smith wrote: insert into database1.tablename select * from database2.tablename; database1 and database2 are the names of the two databases. tablename is the name of the table you want to copy from database1 to database2. Correction: from database2 to database1, not vice versa

Re: [PHP-DB] how to recognize user login name?

2003-09-04 Thread David Smith
Spychaa Wojciech wrote: I have to do user recognizing in m php project. Simplest method i know is to recognize for example login name (when user is logging into his local PC) I've tried to use $USERNAME variable but it isnt what i want because it recognize login name on server not remote user If

Re: [PHP-DB] copy files (ftp?)

2003-09-04 Thread David Smith
Lars Jedinski wrote: I have to copy files created with php on www.aaa.com to another domain, e.g. www.bbb.com Is and if how is this possible with PHP? If you have an FTP server running on www.bbb.com, then it is possible. Here are the relevant functions: http://php.net/ftp And here's some

Re: [PHP-DB] how to recognize user login name?

2003-09-04 Thread David Smith
quote who=CPT John W. Holmes I've tried to use $USERNAME variable but it isnt what i want because it recognize login name on server not remote user If you are referring to the Windows login name, this is not possible with PHP via the web browser. Sure it is. It's usually in

Re: [PHP-DB] Problem in executing linux command from PHP

2003-09-02 Thread David Smith
Gnanavel wrote: I have problem in executing linux command $output=exec(ls -a); echo pre$output/pre; the above coding works, but $output=exec(cp file1 file2); echo pre$output/pre; does not works. can any one help me out of this problem When I was executing the cp command it doesn't return

Re: [PHP-DB] Database backup

2003-08-27 Thread David Smith
Just do a mysqldump on the command line. It will dump a whole bunch of SQL code that can be used to recreate the database in the event of disaster. You could even pipe the output to gzip to compress it. mysqldump --all-databases -u root | gzip -c mysql_backup.gz That works fine for me.

Re: [PHP-DB] Comparing tables

2003-08-26 Thread David Smith
quote who=Ron Allen I would like to compare 2 tables in a database to determine which records are different!!! Any clues out there. Thanks in advance! You didn't say which DBMS you are using. If you're using a DBMS which supports INTERSECT (not MySQL), and assuming the two tables have the

Re: [PHP-DB] subtracting dates...

2003-08-02 Thread David Smith
Try this (taken from http://us2.php.net/manual/en/ref.datetime.php): *menaurus at gmx dot de* 16-Jul-2003 02:37 |The argument has to be in the standard mysql format (y-m-d)... function age($date) { if (!$date) return false; $year=0+substr($date,0,4); $month=0+substr($date,5,2);

Re: [PHP-DB] hi (php-SSH)

2003-07-28 Thread David Smith
Suman Aluru wrote: hi , is there any way to write a PHP program for SSH. I want to establish a SSH connection and work some commands in the remote system and close the connection. Yes, just do this (uses an SSH key file): ?php echo Executing remote command...br /; echo `ssh -i

RE: [PHP-DB] Formatting numbers

2003-07-24 Thread David Smith
Thanks. That works perfectly. David Smith -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 3:36 PM To: David Smith; php-db Subject: Re: [PHP-DB] Formatting numbers I am a little new to PHP, but I am trying to pull numbers from

Re: [PHP-DB] Downloading Database?!?!

2003-07-23 Thread David Smith
make it a little simpler so that you can plan for 14 weeks of whatever you're doing. David Smith On Wed, 2003-07-23 at 01:32, Stephen March wrote: Have you considered using the console-tool, mysqldump? You could write a quick script ... say mysqldump -u adminuser -p adminpass --all

Re: [PHP-DB] Error notice

2003-07-12 Thread David Smith
You are referencing variables that you have not created (or perhaps array indexes that don't exist). To suppress these messages, fix your code to not do such things, or just put this at the top of your scripts: error_reporting( E_ALL ^ E_NOTICE ); Or edit php.ini to make it happen globally:

Re: [PHP-DB] Using fopen() for internet URL

2003-06-08 Thread David Smith
Tony S. Wu wrote: I have an auto-update script to gather some information from other web pages to update information in my database. And i use fopen() to open the URL. as far as i know, the return result contains image, which i don't need. If you call fopen()/fread() on a web page that

Re: [PHP-DB] Removing cart items with hyperlink question

2003-06-08 Thread David Smith
Boa Constructor wrote: The first line below works but the second one doesn't. If $quantity were to equal 0 then I want both of these to do exactly the same thing. echo Input type=text size=2 name=quantity[$buy] value=$quantity; echo a href=$PHP_SELF?quantity[$buy]=0Remove Item/abr; Are you

Re: [PHP-DB] Anyone know what Error 502 Bad Gateway means?

2003-04-12 Thread David Smith
Try this out: http://www.checkupdown.com/status/E502.html Robert Johnson wrote: Hi all. I'm getting this error using Dreamweaver MX, php and mysql on a IIS server over my intranet. I can't figure out what it means... it happens when I try to connect to a table using php. TIA, Robert -- PHP

Re: [PHP-DB] temporary files

2003-03-23 Thread David Smith
You might consider using tmpnam() instead. tmpnam() doesn't give you a file handle (like tmpfile() does), but rather a file name. Just pass it a directory (like /tmp) and a prefix to help identify it (can be ). It returns the unique file's name, and you could open a file handle to it with

Re: [PHP-DB] Display results on html page

2003-03-20 Thread David Smith
You appear to have a ton of extra braces. I've modified your code below. That should do it, though keep in mind that your HTML is faulty too, though most browsers will probably tolerate it. :) --Dave Michelle Whelan wrote: I am looking to display results of a query inside of an html table.

Re: [PHP-DB] Not seeing whats wrong with code

2003-03-19 Thread David Smith
Mike Delorme wrote: Hello, I am trying to write a script that conects to mysql, then SHA database. Then I need to list ALL the rows of table members. It sais there is a error on line 18. The while statement is on line 18, and I cant firgure out whats wrong with it: ? $host = localhost; $uname =

Re: [PHP-DB] mysql_connect() problem

2003-03-17 Thread David Smith
You need to install the php-mysql rpm. You can get this on your RedHat CD, or through apt-get: apt-get install php-mysql Get apt here: http://apt.freshrpms.net/ Does the PHP project ever plan to do something as impressive as CPAN so users won't have to reinstall or recompile just to extend its

Re: [PHP-DB] Authenticating through a php script

2003-01-09 Thread David Smith
Jeremy, LDAP authentication happens in two stages: connect and bind. The connect stage is just establishing a connection with the LDAP server (ldap_connect()). No username or password is necesary in this stage. Once your connection is established, you attempt a bind (ldap_bind())to verify a

Re: [PHP-DB] Authenticating through a php script

2003-01-09 Thread David Smith
is the query string you want to post. it must be urlencoded. if you want the current querystring you can use $QUERY_STRING. the second arg is the domain and the third is the file (or script) that is getting posted to. ? At 10:28 AM 1/9/2003 -0700, David Smith wrote: Jeremy

Re: [PHP-DB] Re: blob

2003-01-08 Thread David Smith
On Wed, 2003-01-08 at 06:50, [EMAIL PROTECTED] wrote: i know this is a bit down the chain, but i'm trying to keep the message strings in tact but can't you set up your directory just like you set up your mysql Grants. I have a directory that the web user owns, who is in its own group.

Re: [PHP-DB] Re: blob

2003-01-07 Thread David Smith
On Tue, 2003-01-07 at 15:52, [EMAIL PROTECTED] wrote: I agree with this method. i have not yet seen an advantage of storing blobs in a database. Is there one? i'm sure those on this list would have an opinion if there was one. personally, i like storing all this stuff on the file system.

Re: [PHP-DB] Query with optional params

2003-01-05 Thread David Smith
Rich, When I do searches with multiple fields, I construct the SQL string on the PHP side. You can do something like this: $sql = SELECT * FROM docmeta WHERE ; if( $PartNumber ) $sql .= PartNumber='$PartNumber'; if( $Title ) $sql .= AND Title='$Title'; and so on... That has

Re: [PHP-DB] MySQL Ques: default for date field be current date

2002-12-17 Thread David Smith
This can be done using the 'timestamp' type for your column. Note that this field will be updated to the current time any time the row is modified (including when it is created). An alternative is to do it on the scripting side with the MySQL NOW() command like so: INSERT INTO your_table

Re: [PHP-DB] php and mysql

2002-12-07 Thread David Smith
Three words: php dot net --Dave On Fri, 2002-12-06 at 23:19, Jason Wong wrote: On Saturday 07 December 2002 11:54, Dallas wrote: hey, i'm just new to using php and mysql i would like to know how to do the following for a assignment of mine (shopping site):- and if I could ask for

Re: [PHP-DB] multiple table inserts at the same time

2002-12-07 Thread David Smith
These two methods are nearly identical. Practically, you will probably never see a performance difference. The time it takes to perform a query is an order of magnitude greater than the time it takes to allocate space for and iterate through an array. I would imagine that you will never notice a

Re: [PHP-DB] Re: PHP/MySQL not available remotely...

2002-12-04 Thread David Smith
Are you able to connect to the MySQL server from the command line using a non-php client? --Dave On Wed, 2002-12-04 at 09:04, [EMAIL PROTECTED] wrote: do you have the persmissions set either for [EMAIL PROTECTED](which would only work from remotehost.com) or username@'%' (which would work

Re: [PHP-DB] some data output formatting and grouping question...

2002-12-02 Thread David Smith
I don't see an easy way to do this in one SQL statement. But, the following PHP does the trick for me (assuming MySQL): // get the list of Y values $r = mysql_query( SELECT * FROM table GROUP BY Y ); while( $y_val = mysql_fetch_array( $r ) ) $y_vals[] = $y_val['Y']; // For each Y, fetch

[PHP-DB] HTTP Authentication with MySQL/PHP

2002-11-17 Thread David Smith
I have a directory 'admin' that has been .htaccess'ed off. Ie, If you point your browser at that directory, you will be prompted with an HTTP authentication dialog. Nothing special about PHP or MySQL there. I like the security that .htaccess and Apache give me. Now, I have users in a MySQL table

Re: [PHP-DB] Select Fields

2002-11-06 Thread David Smith
Tyler, You probably need one or two of the following: 1. Put single-quotes around case in your SQL (where type like 'case') 2. Use wild-cards in your where statement (where type like '%case%') Good luck! --Dave On Wed, 2002-11-06 at 23:31, Tyler Whitesides wrote: Hi, Sorry if this is

Re: [PHP-DB] global vars

2002-10-30 Thread David Smith
When you redirect, you lose your variables. This means that you must send them in some form to the other script. If you change your redirect command to the following, you will see that $a gets transferred and echoed in the second script as well as the first: Header(Location: second.php?a=$a);

Re: [PHP-DB] Server Upgrade and DB Move(s)

2002-10-15 Thread David Smith
On Tue, 2002-10-15 at 15:31, [EMAIL PROTECTED] wrote: and the file copy method just seems to easy, it almost seems wrong ;-), This is a feature that is pretty nice about MySQL. You cannot do this with Postgres, which caused my quite a few nice headaches over the summer. You must dump the