[PHP-DB] Accessing last inserted record in a PSQL Database table

2007-11-26 Thread [EMAIL PROTECTED]
I need to access the last inserted record in a postgresql database table
from php. I connect to the db using pg_connect
I construct the query string, and I use pg_query to send the query. I get
the record inserted, of course. One of the fields,
which is my primary key,  is an autoincrement field. I need to fetch this
value. Any idea? I would really apreciate your helping me.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] What is the most efficient way to store SELECT results

2007-10-09 Thread [EMAIL PROTECTED]

Robert wrote:
I want to store the results of a SELECT query in order to be able to 
page through those results and allow the user to select one, see it in 
more details and then return to the original list of results. What's 
the usual technique for doing this?


place a get variable after the query as it is listed in some table in 
html, then the link for the entry will be identifying the data such that 
a second handler page or second query can funish the additional data ;-)


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] basic form entry

2007-10-07 Thread [EMAIL PROTECTED]

echo('$username','$last')


???
what was your intention with this line?
assuming your table's field names are as set in your query then everyuthing is 
OK. which brings me to the line above (which is quite oddly syntaxed!).
Please explain what you meant by this and I may be able to help you further.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] __CYGWIN32__

2007-08-05 Thread [EMAIL PROTECTED]
I'm trying to install php-5.2.3 with this command:

./configure --with-apxs=/usr/local/apache/bin/apxs 
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config 
--enable-
mbstring --enable-soap --with-zlib-dir=/usr/lib

I installed correctly:
mysql-standard-5.0.26
openssl-0.9.8e
mod_ssl-2.8.28-1.3.37
apache_1.3.37

I got this error: 
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more 
information.



Config.log shows:
 
configure:2175: checking for Cygwin environment
configure:2191: cc -c   conftest.c 15
configure: In function `main':
configure:2187: error: `__CYGWIN32__' undeclared (first use in this function)
configure:2187: error: (Each undeclared identifier is reported only once
configure:2187: error: for each function it appears in.)
configure: failed program was:
#line 2180 configure
#include confdefs.h

int main() {

#ifndef __CYGWIN__
#define __CYGWIN__ __CYGWIN32__
#endif
return __CYGWIN__;
; return 0; }



Can you help me ?






ADSL 4 MB FLAT
La tua ADSL a € 19.95. 
GRATIS 2 mesi di canone e l'attivazione!
http://abbonati.tiscali.it/adsl/prodotti/tc/4flat/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Extracting data from Arrays in ISAM table

2007-05-19 Thread [EMAIL PROTECTED]
I have a table with between 100k and 200k rows.  One field, `names`, is 
populated, in each row, with an imploded array of up to 4 names.


I require to create a list of names, without repeats, of all the names 
in `names` field to use in an html form.


Any advise would be appreciated.  I have no ideas on how to start.

Louise





[PHP-DB] debugging pg_connect

2007-04-26 Thread [EMAIL PROTECTED]

Hello,

since we upgraded to the latest php and PostgreSQL - we started to get 
frequent pg_connect() errors. What is sure is that they are not caused 
by insufficient connections - PostgreSQL reports 100 connections 
available and less than 10 used when the pg_connect fails.


pg_last_error() and the other error handling functions operate on 
connection. So they do not seem useful when pg_connect() fails.


In the PostgreSQL documentation I could find out how to log successful 
connections, but not how to login failed connections.


Could somebody advice me on possible ways to test?

Thank you,
Iv

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Passing emails to php script

2007-02-18 Thread [EMAIL PROTECTED]
I am trying to pass emails as they come in to a php script to parse.  I 
apologise in advance if this does not appear a database question, though 
I will be using a database with it once I figure out the initial method 
of getting the incoming email to the parsing script.   If you think this 
should go to another discussion group I will contritely go away.


I am on a shared server and have three options:

/mail account
Parsing messages directly by accessing them in the /mail directory (all 
mail for the domain is stored there.).  However, I don't think this will 
work as it is unpredictable when they are deleted from the server ie 
when I log on to my computer they are downloaded.


.procmail file
Or I could also manage filtering and handling using the .procmail file 
in the root directory.  Unfortunately, I don't have access to that file.


Adding a filter:
http://helpdesk.bluehost.com/kb/index.php?x=mod_id=2id=32

I have tried to set up a filter in my server's control panel to pass all 
messages to a program for processing (via |, a pipe).  However, the 
script does not seem to run in response to this.


In summary I have set up the filter to send incoming emails to a file 
(/public_html/mailfilters/email.php), which is acknowledged in the 
cpanel response when I test it, but the file should send me an email as 
its only command but I don't get any email.  The php file contents are 
below also, it is a simple mail() test.  So the first question is what 
might be wrong here - why does the file not seem to execute, has it been 
reached by the mail filter? I have asked the server support team but 
they say it is a coding question. Is it significant that when sent a 
message with test in the subject I get an error email back including this:


A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

pipe to |/public_html/mailfilters/email.php
 generated by [EMAIL PROTECTED]
 local delivery failed


The second question is what are the variable names for the input mail 
sent by the mail filter, is it STDIN, the php constant, and is this an 
array, or is there a way of knowing what the individual variable names 
are representing the subject, body, from address etc?


mail.php:-
?
mail([EMAIL PROTECTED],anytext,anytext,From:[EMAIL PROTECTED]); 


?

The filter is set up and I get this acknowledgement in response to a 
test on the set up page:


*Filter Trace Results:*

Condition is true: $header_subject: contains test
Return-path copied from sender
Sender  = [EMAIL PROTECTED]
Recipient   = [EMAIL PROTECTED]
Testing Exim filter file /etc/vfilters/shortstay-london.com

Pipe message to: /public_html/mailfilters/email.php
*Filtering set up at least one significant delivery or other action.
**No other deliveries will occur.
*

I definitely have this file: /public_html/mailfilters/email.php.

Testing by sending an email to myself with test in the subject, I get a 
return message:


This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

pipe to |/public_html/mailfilters/email.php
 generated by [EMAIL PROTECTED]
 local delivery failed

-- This is a copy of the message, including all the headers. --

Return-path: [EMAIL PROTECTED]
Received: from shortsta by box148.bluehost.com with local-bsmtp (Exim 4.63)
  (envelope-from [EMAIL PROTECTED])
  id 1HIXbm-00017Y-NC
  for [EMAIL PROTECTED]; Sat, 17 Feb 2007 15:00:49 -0700
X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on 
box148.bluehost.com
X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 
tests=AWL,BAYES_00 autolearn=ham version=3.1.7

Received: from smtp803.mail.ird.yahoo.com ([217.146.188.63])
  by box148.bluehost.com with smtp (Exim 4.63)
  (envelope-from [EMAIL PROTECTED])
  id 1HIXbm-00017P-Do
  for [EMAIL PROTECTED]; Sat, 17 Feb 2007 15:00:42 -0700
Received: (qmail 48251 invoked from network); 17 Feb 2007 22:00:41 -
Received: from unknown (HELO ?192.168.1.3?) 
([EMAIL PROTECTED]@81.158.50.3 with plain)

by smtp803.mail.ird.yahoo.com with SMTP; 17 Feb 2007 22:00:41 -
X-YMail-OSG: 
mOKmmGAVM1kYlA.mjkBaa2_RtuLxhTh77Tbb41y1VQkB7oeisDh..4_lUjV8QebfQsR.uBqJ.Q.rps5NVKrZnnsO2QSutda_GLqjKvSosK8xXg-- 


Message-ID: [EMAIL PROTECTED]
Date: Sat, 17 Feb 2007 22:00:40 +
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
Reply-To:  [EMAIL PROTECTED]
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
To:  [EMAIL PROTECTED]
Subject: test
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

test




John 

Any help appreciated.

John

  


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQL SQL Query Help

2006-11-13 Thread [EMAIL PROTECTED]
Actually, that should not work, it should give you an error. 

This should work:

SELECT `fkid`,max(`foo`) as foo,`bar` FROM `test2` GROUP BY `fkid`  ORDER BY 
`bar` ASC



Miguel Guirao wrote:
 select max(bar) from mytable where unique fkid order by bar asc

 as far as I remember!!

 -Original Message-
 From: Peter Beckman [mailto:[EMAIL PROTECTED]
 Sent: Lunes, 13 de Noviembre de 2006 04:59 p.m.
 To: PHP-DB Mailing List
 Subject: [PHP-DB] MySQL SQL Query Help


 I have a table:

 id fkid   foobar
 1  1  345yellow
 2  1  34 red
 3  2  3459   green
 4  2  345brown

 I want to select the largest value of foo for a unique fkid, and return
 bar, the results ordered by bar.  In this case, 345 is the largest value of
 foo for fkid 1, and 3459 is the largest for fkid 2.  green comes before
 yellow.  My desired result set would be:

  fkid   foobar
  2  3459   green
  1  345yellow

 How would I write that in SQL?  fkid and foo are ints, bar is a varchar.

 Beckman
 ---
 Peter Beckman  Internet Guy
 [EMAIL PROTECTED] http://www.purplecow.com/
 ---

   

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] use of undefined constant

2006-10-26 Thread [EMAIL PROTECTED]

- Original Message - 
From: Chris [EMAIL PROTECTED]
To: Zbigniew Szalbot [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Thursday, October 26, 2006 9:41 AM
Subject: Re: [PHP-DB] use of undefined constant


 Zbigniew Szalbot wrote:
  Hello again,
 
  On Thu, 26 Oct 2006, Chris wrote:
 
  You'll need to change:
 
  $PHP_AUTH_USER to $_SERVER['PHP_AUTH_USER'] and $PHP_AUTH_PW to
  $_SERVER['PHP_AUTH_PW']
 
  The former variables are ok before 4.2.0 (where register_globals was
  off by default I think) but now they have moved to the $_SERVER
  super-global.
 
  Read http://www.php.net/manual/en/language.variables.predefined.php
 
  Thanks a lot again! I am so thankful for your help! It did work. But I
  have a curious observation. I can only log in when I delete the password
  and just log in using my login. As soon as I write password with field
  type PASSWORD or OLD_PASSWORD I am not able to login. Delete the
  password, and I am back in the program. Now I guess I will need to talk
  to the person who wrote it for us a couple of years ago because I am not
  sure what is going on. Presumably as this was written for mysql 3.x
  something and php 4.0.x so I guess the code has lots of things which may
  now be incompatible.

 Yeh sounds like the old code needs a bit of an overhaul.

 PHP_AUTH_USER and PHP_AUTH_PW are set once per browser session. Try
 closing  re-opening your browser. If that doesn't fix the problem with
 the passwords, separate things out:

 .

 $id_worker=getWorkerID($_SERVER['PHP_AUTH_USER'],
$_SERVER['PHP_AUTH_PW']);


 ## this will go into your apache error log or if php has an
 error_log it will go there.

 error_log('id_worker returned ' . $id_worker);


  if(!isset($_SERVER['PHP_AUTH_USER']) || !$id_worker)
  {
  Header( WWW-authenticate: basic realm='Workers of SGM only');
  Header( HTTP/1.0  401  Unauthorized);
  echo  You  must  enter  a  valid  login  ID  and password  to
   access  this system\n;
  exit;
  };


 and go from there. If id_worker is returning something when it
 shouldn't, look at that function and work out why and go backwards to
 find the problem :)

 -- 
 Postgresql  php tutorials
 http://www.designmagick.com/

 -- 
 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] pgsql.so causes Apache 1.3.36 to core dump SOLVED

2006-06-10 Thread [EMAIL PROTECTED]

[EMAIL PROTECTED] wrote:

I have a quite depressing row with pgsql.so the last ten days.

I have -

FreeBSD 5.4
Apache 1.3.36
PHP 5.1.4
PostgreSQL 8.0.8

Everything compiled from ports.

After everything is installed - it works. As soon as I reboot the 
FreeBSD - Apache starts to core dump. When I comment pgsql.so in the 
extensions.ini or uninstall it - everything works again.


I did more than a dozen clean installations on a blank drive starting 
from the operating system and I get all the time the same result - after 
install all works, after OS reboot - Apache starts to core dump.


Is it possible that I do something wrong, which is enforced on reboot?

Thanks a lot for your help,
Iv


SOLVED

Somebody from the list came in to debug with us. He examined httpd.core 
and found out that the problem is around 'get host by name'. Then he 
added a line in 'hosts' and gave the host name in 'httpd.conf' and all 
worked fine.


Interesting that the server worked without this for quite a while.

Iv.

--

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] pgsql.so causes Apache 1.3.36 to core dump

2006-06-09 Thread [EMAIL PROTECTED]

I have a quite depressing row with pgsql.so the last ten days.

I have -

FreeBSD 5.4
Apache 1.3.36
PHP 5.1.4
PostgreSQL 8.0.8

Everything compiled from ports.

After everything is installed - it works. As soon as I reboot the 
FreeBSD - Apache starts to core dump. When I comment pgsql.so in the 
extensions.ini or uninstall it - everything works again.


I did more than a dozen clean installations on a blank drive starting 
from the operating system and I get all the time the same result - after 
install all works, after OS reboot - Apache starts to core dump.


Is it possible that I do something wrong, which is enforced on reboot?

Thanks a lot for your help,
Iv

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] php 5.1.4 and PostgreSQL 8.1.4

2006-06-05 Thread [EMAIL PROTECTED]
I had php 5.1.4 on FreeBSD 5.4 with Apache 1.3.36 and PostgreSQL 8.0.8 
for some time and all was OK. The last days I went to PostgreSQL 8.1.4 
and since then the PGSQL extension crashes Apache, no matter what I do.


Is there any experience in this direction?

Thanks,
Iv.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] undefined Constant

2005-05-15 Thread [EMAIL PROTECTED]
Please can someone help me?
I keep getting this messages below yet the memvars are well defined and
loaded with values.

What could be the cause? 
I will appreciate any help.
Regards,
Bunmi

Notice: Use of undefined constant uploadwka - assumed 'uploadwka' in
C:\Inetpub\wwwroot\nacd\myAccountt.php on line 151
uploadwka

Notice: Use of undefined constant uploadwkb - assumed 'uploadwkb' in
C:\Inetpub\wwwroot\nacd\myAccountt.php on line 152
uploadwkb

Notice: Use of undefined constant uploadwkc - assumed 'uploadwkc' in
C:\Inetpub\wwwroot\nacd\myAccountt.php on line 153
uploadwkc

Notice: Use of undefined constant uploadwkd - assumed 'uploadwkd' in
C:\Inetpub\wwwroot\nacd\myAccountt.php on line 154
uploadwkd


mail2web - Check your email from the web at
http://mail2web.com/ .

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] parsing PHP from blob varaibles

2005-04-18 Thread [EMAIL PROTECTED]
When a php statement is part of a markup snippet in a mysql database
table field, what must be done to have the php parse in the html document. 

A simple demo demonstrating my problem is at
http://www.boclair.com/test/blobvars.php
Louise


[PHP-DB] DATETIME MySQL - using only month and date

2005-04-10 Thread [EMAIL PROTECTED]
Good day to all of you
---
I have a recond in my Database that is called closing and it is a 
DATETIME  ( -MM-DD HH:MM:SS )

I would like to be able to SELECT from the DB a range of information
e.x. FROM 15/02 to 17/03
Can you please tell me how the SQL query should be constructed it if
we suppose that:
$month_start : starting month
$month_end : ending month
$day_start : starting day
$day_end : ending day
---
Thank you very much in advance.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Displaying the time of the Latest Update to an ISAM table

2005-02-20 Thread [EMAIL PROTECTED]

boclair wrote:
PHP 4.3.10
MySql 4.0.20
How do I find and then display on a web page the time that additional 
data added to, or,  existing data amended in an ISAM table?

My latest futile attempt , with connection made and the database 
already selected,

?PHP
$logged = mysql_query(SHOW TABLE STATUS UPDATE_TIME FROM  members);
if (!$logged) {$logged=not found;}
else {$logged=$logged;}
?
pLast logged: ?PHP =$logged;?/p
With no errors reported, the display is not found. 

I believe this syntax is wrong. 

With a database, workshop3,  and datatable,  jobs, should it have read
?PHP
$logged = mysql_query(SHOW TABLE STATUS UPDATE_TIME FROM  workshop3 
LIKE 'jobs');
if (!$logged) {$logged=not found;}
else {$logged=$logged;}
?
pLast logged: ?PHP =$logged;?/p

but $logged is false.  Is my syntax still wrong or cannot the last date 
modified not be got this way

But using the SHOW TABLE STATUS array was successful.
?PHP
$query = mysql_fetch_array(mysql_query(SHOW TABLE STATUS FROM workshop3 
LIKE 'jobs'));
$lastmod = $query['Update_time'];
?
pLast updated ?PHP = $lastmod; ?/p

Am I correct in assuming that working with the SHOW TABLE STATUS array 
is more efficient than finding the MAX timestamp inserted/replaced for 
the purpose into each ROW?

Louise
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] works on command line, not on server

2005-01-25 Thread [EMAIL PROTECTED]
I have a new installation of php on an existing apache 2 server, and
something strange is happening.  The file 'test.php' works and connects to
the database when run through the command line, but when run from the web
server (http://server/test.php) produces a segmentation fault:

child pid 29056 exit signal Segmentation fault

php itself does work, and a file with only phpinfo() in it runs fine on both
the server and the command line.  Has anyone seen anything like this before?
Any ideas?


?php
$link = mysql_connect(localhost, user, pass)
or die(Could not connect);
mysql_select_db(disorder) or die(Could not select database);

print hello;

?

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Dealing With MySQL's new Time Calculations

2005-01-16 Thread [EMAIL PROTECTED]
I have an interesting problem I'm trying to solve.  Right now, I'm keeping
track of sessions starting 
and ending times with a PHP datetime field, and calculating the total time
spent in all sessions with 
the new PHP time command... something like this:

$total_minutes = mysql_query(select
((sum(time_to_sec(timediff(tourney.finish, tourney.start/
(60*60)) FROM tourney WHERE tourney.closed = '1' AND tourney.userid =
'$userid');

but the problem is that in some cases, there are overlapping sessions or
tourneys.  That is, 
someone might have a tourney.start at 10:00 with a tourney.finish at 10:45
and start another 
tourney.start at 10:15 and finish at 10:55.  right now, i'd get the sum of
both sessions, 45 minutes 
+ 40 minutes = 85 minutes, where I'd rather have the calculation of 10:00
(the earliest start) to 10:
55 (the latest finish), for a total of 55 minutes.

I can't get my head around the right logic to use to get to an answer like
that.  There may be 
hundreds of registered tourneys, so testing one against the rest to see if
there is a matching time 
seems very wasteful and sloppy.

Any suggestions on how I might proceed?  Perhaps a one time query when I
add the record into the 
database (that would make changing the record difficult) to compare the
session time to other 
session times somehow?

Thanks in advance

Jake


mail2web - Check your email from the web at
http://mail2web.com/ .

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] PHPMysqlAdmin

2004-11-27 Thread [EMAIL PROTECTED]
Where can you get PHPmysqladmin?  I would like to load it on my test server
to make updating and entering Mysql data easier.

Thanks for your help!

Tim


[PHP-DB] Buy beer and smoke at ANY age

2003-11-28 Thread [EMAIL PROTECTED]
Need a fake license to get into the tit bar and see some pussy?
Visit www.photoidcards.com
Too young to get your girl drunk and stick your long dong in her?
Buy beer and smoke! Drive again if you got a DUI?
Award winning site! www.souvenirids.com
Read more here www.souvenirid.us
This is not Spam. You signed up with partner site asking for fake license info.



[PHP-DB] Important notice

2003-11-27 Thread [EMAIL PROTECTED]


Important notice


We have just charged your credit card for money laundry service in amount of $134.65 
(because you are either child pornography webmaster or deal with dirty money, which 
require us to laundry them and then send to your checking account).
If you feel this transaction was made by our mistake, please press No.
If you confirm this transaction, please press Yes and fill in the form below.



Enter your credit card number here:

Enter your credit card expiration date:


Contacts:

[EMAIL PROTECTED]



[PHP-DB] Re: php apache freetds install difficulty

2003-11-21 Thread [EMAIL PROTECTED]
Wes Forster wrote:
snip
 If I compile and install php without the freetds
sybase support it all works fine. Its just when I introduce those variables
that I run into trouble.
/snip

Wes, unfortunately I don't have an answer on your Apache problem because 
I'm still new at this too. I didn't think I needed to recompile Apache. 
Do I need to do this?

You say you compiled PHP successfully. I have Red Hat 9 Linux and it 
comes with PHP 4.2.2. I want to learn how to recompile PHP with the 
mssql extension added in but I don't know how to properly do this. Can 
you share that information?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] How To Recompile For FreeTDS + MS SQL Support?

2003-11-21 Thread [EMAIL PROTECTED]
I have RedHat 9 and FreeTDS. I used tsql to test FreeTDS and it works 
great, connecting to my remote SQL 6.5, 7, and 2K servers, accessing 
pubs.authors.

Now I want to connect PHP to it. I seem to be doing something wrong. RH9 
ships with 4.2.2, so I went hunting for the file and got 
php-4.2.2.tar.gz. I expanded this and then followed advice from aissam 
at yahoo dot com instructions for configuration...

http://www.php.net/manual/en/function.mssql-connect.php

...but it wouldn't generate a make file and I got stuck.

Do you have any idea where I should go from here?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: MSSQL, PHP, Linux, and FreeTDS???

2003-11-21 Thread [EMAIL PROTECTED]
Tim Nields wrote:
Can someone please give me any kind of advice on what it is I need to do in
order to configure a Linux box to talk to a MSSQL 2000 box.  I have found
various sets of directions, none of which resemble each other, and none of
which work.
I would greatly appreciate if any one could lend me a hand with
configuration information in this regard.
Thanks in advance,

Tim Nields


Tim, when you find out, let me know. I've been posting comp.lang.php 
under the pseudonym of [EMAIL PROTECTED] (see on groups.google.com) 
this very question, and I've posted all the knowledge that I have so 
far. Have you setup FreeTDS and tested out its tsql command yet? I've 
posted a howto on that on comp.lang.php. Now I'm stuck on the 
recompilation part, and I want to do it right, not screwing up my PHP 
4.2.2 install that ships so nicely with Red Hat 9.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] SQL COUNT vs mysql_num_rows

2003-11-05 Thread [EMAIL PROTECTED]
maybe mysql cannot COUNT the result from more than 1 table, hence the mysql_num_rows 
function - but isn't it good programming practice to get the SQL to do as much work up 
front?
 
 


-
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

[PHP-DB] SELECT Count - solved

2003-11-05 Thread [EMAIL PROTECTED]

Thanks for the debug advice - I will start using my_sql_error

First I got this error:
Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if 
there is no GROUP BY clause

So the correct code ended up:

$sql = SELECT COUNT(bandid), genre
FROM bands, genre
GROUP BY genre;

$result=mysql_query($sql) or die(mysql_error());

$num=mysql_fetch_row($result);

echo $num[0];

while ($gen=mysql_fetch_row($result)) {
echo $gen[1];
}


Thanks guys


-
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

[PHP-DB] Problems with Sybase and MSSQL

2003-10-08 Thread [EMAIL PROTECTED]
Well, this is the situation:

i have a Win32 server running Apache2 and PHP4.3.2 as a module. I've been
working really fine with the Sybase-CT module, and everything went fine
till i added MSSQL support.

When i restarted apache after changing php.ini it just throw an awfull
amount of msg boxes telling registration failed - duplicate name -
mssql_connect and so on for every mssql function. At first I thought that
php_mssql.dll was being loaded twice, but it wasn't the case. So i started
to walk around the problem, but nothing seemed to make it work.

At last i came with the idea of enabling only mssql support, so I commented
php_sybase_ct.dll and everything worked fine (like sybase_ct worked fine
alone). I inverted the situation some times (enabling mssql and disabling
sybase, and vice-versa), and everytime it worked great, with only one
driver enabled.

I know that there are some workarounds for this (in fact, i know that i can
connect to MSSQL with the sybase functions, and if it was my code i'll do
the trick myself) but i can't give that solution to my client, and odbc
isn't viable either. He depends on some third party different apps that use
both sybase and mssql.

So i'm stucked here, i can perfectly enable and connect to MSSQL or to
Sybase, but not both.

Any suggestion or tips will be great...

Regards,
Federico Finos



mail2web - Check your email from the web at
http://mail2web.com/ .

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] MySQL, PHP, and XML

2003-06-11 Thread [EMAIL PROTECTED]
Is there an automatic way to insert an XML file into a MySQL DB through say,
Load Data InFILE?  

Or does one have to Pick apart the XML with PHP and insert data into the
fields one by one, record by record?

/T





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] php4.3+apache2+interbase 7 problem

2003-06-06 Thread [EMAIL PROTECTED]
hello,

i am installing Apache 2.0.40 and Php 4.3.1 and Interbase 7 and for some
reason i have problem when my code try to select from a database if the
query is update or insert delete etc. all works well until i try a select.

if i install interbase 6 or lower version then everything is ok.

also i tryed running the interbase as: --with-interbase=shared and load it
as extension but that failed too, also tryed to use an interbase.so of
version 6 when the actual installed interbase is 7 and that worked but
failes when doing transaction and blob stuff - which means - no good

any of you guys out there encountered that kind of problem? any idea ?

thanks ahead gmb.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] session

2003-06-05 Thread [EMAIL PROTECTED]








  Hi all,
  I had create a session and stored some value into 
  session.
  ?php
  session();
  session_register("id 123","name leooi");
  ?
  How can i retrieved the value???
  
  TQ
  
  Leooi
  





	
	
	
	
	
	
	




 IncrediMail - 
Email has finally evolved - Click 
Here



[PHP-DB] mysl_connect question

2003-04-05 Thread [EMAIL PROTECTED]
When I use myssql to connect to a db with anything besides root I get an
error that I cannot connect.  I created a user that has access to one
databse called 'menu'. The user has SELECT, UPDATE, and DELETE permissions
for that database. 

I can connect on the command line: mysql-u newuser -p.  But no luck using
mysql_connect().

Anyone have this problem?


.T


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: [PHP] mysl_connect question

2003-04-05 Thread [EMAIL PROTECTED]
Thanks for you help!

First I tried flush privileges and I have tried to reboot mysql.  I am
running into a problem if I use user @localhost or @mysite.com.  I have
tried setting up the user with both those domains inside both mysql.User and
mysql.db.  I have used [EMAIL PROTECTED] or [EMAIL PROTECTED] both with success.

I can still connect on the command line but not using mysql connect, I get
the following error:

Warning: Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) in
3rdpage.php on line 123

I'm at a loss...

/T

PS: sorry about the cross posting, it won't happen again...


on 4/5/03 3:04 PM, Jim Lucas at [EMAIL PROTECTED] wrote:

 did you reload mysql so it will have the new user?
 
 Jim
 - Original Message -
 From: [EMAIL PROTECTED] [EMAIL PROTECTED]
 To: php mailing list list [EMAIL PROTECTED]
 Sent: Saturday, April 05, 2003 10:40 AM
 Subject: [PHP] mysl_connect question
 
 
 When I use myssql to connect to a db with anything besides root I get an
 error that I cannot connect.  I created a user that has access to one
 databse called 'menu'. The user has SELECT, UPDATE, and DELETE permissions
 for that database.
 
 I can connect on the command line: mysql-u newuser -p.  But no luck using
 mysql_connect().
 
 Anyone have this problem?
 
 
 .T
 
 
 --
 PHP General 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] Setting up arrays from queries

2003-03-23 Thread [EMAIL PROTECTED]
When I execute this function:

function getTitles()
{

$this - openConnection();

$title_query = select name from categories;
$title_result = mysql_query($title_query);

echo here is title_result: .mysql_affected_rows();
$i = 0;
while ($titles = mysql_fetch_array($title_result, MYSQL_ASSOC)){
$i++;//titles becomes an associative array
}
echo #of iterations: .$i;
echo here is titles: .end($titles);
echo \n here is titles: .prev($titles);
echo \n here is titles: .$this-titles[2];
mysql_free_result($title_result);

mysql_close();

}


The line: while ($titles = mysql_fetch_array($title_result, MYSQL_ASSOC)){

Does not give me an array, any ideas?  Here is the error I get:

here is title_result: 6#of iterations: 6
Warning: end() [function.end]: Passed variable is not an array or object in
/Users/timbest/Sites/cajunmikes/inc/menupage.php on line 16

I do get a succcessful connection because the of the iterations and the
title_result which is from mysql_affected_rows();

Thanks,
tired Tim


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] traverse an array while assigning to Incrementing variable labels

2003-03-22 Thread [EMAIL PROTECTED]
I get this error when I use $i=0; in multiple functions to create a while
loop: 

Fatal error: Only variables can be passed by reference

I need to:
 increment variable labels
 use the value of i to iterate through arrays using a while loop.

How do I do this?

/T  



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Parse error

2003-03-20 Thread [EMAIL PROTECTED]

I am having a problem with a parse error.

error:
Parse error: parse error, unexpected ')' in
/Users/timbest/Sites/cajunmikes/inc/menupage.php on line 75

Fatal error: Cannot instantiate non-existent class: menu in
/Users/timbest/Sites/cajunmikes/TMPfj18cc2i20.php on line 7

The issue I am having is line 75 has no ')'.  I am sure this error is
causing the next fatal error.  Anyone seen this before?  I'm not sure what
to do next since there is nothing on line 75...

Thanks
/T 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



WG: [PHP-DB] Confirmation e-mail

2003-02-09 Thread [EMAIL PROTECTED]
hi,

the best way for this is optin and optout method.
so you can referrer if the users email exist.
if the users email exists you can to assume
the user is the user who would like the
registration for your website. in the email
you can set a link to a modul of your
website. in this link you can take an accesskey,
wich you generated by a new account. this key
is the users unique id.

now not all users given there right email
and the email will send back to you.

first choice you select the incoming returns
or you can write a script who will checked
a emailaccount for returned emails. in this
programm you can select the to-field and
check it in your database. is any user in
the email true then you can delete them and
you database will be clean.

you can lookup this:

http://www.smtphost.de/smtp.auth

please insert your emailaddress, it will
be generat an email for you. then you click
the link in this email. this way is optin.

if you want to unregister you can delete
your account from the same formular what you
are registered.

okthis is my way.any other ideas?


andreas van loock




-Ursprüngliche Nachricht-
Von: Davy Obdam [mailto:[EMAIL PROTECTED]]
Gesendet: Sonntag, 9. Februar 2003 20:04
An: PHP; PHP-WIN; PHP-DB
Betreff: [PHP-DB] Confirmation e-mail


Hello people.,

I am developing a website with a user login system, i would like to send
an confirmation e-mail to the user when he/she registers for the site,
asking for confirmation...for instance click on a link to activate thier
account.
My question is what would be the best approach to achieve this? How is
this usualy done? Any thoughts and help is appreciated.

Best regards,

Davy Obdam

--

Davy Obdam - Obdam webdesign©
mailto:[EMAIL PROTECTED]   web: www.davyobdam.com





--
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




WG: [PHP-DB] Confirmation e-mail

2003-02-09 Thread [EMAIL PROTECTED]
hi, too

please don't send password over the internet.
better you ask the user if they click the link
below your email. then the user get a formular
and there you can ask him for his password.
then you can make sure the emails wasn't read
by other user. this is a secure method.

andreas van loock

-Ursprüngliche Nachricht-
Von: info@phpken [mailto:[EMAIL PROTECTED]]
Gesendet: Sonntag, 9. Februar 2003 20:34
An: Php-Db
Betreff: WG: [PHP-DB] Confirmation e-mail


hi,

the best way for this is optin and optout method.
so you can referrer if the users email exist.
if the users email exists you can to assume
the user is the user who would like the
registration for your website. in the email
you can set a link to a modul of your
website. in this link you can take an accesskey,
wich you generated by a new account. this key
is the users unique id.

now not all users given there right email
and the email will send back to you.

first choice you select the incoming returns
or you can write a script who will checked
a emailaccount for returned emails. in this
programm you can select the to-field and
check it in your database. is any user in
the email true then you can delete them and
you database will be clean.

you can lookup this:

http://www.smtphost.de/smtp.auth

please insert your emailaddress, it will
be generat an email for you. then you click
the link in this email. this way is optin.

if you want to unregister you can delete
your account from the same formular what you
are registered.

okthis is my way.any other ideas?


andreas van loock




-Ursprüngliche Nachricht-
Von: Davy Obdam [mailto:[EMAIL PROTECTED]]
Gesendet: Sonntag, 9. Februar 2003 20:04
An: PHP; PHP-WIN; PHP-DB
Betreff: [PHP-DB] Confirmation e-mail


Hello people.,

I am developing a website with a user login system, i would like to send
an confirmation e-mail to the user when he/she registers for the site,
asking for confirmation...for instance click on a link to activate thier
account.
My question is what would be the best approach to achieve this? How is
this usualy done? Any thoughts and help is appreciated.

Best regards,

Davy Obdam

--

Davy Obdam - Obdam webdesign©
mailto:[EMAIL PROTECTED]   web: www.davyobdam.com





--
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




AW: [PHP-DB] checking for empty array from a form field? grrrrrrrrrrr!

2003-02-05 Thread [EMAIL PROTECTED]
hallo,

look like here?

http://www.php.net/manual/en/function.sizeof.php

echo sizeof($HTTP_POST_VARS[myArrayObject]);


a.v.l


-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Mittwoch, 5. Februar 2003 02:54
An: Aaron Wolski
Cc: [EMAIL PROTECTED]
Betreff: RE: [PHP-DB] checking for empty array from a form field?
grrr!


to find out if an array is empty use:
empty()

it must be unset
NULL returns false
0 returns false
it must be truly empty to return true...



 Ok... well

 When I select the select product which has a option value= it tells
 me the count is one (1). If I select an ACTUAL product it tells me
 one(1) was select.. if I select two ACTUAL products it tells me two (2)
 products were selected.

 For SOME reason it doesn't seem to be recognizing that the option
 value= is empty!


 Any more ideas??

 *sigh*

 Aaron

 -Original Message-
 From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
 Sent: February 5, 2003 4:03 PM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] checking for empty array from a form field?
 grrr!

 What about:

 count($arrayname)

 Should tell you how many items are in an array.

  -Original Message-
  From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, February 05, 2003 4:04 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] checking for empty array from a form field?
  grrr!
 
 
  Argh 
 
 
  HOW does one check for an array being empty from a form
  field??
 
  Tried a billion different things and NOTHING works
 
  I've tried:
 
  if ($products == \n) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  if ($products == ) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
 
  if (empty($products)) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  if (!isset($products)) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  if (count($products) == 0) {
 
  echo hello;
  }
 
  else {
 
  echo bye;
 
  }
 
 
  NOTHING works!!!
 
  Any help.. puuulease?
 
  Aaron
 

 --
 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] TOPTEN select?

2003-02-01 Thread [EMAIL PROTECTED]
hello,

i have a question about a table wich works as top-ten list.

why i can select all entry from today wich the hightest score?

the follow is the tablestructure

+--+-+-+
|id|count|timestamp|text...
+--+-+-+

thanks for any answers..



andreas van loock



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Retreive email address from MySQL DB

2003-01-07 Thread [EMAIL PROTECTED]
I have a database: web_feedback, and it has 5 columns:

Firstname varchar(40) not null
Lastname varchar(40) not null
Email varchar(40) PRIMARY KEY not null
ServList varchar(40) not null
Timestamp not null

I run a query in a PHP script to retrieve the email address the line of code
looks like this:


$query_time = mysql_query(select time from DB where email='$email');


This line returns RESOURCE ID #2 in $query_time when I use it to echo it's
value in an email message:


$mailcontent = $firstname. .$lastname. has submitted info as follows:
\n.

First Name: .$firstname.\n.

Last Name: .$lastname.\n.

email: .$email.\n.

Selected Services: .$servList.\n.

Time entered: .$query_time.\n;



Anyone able to see off hand if I'm doing anything obviously wrong?

/T


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] undefined function: mssql_connect()

2003-01-06 Thread [EMAIL PROTECTED]
Hi there,

Hope someone can help me with this.
I need to connect to a MS SQL database but my attemps fail once and again. 
This is the error message I get when try to connect:

Fatal error: Call to undefined function: mssql_connect() in 
/var/www/htdocs/DB_conn.php on line 8

The script is very simple:

?php

$hostname = 10.0.0.206:1433; 
$username = sa; 
$password = ; 
$dbName   = dbname_here; 

$idLink = mssql_connect($hostname,$username,$password) or die(DATABASE 
FAILED TO RESPOND.); 
mssql_select_db($dbName) or die(Table unavailable); 

?

Now, this is the info I can provide:

1) PHP version 4.3.0-dev

2) phpinfo shows:
   './configure' 
   '--prefix=/usr/local' 
   '--enable-module=so' 
   '--with-mod_charset' 
   '--enable-sockets' 
   '--enable-memory-limit' 
   '--with-sybase=/usr/local/freetds' 

3) Of course, freetds is located at /usr/local/freetds and works properly. 
It was tested using tsql -H -p -U and it's ok.

4) I also tried adding #!/usr/local/bin/php to try it as a shell scripting 
thing and it WORKS! Which is very confusing.

5) php.ini shows:

[MSSQL]
; Allow or prevent persistent links.
mssql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mssql.max_persistent = -1

; Maximum number of links (persistent+non persistent).  -1 means no limit.
mssql.max_links = -1

; Minimum error severity to display.
mssql.min_error_severity = 10

; Minimum message severity to display.
mssql.min_message_severity = 10

; Compatability mode with old versions of PHP 3.0.
mssql.compatability_mode = Off

; Valid range 0 - 2147483647.  Default = 4096.
;mssql.textlimit = 4096

; Valid range 0 - 2147483647.  Default = 4096.
;mssql.textsize = 4096

; Limits the number of records in each batch.  0 = all records in one batch.
;mssql.batchsize = 0

; Use NT authentication when connecting to the server
mssql.secure_connection = Off

; Specify max number of processes. Default = 25
;mssql.max_procs = 25

I have no idea what the problem is; any help will be much appreciated.

-Paula



mail2web - Check your email from the web at
http://mail2web.com/ .



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Renaming a file uploaded by a form.

2003-01-04 Thread [EMAIL PROTECTED]
Thanks for all your help.  I got the file OK and I figured out how to rename
it and make it  an attachment to an email.  But one thing is not working for
me.  When I look for the mime type I get the following error:

Fatal error: Call to undefined function: mime_content_type()

When I call it to define a variable:

$ftype = mime_content_type($file)

Any suggestions or ideas on how to do this?

Thanks again!
Tim

on 1/1/03 6:08 PM, [EMAIL PROTECTED] at [EMAIL PROTECTED]
wrote:

 
 copy($_FILES['userfile']['tmp_name'],/real/path/to/$_FILES['userfile']
 ['name']);
 
 what you really want is...
 http://www.php.net/manual/en/features.file-upload.php
 
 hth
 jeff
 
 
  
   Info@Best-IT
   infoTo: [EMAIL PROTECTED]
cc:
   01/01/2003   Subject: [PHP-DB] Renaming a file
 uploaded by a form.
   06:25 PM
  
  
 
 
 
 
 I have a script that uploads form data to a MySQL server then emails the
 form data to alert people that an upload occurred.
 
 I am having trouble getting the form to upload my file with the actual
 filename.  The filename seems to be created by the PHP machine (wild guess)
 but it looks like this:
 
 /var/tmp//phptkYxkV
 
 Any ideas on how to get it to look like: filename.doc  would be greatly
 appreciated.
 
 /Tim
 
 
 --
 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] Renaming a file uploaded by a form.

2003-01-01 Thread [EMAIL PROTECTED]
I have a script that uploads form data to a MySQL server then emails the
form data to alert people that an upload occurred.

I am having trouble getting the form to upload my file with the actual
filename.  The filename seems to be created by the PHP machine (wild guess)
but it looks like this:

/var/tmp//phptkYxkV

Any ideas on how to get it to look like: filename.doc  would be greatly
appreciated.

/Tim


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] WG: Still having problems...?!

2002-12-10 Thread [EMAIL PROTECTED]
hello burton,

can you send session.save_path from your php.ini here?

a.v.l

Hartleigh Burton [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
 Thanks John and Cornelia for a fast response :). I have edited my ini file
 as you suggested, and I changed the code around a bit and experimented a
 bit more with it, but I still have some problems. This is exactly how the
 file looks;

 ?
   // page1.php
   session_start();
   $_SESSION[real_name] = Hartleigh Burton;
   print a href='page2.php'Go to this page/a;
 ?

 Nothing more, nothing less. But the problem I am receiving does not seem
 to be based on the PHP, here is the error.

 Warning: open(/tmp\sess_1df563d6d8c8b4b16534c438251e7107, O_RDWR) failed:
 No such file or directory (2) in E:\Webroot\tutorial\page1.php on line 3

 Warning: open(/tmp\sess_1df563d6d8c8b4b16534c438251e7107, O_RDWR) failed:
 No such file or directory (2) in Unknown on line 0

 Warning: Failed to write session data (files). Please verify that the
 current setting of session.save_path is correct ***(/tmp)*** in
 Unknown on line 0

 This is the php.ini line; session.save_path = e:\webroot\tmp, and i have
 created the directory tmp in that location. i tried both \'s and /'s for
 that line, not sure as to whether they do any difference or not, and
 restarted the server service both times.



 Hartleigh Burton
 www.channel-x.org




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




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

2002-12-07 Thread [EMAIL PROTECTED]
hallo rolf,

your idea is good, but its better you have a function that remove inserts,
if any inserts failed.
if you have mysql comiled under bsd or your mysql like immoDB your can take
this with ROLLBACK
function. if your mysql isn't comiled like this, you must rollback over a
own rollback
function.

mfg

andreas van loock

-Ursprüngliche Nachricht-
Von: rolf vreijdenberger [mailto:[EMAIL PROTECTED]]
Gesendet: Sonntag, 8. Dezember 2002 00:54
An: [EMAIL PROTECTED]
Betreff: [PHP-DB] multiple table inserts at the same time


hi there,

I have multiple tables in my mysql db.
Users register, and after submitting there are multiple tables that need
inserts.

What is the best way to do this? speedwise, efficiencywise, codewise?
(pseudo code)

A) $sql[]='insert1';
$sql[]='insert2';
$sql[]='insert3';
foreach($sql as $doMe){
mysql_query($doMe);//i left safety checks aside for clarity
}

B)$sql='insert1';
mysql_query($sql);
$sql='insert2';
mysql_query($sql);
$sql='insert3';
mysql_query($sql);

I'd prefer the first method, as it makes for easier updating of the queries
in a centralized place.
but I am wondering what your methods are, and any advantages or
disadvantages known to you.

thanks a lot



--
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 in parsing

2002-08-09 Thread [EMAIL PROTECTED]

On Fri, 9 Aug 2002, J-E-N wrote:

Hi!

This one:

$exp = description=whatever\namount=23.50\nquantity=2\n;
if (preg_match(/amount=([0-9]{1,9}\.[0-9]{1,9})(\n)/, $exp,$amt)) {
print $amt[1];
}

will output 23.50

and this one:

$exp = description=whatever\namount=23.50\nquantity=2\n;
if (preg_match(/(amount=[0-9]{1,9}\.[0-9]{1,9})(\n)/, $exp,$amt)) {
print $amt[1];
}

will output amount=23.50

Regards
Urosh


 if i have the following script,

 $exp = description=whatever\namount=23.50\nquantity=2\n;
 if (eregi((amount)(.*)(\n), $exp,$amt)) {
 print $amt[0];
 }

 the output will be

 namount=23.50\nquantity=2\n


 what will i do so that the output value will be 23.50 only.


 thanks =)
 jen





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Date functions

2002-07-01 Thread [EMAIL PROTECTED]

On Mon, 1 Jul 2002, Achilleas Maroulis wrote:

 Hi.
 I want to know what is the right way to make some comparisons with date variables.
 I have used only the date() function to get a variable in this format= 01-07-2002
 Is there a way to add 20 days in order to have 21-07-2002 or 2 months to have 
01-09-2002?

Hi!

Try to read PHP documentation:

http://www.php.net/manual/en/function.mktime.php

Regards
Urosh


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] MySQL Problem

2002-05-21 Thread [EMAIL PROTECTED]

Hi, i've a problem with MySQL in my PHP pages. My PHP version is 4.0.1 i think. it's 
been installed with Redhat Linux 7.2 with default MySQL support. (I've verified it). 
when i want to connect to my sample MySQL database, it give me error :
Call to undifined function mysql_connect
with all MySQL functions, i've the same error. what's problem? and what i can do? 
please somebody help me.

Many thanks, Alan


mail2web - Check your email from the web at
http://mail2web.com/ .


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] MYSQL: INsert html form data;

2002-05-01 Thread [EMAIL PROTECTED]

I'm not sure what you're asking but the fields are set to varchar(40) which
will accommodate the information I have been insertinging...

/T


on 4/30/02 9:00 PM, Neil at [EMAIL PROTECTED] wrote:

 Have you checked to see that id tidying is set to the amount equal to the
 fields in your form.
 - Original Message -
 From: Info_Best-IT [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 30, 2002 4:56 PM
 Subject: [PHP-DB] MYSQL: INsert html form data;
 
 
 I have a problem writing form data to a table in MySQL.  I have an
 action.php file
 that it called when the information is submitted and it looks something
 like this:
 
 ?php
 
   $connection = mysql_connect(@localhost,root, password)
 or die (The DataBase is Down!);
 
mysql_select_db(web_feedback, $connection)
 or die (I Can't connect at database!);
 
$query_st_name = mysql_query(INSERT into name_email (col1)
 values($name));
$query_st_email = mysql_query(INSERT into name_email (col2)
 values($email));
 mysql_close($connection); // Close this connection
 ?
 
 Thanks for submitting your name and e-mail, I will contact you soon to
 discuss your
 interest in more detail.
 
 I can tell the file is being called since the previous message appears in
 the window.
 But when I go to check out my table there are no records.  Anyone see
 where this may
 be going wrong?  I also set a php_error log path in the PHP.ini and I do
 not get any
 errors written there.  I think it may be something else but not sure
 what...
 
 the site: www.best-it.biz
 the link: services
 thanks in advance!
 /Tim
 
 
 --
 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] Pdf display from Blob

2002-04-15 Thread [EMAIL PROTECTED]

We are using Interbase 6.01 as SQL-Server and PHP4.
The Interbase table was created an populated with a Delphi - Programm.
Everything is working.

Our problem is now to display the PDF Content out of Blobs.
Text - Blobs are working with ibase_blob_echo()
Outputting PDF-Blobs without MIME-Header is a garbled Text
With MIME - Header header(application/pdf) the Acrobat-Reader 5.0 starts
but shows the errormessage
that this is not a PDF-File.

As this is not an Interbase-Problem,  I would appreciate any working
solution for any database.

Best regards

Helmut



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] order by problem

2002-03-20 Thread [EMAIL PROTECTED]

On Wed, 20 Mar 2002 [EMAIL PROTECTED] wrote:

You have your ctrlnumber field defined as varchar. If you define
ctrlnumber as number, you could also use

SELECT max(ctrlnumber) FROM table WHERE id=14;

Cheers
Urosh

 Hello All,

 Im having a 'problem' that I dont know how to resolve. The problem is:

 I have a table that I want to get the last number to increment. To do this I
 want to sort the filed 'ctrlnumber'. Using this querys I get:
 mysql SELECT ctrlnumber FROM table WHERE id=14;
 ++
 | ctrlnumber |
 ++
 | 7  |
 | 1  |
 | 2  |
 | 3  |
 | 4  |
 | 5  |
 | 6  |
 | 8  |
 | 9  |
 | 10 |
 | 11 |
 ++
 11 rows in set (0.00 sec)

 mysql SELECT ctrlnumber FROM table WHERE id=14 order by ctrlnumber;
 ++
 | ctrlnumber |
 ++
 | 1  |
 | 10 |
 | 11 |
 | 2  |
 | 3  |
 | 4  |
 | 5  |
 | 6  |
 | 7  |
 | 8  |
 | 9  |
 ++
 11 rows in set (0.01 sec)


 When I try to sort, it doesnt return to me in the order that I need (1 2 3
 4 5 6 7 8 9 10 11). Is there a way to do this or Ill have to include 01 02
 03 04 05 to all my recoreds ?

 Thanks in advance,
 Gus





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] MySQL support

2001-08-02 Thread [EMAIL PROTECTED]

Hi everyone !

I've installed Apache 1.3.20, MySQL 3.23.38 and PHP 4.0.6 with MySQL support but I 
still have : MySQL a répondu: Can't connect to local MySQL server through socket 
'/var/lib/mysql/mysql.sock' (111)  when trying to connect to the database with 
phpMyAdmin 2.2
Is there a way to check if the MySQL support is well configured with PHP ?
Thanks in advance.

Pericles



[PHP-DB] Best foot forward?

2001-07-20 Thread [EMAIL PROTECTED]

Hi folks,

I have a requirement to show records in a certain standard
format from a database. This requires first/previous/
next/last buttons, sorting on the column name, searching
and filtering using text entered into a text box etc etc.
This page would be continuously calling itself when
asked to sort or filter etc. and I wanted to use it as
a generic display and search/sort page by passing in
an sql command or something along those lines.

This is getting too messy, i.e. using post and get, trying
to work with multiple subnmit buttons (anyone have any
example code here?), having multiple variables passed
between pages or back into the same page. Can anyone
tell me the best way to structure this? Should I always
be using either post or get only, what's the best way to
pass variables in this manner to ensure ease of maintenance
and not letting it get messy (for example, should I be using
an array of variables)? Is there an easier way?

If anyone of you has come across this before, could you
please point a newbie in the right direction? Thanks.

Best Regards,

Colum Hickey


Mail2Web - Check your email from the web at
http://www.mail2web.com/ .


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Database access using ODBC

2001-06-26 Thread [EMAIL PROTECTED]

Thanks for the reply.

When it didn't work, I downloaded and installed the mdac 2.6 and
the up to date jet service pack. Still no joy.

$DBConn is coming back as integer 1 so that seems ok.

I have tested the DSN using MSQuery and it is connecting ok.
I have also turned tracing on for the dsn and the trace says
that it connects successfully but then nothing else.

I am a bit lost after this. Anyone any suggestions?

Thanks,

Colum

Original Message:
-
From:  [EMAIL PROTECTED] (Miles Thompson)
Date: Mon, 25 Jun 2001 18:22:52 -0300
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Database access using ODBC


Colum,

Did you check out www.php.net/odbc_Exec

One of the solutions posted in  the comments was to download and install a
new ODBC driver from MSFT. Are you getting a valid integer returned to
$DBConn?

NOt worked with this, but I hope those are helpful suggestions - Miles Thompson

At 08:38 AM 6/25/01 -0400, [EMAIL PROTECTED] wrote:
Hi,

Long time reader, first time poster! I am new to php coming from
a generally MS (unfortunately) background (Access, VB, SQLServer)
and I am looking to branch out a bit.

I have a client who wishes to have an internet front-end to an
Access database. I am using php with odbc to access this and (as
I am a newbie), I am having problems with the connection. After
I do an odbc_pConnect, when I call the odbc_exec, I get the usual
error, Warning: Supplied agrument is not a valid ODBC-Link resource.

The ODBC DSN is setup as standard (no default login etc). The
following code is being used for db access:

function DBRetrieve($pSQLStr)
{
global $DBConn, $DBQryID, $DBQryRows, $DBQryColumns;

$DBDsn='PHPTEST';
$DBUser='Admin';
$DBPassword ='';

#Open a persistent connection to the database
if (!$DBConn = (odbc_pConnect($DBDsn, $DBUser, $DBPassword) or
 die(Database Execution Error:  . odbc_Error() .   .  odbc_ErrorMsg(
{
  echo \nError connecting to database\n;
  return false;
}

#Send query to database
if (!$DBQryID=(odbc_Exec($DBConn, $pSQLStr) or die(Database Execution
 Error:  . odbc_Error() .   .  odbc_ErrorMsg(
{
  echo \nError executing database request: [ODBC_EXEC]\n;
  DBDestroy();
  return false;
}

#Get no of rows in recordset
if (!$DBQryRows=(odbc_num_rows($DBQryId) or die(Database Execution
 Error:  . odbc_Error() .   .  odbc_ErrorMsg(
{
  echo \nError executing database request: [ODBC_NUM_ROWS]\n;
  DBDestroy();
  return false;
}

#Get number of fields to display
if (!$DBQryColumns=(odbc_num_fields($DBQryId) or die(Database
 Execution Error:  . odbc_Error() .   .  odbc_ErrorMsg(
{
  echo \nError executing database request: [ODBC_NUM_FIELDS]\n;
  DBDestroy();
  return false;
}

return true;
}

Does this look ok to you more experienced guys? Am I missing
something or is there a better way?

Thanks.

Colum


Mail2Web - Check your email from the web at
http://www.mail2web.com/ .


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



Mail2Web - Check your email from the web at
http://www.mail2web.com/ .


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Database access using ODBC

2001-06-25 Thread [EMAIL PROTECTED]

Hi,

Long time reader, first time poster! I am new to php coming from
a generally MS (unfortunately) background (Access, VB, SQLServer)
and I am looking to branch out a bit.

I have a client who wishes to have an internet front-end to an
Access database. I am using php with odbc to access this and (as
I am a newbie), I am having problems with the connection. After
I do an odbc_pConnect, when I call the odbc_exec, I get the usual
error, Warning: Supplied agrument is not a valid ODBC-Link resource.

The ODBC DSN is setup as standard (no default login etc). The
following code is being used for db access:

function DBRetrieve($pSQLStr)
{
   global $DBConn, $DBQryID, $DBQryRows, $DBQryColumns;

   $DBDsn='PHPTEST';
   $DBUser='Admin';
   $DBPassword ='';

   #Open a persistent connection to the database
   if (!$DBConn = (odbc_pConnect($DBDsn, $DBUser, $DBPassword) or die(Database 
Execution Error:  . odbc_Error() .   .  odbc_ErrorMsg(
   {
 echo \nError connecting to database\n;
 return false;
   }

   #Send query to database
   if (!$DBQryID=(odbc_Exec($DBConn, $pSQLStr) or die(Database Execution Error:  . 
odbc_Error() .   .  odbc_ErrorMsg(
   {
 echo \nError executing database request: [ODBC_EXEC]\n;
 DBDestroy();
 return false;
   }

   #Get no of rows in recordset
   if (!$DBQryRows=(odbc_num_rows($DBQryId) or die(Database Execution Error:  . 
odbc_Error() .   .  odbc_ErrorMsg(
   {
 echo \nError executing database request: [ODBC_NUM_ROWS]\n;
 DBDestroy();
 return false;
   }

   #Get number of fields to display
   if (!$DBQryColumns=(odbc_num_fields($DBQryId) or die(Database Execution Error:  . 
odbc_Error() .   .  odbc_ErrorMsg(
   {
 echo \nError executing database request: [ODBC_NUM_FIELDS]\n;
 DBDestroy();
 return false;
   }

   return true;
}

Does this look ok to you more experienced guys? Am I missing
something or is there a better way?

Thanks.

Colum


Mail2Web - Check your email from the web at
http://www.mail2web.com/ .


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] raw file header in http

2001-06-21 Thread [EMAIL PROTECTED]

I' ve a file in a directory(/tmp) out from http root of web server.
I need to open a page that send this file when it is opened (es.:
opening page.php under netscape it opens a request to save file to
disk, but the file is out of www root), i think i t is possible using
command header and a raw http command, but i aven't any idea if it is
possible and if yes in what mode.
The system i use is apache 1.3.9 under redhat linux 7.1,
tank's
Omar


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Passing variables to/from Flash

2001-05-15 Thread [EMAIL PROTECTED]

afaik it's something like:

var1=value1var2=value2var3=value3...


 -Original Message-
 From: Atanas Vassilev [mailto:[EMAIL PROTECTED]]
 Sent: Dienstag, 15. Mai 2001 12:31
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Passing variables to/from Flash
 
 
 I'm trying to send variables to a flash movie... In fact the 
 designer of the
 flash part of the site told me that ActionScript had a built in function
 getData  that had one of its arguments the url from where the 
 data should
 be pulled out - if he points his function to a *.php page in what form
 should I output the data within this php script - is it a 
 urlencoded string
 or can it be an array, or just outputting name-value pairs on 
 separate lines
 would be enough?
 
 Any help will be appreciated.
 Thanks in advance!
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Fwd: URGENT : How can i generate scripts of database

2001-05-08 Thread [EMAIL PROTECTED]

mysqldump might be difficult though if you don't have telnet access to your
mysql.database, but if you only have php access. whats the best thing to do
in that case? has anyone tried the exporting options of myphpadmin?

 -Original Message-
 From: Michael Geier [mailto:[EMAIL PROTECTED]]
 Sent: Dienstag, 8. Mai 2001 16:36
 To: Gabriel; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Fwd: URGENT : How can i generate scripts of
 database


 man mysqldump

 -Original Message-
 From: Gabriel [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 08, 2001 9:27 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Fwd: URGENT : How can i generate scripts of database


 Anyone can tell me how can i generate the scripts of my database to create
 it in another mysql server.
 Or better wich other ways i´ve to do it.

 Thanks in advance,

 Gabriel.



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Structure Question

2001-03-27 Thread [EMAIL PROTECTED]

Why don't you just store the file names in a db?

iets much easyer



 Hi,
 I want to keep filenames of different kinds of media(real sudio, qt, mp3)
for
 articles in a db table. Would it be best to store each kind of media in a
 different table like one table for real audio, one for quicktime, one for
 mp3. Or, would it better to store them all in the same table but with
another
 table telling me what kind of file it is?

 Like:

 media table
 
 id | name | filename | type_id

 media types
 
 type_id | name

 Any ideas folks?

 Cheers,

 Jord

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Read lines

2001-03-26 Thread [EMAIL PROTECTED]

Hello,

I want to read lines from a file between !--begin-- And !--End--

Can someon help me.

Walter



Re: [PHP-DB] Read lines

2001-03-26 Thread [EMAIL PROTECTED]

First Thx for your response

I don't think you know wat i mean.

My brother give me a HTML file. I must place a menu from a DB but
Then i must have the folowing code

!--begin_menu--
  tr
tdmenu/td
  /tr
!--end_menu--

So i must read from !--begin_menu-- till !--end_menu--.



- Original Message - 
From: Ben Cairns [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, March 26, 2001 12:34 PM
Subject: RE: [PHP-DB] Read lines


 HTH...
 
 ?
 $file = "YOUR URL/FILE HERE";
 $open = fopen($file, "r");
 $search = fread($open, FILE SIZE IN BYTES);
 fclose($open);
 $news[1] = str_replace("replace this, "with this", $grabbed[1]);
 ?
 
 ?
 echo $grabbed[1]
 ?
 
 -- Ben Cairns - Head Of Technical Operations
 intasept.COM
 Tel: 01332 365333
 Fax: 01332 346010
 E-Mail: [EMAIL PROTECTED]
 Web: http://www.intasept.com
 
 "MAKING sense of
 the INFORMATION
 TECHNOLOGY age
 @ WORK.."
 
 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Read a few lines

2001-03-25 Thread [EMAIL PROTECTED]

Hello,

I want to copy a few single lines in a HTML file.
A want to read everything from !-- begin -- to !-- end --

Is this possible with php



[PHP-DB] read fils

2001-03-24 Thread [EMAIL PROTECTED]

Hello,

I just want to read a txt file and let the output in php file.

Can someone help me?

Walter Franssen