[PHP-DB] Cookies

2001-04-25 Thread Tobbe

Hi !!

I'm trying to but down 2 variables ($iCount and $sPhone) into a cookie and I
used the code example from the php manual from php.net put I only get the
error messages (down below)

And how do i get back the var in to the page

or is there another beter way to save the variables when reloading the page


___

   setcookie (cookie[two], $iCount);
   setcookie (cookie[one], $sPhone);
   if (isset ($cookie)) {
   while (list ($name, $value) = each ($cookie)) {
   echo $name == $valuebr\n; } }

__
Warning: Cannot add header information - headers already sent by (output
started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5)
in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 51

Warning: Cannot add header information - headers already sent by (output
started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5)
in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 52


Thanks / Tobbe



-- 
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] apache 1.3.9 pgsql 7.1 php4 on solaris 2.7

2001-04-25 Thread Marc Blum

Hello

We're trying to get this running. php4 is running as dynamically linked
module.

the php.ini file contains the entry: extension=libpq.so and extensiondir=./
libpq.so has been copied to the php directory and the modules and libs
subdirs.

postmaster is up and running but in our testscript the function pg_connect()
cannot be found (undefined)

We assume that php (or apache?) doesn't load the libpq.so correctly...

apache hasn't been configured --with-pgsql=?? but --enable-module=so has
been done.

Your help is greatly appreciated! Please reply directly to
[EMAIL PROTECTED]

Regards, Marc





-- 
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: AW: [PHP-DB] syntax error - -- agghhh!

2001-04-25 Thread Michael Rudel

 it's always eaiser to count the parens and braces backwards 
 to make sure
 they're all there. i do it all the time.

... or you use a cool Editor (like UE32) which will do this
job for you =8)

Greetinx,
  Mike
(Germany)

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

2001-04-25 Thread johndmiller

I believe that the cookie part needs to be sent to the browser before the
html.  You can put the set cookies any where in the php portion as long as
the first thing you send is the cookie stuff

setcookie..
html header info...
html

not html header info.
setcookie
html..

Hopes this helps
John

 On Wed, 25 Apr 2001, Tobbe wrote:

 Hi !!

 I'm trying to but down 2 variables ($iCount and $sPhone) into a cookie and I
 used the code example from the php manual from php.net put I only get the
 error messages (down below)

 And how do i get back the var in to the page

 or is there another beter way to save the variables when reloading the page


 ___

setcookie (cookie[two], $iCount);
setcookie (cookie[one], $sPhone);
if (isset ($cookie)) {
while (list ($name, $value) = each ($cookie)) {
echo $name == $valuebr\n; } }

 __
 Warning: Cannot add header information - headers already sent by (output
 started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5)
 in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 51

 Warning: Cannot add header information - headers already sent by (output
 started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5)
 in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 52


 Thanks / Tobbe






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

2001-04-25 Thread Miles Thompson

Tobbe,

The cookie information has to the first thing sent to the browser, ahead of 
everything else. You sometimes get trapped by having a single empty line at 
the top of your file.

The page has to be reloaded for content of cookies to be read by the browser.

Netscape has a short article on cookies; you can probably find it by 
searching for  Netscape cookies  using google.

Miles


At 10:59 AM 4/25/01 +0200, Tobbe wrote:
Hi !!

I'm trying to but down 2 variables ($iCount and $sPhone) into a cookie and I
used the code example from the php manual from php.net put I only get the
error messages (down below)

And how do i get back the var in to the page

or is there another beter way to save the variables when reloading the page


___

setcookie (cookie[two], $iCount);
setcookie (cookie[one], $sPhone);
if (isset ($cookie)) {
while (list ($name, $value) = each ($cookie)) {
echo $name == $valuebr\n; } }

__
 Warning: Cannot add header information - headers already sent by (output
started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5)
in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 51

 Warning: Cannot add header information - headers already sent by (output
started at c:\program files\apache group\apache\htdocs\masscot\delete.php:5)
in c:\program files\apache group\apache\htdocs\masscot\delete.php on line 52


Thanks / Tobbe



--
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] Please help me to solve a question

2001-04-25 Thread David Lee

I used MySQL server to create a application database and access it by php
program.
But now,I can access it only one machine that is runing the server.Other
computer
can not access it through browser(Internet Explorer5.0).My networks is made
up with
windows98 peer to peer network.Please help me and tell me what should i
do.

Thank you very much
  David Lee



-- 
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] file and mail

2001-04-25 Thread kancha


Hi all

I have a text file with email addresses. Each line contains one email
address. I read the file using file() function. Below is a snippet of my
code

 $staff = file(staff);
 for($x=0; $xcount($staff); $x++){
   $to = $staff[$x];
   mail($to, New User Added, $mailBody, From: [EMAIL PROTECTED]);
 } 


the snippet does send mail to all the address listed in the file staff but
the header from of the mail is not [EMAIL PROTECTED], but when i replace $to
with a string like [EMAIL PROTECTED] everything works fine. The from  header is
set to [EMAIL PROTECTED] and the subject also appears.

I'm using php 4.0.1pl1 with apache 1.3 in a linux box. what could be the
problem??

kancha  





___
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/



-- 
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] Retrieving and Printing Categories

2001-04-25 Thread Lager, Jeremy

append the correct 'ORDER BY' clause to the end of your SELECT statement

syntax:
ORDER BY fieldname_1 [[, fieldname_2], fieldname_n]

shouldn't matter what tables they are in as long as you can get the records
with SELECT

-Original Message-
From: Jordan Elver [mailto:[EMAIL PROTECTED]]
Sent: 25 April 2001 14:31
To: PHP Database Mailing List; PHP General Mailing List
Subject: [PHP-DB] Retrieving and Printing Categories


Hi,
I've got a load of records that are in different categories.
What is the best way to get all the records or selected records and print 
them in such a way that they are grouped (on the page) in their relevent 
category, like:

Fruit
- Apples
- Pears
- Bananas

Vegetables
- Carrots
- Cabbages

etc, etc.

Sometime my categories are ina dfferent table, don't know if this matters?
How can I do this?

TIA,

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]


_
This message has been checked for all known viruses by Star Internet
delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

_
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

-- 
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] How to select [please HELP]

2001-04-25 Thread Michael Rudel

... AND recordid NOT LIKE '$recordid'

I think this will do the job.

Greetinx,
  Mike

Michael Rudel
- Web-Development, Systemadministration -
___

Suchtreffer AG
Bleicherstraße 20
D-78467 Konstanz
Germany
fon: +49-(0)7531-89207-17
fax: +49-(0)7531-89207-13
e-mail: mailto:[EMAIL PROTECTED]
internet: http://www.suchtreffer.de
___



 -Original Message-
 From: David Tandberg-Johansen [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 25, 2001 3:33 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] How to select [please HELP]


 Hello!

 I am trying to select from a table where users add stuf.

 First I do:

 SELECT recordid,uid ,info FROM userstuff WHERE recordid LIKE
 '$recordid'

 Then I want to check if the user has more records in the
 table, based on the
 the first query

 SELECT recordid,uid,info FROM userstuff WHERE uid LIKE '$uid'
 AND NOT WHERE
 recordid LIKE '$recordid'

 But this query fails and I wonder if any one can  give a hint on how.

 I tried the documentation on http://www.mysql.com but I found
 not anything
 that satisfied me.

 Thanks

 David




 --
 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] How to select [please HELP]

2001-04-25 Thread Brinzoi Constantin Aurelian

On Wed, 25 Apr 2001, David Tandberg-Johansen wrote:

 Hello!
 
 I am trying to select from a table where users add stuf.
 
 First I do:
 
 SELECT recordid,uid ,info FROM userstuff WHERE recordid LIKE '$recordid'
 
 Then I want to check if the user has more records in the table, based on the
 the first query
 
 SELECT recordid,uid,info FROM userstuff WHERE uid LIKE '$uid' AND NOT WHERE
 recordid LIKE '$recordid'

rewrite it like:

SELECT recordid, uid, info FROM userstaff WHERE uid LIKE '$uid' AND
recordid NOT LIKE '$recordid'

 
 But this query fails and I wonder if any one can  give a hint on how.
 
 I tried the documentation on http://www.mysql.com but I found not anything
 that satisfied me.
 
 Thanks
 
 David
 
 
 
 
 -- 
 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] Retrieving and Printing Categories

2001-04-25 Thread Lager, Jeremy

sorry jordan, ref. my last mail, use GROUP BY in exactly the same way

-Original Message-
From: Jordan Elver [mailto:[EMAIL PROTECTED]]
Sent: 25 April 2001 14:31
To: PHP Database Mailing List; PHP General Mailing List
Subject: [PHP-DB] Retrieving and Printing Categories


Hi,
I've got a load of records that are in different categories.
What is the best way to get all the records or selected records and print 
them in such a way that they are grouped (on the page) in their relevent 
category, like:

Fruit
- Apples
- Pears
- Bananas

Vegetables
- Carrots
- Cabbages

etc, etc.

Sometime my categories are ina dfferent table, don't know if this matters?
How can I do this?

TIA,

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]


_
This message has been checked for all known viruses by Star Internet
delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

_
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

-- 
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] apache 1.3.9 pgsql 7.1 php4 on solaris 2.7

2001-04-25 Thread Yasuo Ohgaki
You can't load libpq.so, but pgsql.so. If you compiled PostgreSQL extension as
self contained module.
(Location of shared object is probably wrong, also)

I suggest to compile PostgreSQL module in PHP. Minimum configure line would be

./configure --with-apxs --with-pgsql

Make sure to use libpq7.1. With 7.0, it will gives you a lot of troubles.

Regards,
--
Yasuo Ohgaki


""Marc Blum"" [EMAIL PROTECTED] wrote in message
9c64tv$k7u$[EMAIL PROTECTED]">news:9c64tv$k7u$[EMAIL PROTECTED]...
 Hello

 We're trying to get this running. php4 is running as dynamically linked
 module.

 the php.ini file contains the entry: extension=libpq.so and extensiondir=./
 libpq.so has been copied to the php directory and the modules and libs
 subdirs.

 postmaster is up and running but in our testscript the function pg_connect()
 cannot be found (undefined)

 We assume that php (or apache?) doesn't load the libpq.so correctly...

 apache hasn't been configured --with-pgsql=?? but --enable-module=so has
 been done.

 Your help is greatly appreciated! Please reply directly to
 [EMAIL PROTECTED]

 Regards, Marc





 --
 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] How to select [please HELP]

2001-04-25 Thread William Lai

Hi David,

Perhaps you can modify your second query to the following way.

SELECT recordid,uid,info FROM userstuff WHERE uid LIKE '$uid' AND recordid NOT LIKE 
'$recordid'


--
Regards,
William Lai

-Original Message-
From:David Tandberg-Johansen [EMAIL PROTECTED]
Sent:Wed, 25 Apr 2001 15:33:17 +0200
To:  [EMAIL PROTECTED]
Subject: [PHP-DB] How to select [please HELP]


Hello!

I am trying to select from a table where users add stuf.

First I do:

SELECT recordid,uid ,info FROM userstuff WHERE recordid LIKE '$recordid'

Then I want to check if the user has more records in the table, based on the
the first query

SELECT recordid,uid,info FROM userstuff WHERE uid LIKE '$uid' AND NOT WHERE
recordid LIKE '$recordid'

But this query fails and I wonder if any one can  give a hint on how.

I tried the documentation on http://www.mysql.com but I found not anything
that satisfied me.

Thanks

David




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




___
Visit http://www.visto.com/info, your free web-based communications center.
Visto.com. Life on the Dot.


--
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] file and mail

2001-04-25 Thread Sigitas Paulavicius

 Hi all

 I have a text file with email addresses. Each line contains one email
 address. I read the file using file() function. Below is a snippet of my
 code

  $staff = file(staff);
  for($x=0; $xcount($staff); $x++){
$to = $staff[$x];
mail($to, New User Added, $mailBody, From: [EMAIL PROTECTED]);
  }


 the snippet does send mail to all the address listed in the file staff but
 the header from of the mail is not [EMAIL PROTECTED], but when i replace
$to
 with a string like [EMAIL PROTECTED] everything works fine. The from  header is
 set to [EMAIL PROTECTED] and the subject also appears.

 I'm using php 4.0.1pl1 with apache 1.3 in a linux box. what could be the
 problem??

 kancha

Hi,

I suppose you should check if the values in $staff array are clear of
special chars.
Try trim()'ing them before sending to the functions. Otherwise use
var_dump($staff ) or print_r($staff ). Thy're quite handy while debuging.

Just a remark... the code here connects to smtp server, sends data and
disconnects N times - this is not quite efficent. SMTP protocol allows to
specify multiple recipients of single message in single connection (Of
course, this means you won't be using any mail() from PHP library...). Still
it's no problem as long as the list is reasonable in size.

Sigitas



-- 
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] Creating tables

2001-04-25 Thread Herman Wapenaar

Hi everyone

I am using a website based in the states to which is PHP enabled. I am using
MySQL.

Is there a way to create a table with PHP? I do not see any command for
that.

I have loaded MySQL for Windows but the server runs MySQL on Unix. I don't
know if the file structure is different. Maybe that is why I can not read
it?

Thanks
Herman Wapenaar



-- 
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] Creating tables

2001-04-25 Thread Brian S. Dunworth

At 08:00 AM 4/25/01 +0200, Herman Wapenaar wrote:
I am using a website based in the states to which is PHP enabled. I am 
using MySQL.

Is there a way to create a table with PHP? I do not see any command for that.

   Well, as an Oracle administrator, I may be going out on a limb here 
regarding MySQL, but doesn't it accept standard SQL syntax to create, alter 
or drop tables?

CREATE TABLE abc AS SELECT * FROM def WHERE ghi LIKE '%jkl';
 (to copy some elements from one table to a new table)

CREATE TABLE test (col1 NUMBER NOT NULL PRIMARY KEY,
   col2 CHAR(2) NOT NULL);

ALTER TABLE test ADD col3 NUMBER(5) NOT NULL;

DROP TABLE test;

  - Brian

  -
Brian S. Dunworth
Sr. Software Development Engineer
Oracle Database Administrator
The Printing House, Ltd.

(850) 875-1500  x225
[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] WML vs PHP and MYSQL

2001-04-25 Thread Kelvin

Hi,

   I am trying to retrieve data from MYSQL inside of PHP code which I
placed under WML page.
   But every time I compile this file, it said compile error.   Can
anyone help?

--3.php-

?php
header(Content-type: text/vnd.wap.wml);
echo(?xml version=\1.0\?\n);
echo(!DOCTYPE wml PUBLIC \-//WAPFORUM//DTD WML 1.1//EN\
\http://www.wapforum.org/DTD/wml_1.1.xml\;\n\n);
?
wml
  card id=acctnum title=Account Number
  p
 ?php
$password='1234';
if ($acctnum == $password)
   {
   include(dedb.inc);  // DB
connection file.
   $query=SELECT * FROM uget;
   $result= mysql_query($query) or die(mysql_error());
   $field=mysql_num_rows($result);
   srand(time());
   $num=rand(1,$field);

   $query1=SELECT * FROM uget where number='$num';
   $result1= mysql_query($query1) or die(mysql_error());
   $row=mysql_fetch_array($result1);

   print($row[message]);
   }
  else
   {
   print(Password wrong);
   }
 ?
  /p
  /card
/wml
---


Best Regards,
Kelvin.



-- 
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] Creating tables

2001-04-25 Thread Miles Thompson

Check your MySQL docs for exact syntax on table creation ... then:

Connect to the database
Build a SQL statement that does what you want:
 $sql = CREATE TABLE blah, blah ..;
Execute the statement:
  $result = mysql_query( $sql );
and check for errors, etc.

Alternately, if this is a Linux box and you can get telnet or SSH access 
(TerraTermSSH from Windows) you can execute this code directly

Miles

At 08:00 AM 4/25/01 +0200, Herman Wapenaar wrote:
Hi everyone

I am using a website based in the states to which is PHP enabled. I am using
MySQL.

Is there a way to create a table with PHP? I do not see any command for
that.

I have loaded MySQL for Windows but the server runs MySQL on Unix. I don't
know if the file structure is different. Maybe that is why I can not read
it?

Thanks
Herman Wapenaar



--
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] MySql select and insert

2001-04-25 Thread johndmiller

Ok here is my problem.  I have this database and the key is comprised of
two fields, filename and path to file.  When I read based on this key, I
get 0 records found. When I insert the same record, it will say that the
key already exists.(which id does).  Why can't MySql findthe record.

Also when I log into MySql and type the search in manually, it doesnot
find it, then when I put a wild card at the end of the path and use like
MySql finds the record.  The File name and Path are derived from the
system so it is not atyping error.  Any know what is up with it

Thanks

John


-- 
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] query problem

2001-04-25 Thread Russ Michell

Hi all:

I'm using mysql-3.22.32:

My PHP-embedded query is as follows:

else if($sortBy == '01') {
$sql = SELECT * FROM $table_cal WHERE item_activity='$id' AND 
DATE_FORMAT('item_date','%m') LIKE '$sortBy'; 
$sortBy = Month of January;
}

* '$sortBy' is equal to '01'.
* MySQL isn't complaining about any of the query.
* DATE_FORMAT('item_date','%m') should be '01' (taken from 
a 'date' column in -MM-DD fromat.

Can anyone tell me what is wrong with this query (I may have missed 
something - but then that shouldn't surprise as I've been staring at it 
for 3 hours...;-)

Cheers:
Russ

#---#

 Believe nothing - consider everything
   Web Developers do it on-the-fly.

  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.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] Password field!

2001-04-25 Thread Pedro M. S. Oliveira

Hello all!
i was wondering if any1 of you could help me with something.
i have a table with 3 fields user_ip, user and pass.
how can i encript the pass and then read compare it with a pass inserted on the web 
page?
thanx


***
Pedro Miguel Silva Oliveira
Cell Phone: +351 96 5867227
SMS: [EMAIL PROTECTED]
Email: [EMAIL PROTECTED]




Re: [PHP-DB] Creating tables

2001-04-25 Thread Subodh Gupta

Hi Herman,

 I am myself a pro at PHP, but I think, this would be of some help to you.

To create a Table, you won't find a comand in PHP.  However what you do is build a 
CREATE TABLE statement and pass that as an
argument to mysql_query() function to do the job.

Here is a small example:

mysql_connect($dbhost,$dbuser,$dbpassword) or die(Couldn't Connect);
mysql_select_db($dbname);

$query = CREATE TABLE YOUR_TABLE (
COL1 INT 
NOT NULL PRIMARY KEY,
COL2 TEXT
);

mysql_query($query) or die(mysql_error);

Just a small tip.  You can use phpmyadmin utility to these sorts of job in a jiffy.

I hope this helps!


Subodh Gupta
I have learned, Joy is not in things, it is in us.
You will ultimately be known by what you give and not what you get.

- Original Message -
From: Herman Wapenaar [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 25, 2001 11:30 AM
Subject: [PHP-DB] Creating tables


Hi everyone

I am using a website based in the states to which is PHP enabled. I am using
MySQL.

Is there a way to create a table with PHP? I do not see any command for
that.

I have loaded MySQL for Windows but the server runs MySQL on Unix. I don't
know if the file structure is different. Maybe that is why I can not read
it?

Thanks
Herman Wapenaar



--
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] file and mail

2001-04-25 Thread Subodh Gupta

Hi Kancha,

Since you are putting the From: [EMAIL PROTECTED] in double quotes, I believe that 
you need to esacape @ and (.) character by a
slash.
So you need to write From: sysadmin\@foo\.com

Will anybody correct me if I am wrong?

Subodh Gupta
I have learned, Joy is not in things, it is in us.
You will ultimately be known by what you give and not what you get.

- Original Message -
From: kancha [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 25, 2001 6:57 PM
Subject: [PHP-DB] file and mail



Hi all

I have a text file with email addresses. Each line contains one email
address. I read the file using file() function. Below is a snippet of my
code

 $staff = file(staff);
 for($x=0; $xcount($staff); $x++){
   $to = $staff[$x];
   mail($to, New User Added, $mailBody, From: [EMAIL PROTECTED]);
 }


the snippet does send mail to all the address listed in the file staff but
the header from of the mail is not [EMAIL PROTECTED], but when i replace $to
with a string like [EMAIL PROTECTED] everything works fine. The from  header is
set to [EMAIL PROTECTED] and the subject also appears.

I'm using php 4.0.1pl1 with apache 1.3 in a linux box. what could be the
problem??

kancha





___
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/



--
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] Sybase datetime

2001-04-25 Thread Björn Dolkemeier

Hello,

If I do a sybase_query(select getdate(),$Conn) this will return the
current date in the format Nov  3 1998  8:06PM (so I don't have seconds).
I think this leads to the usage of CS_SHORT_DATE in
ext/sybase_ct/php_sybase_ct.c (Line 275).

Does somebody know, if there is a solution for getting another
datetime-format beyond doing something like sybase_query(select
convert(varchar,getdate(),108).

Wouldn't it be better to return the datetime-results of queries as a
timestamp?

Thanks for anwers,  Bjoern



-- 
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] How to keep selection on radio buttons when the form is refreshed?

2001-04-25 Thread Hector M Banda

Hi all,
I have some radio buttons like: department, vendor, etc, on my form but at 
the time I submit or refresh the form, my radio buttons do not keep the 
selection.

I have not idea in how to do tell  PHP to keep the values of the objects 
when the form is refresed.

Thanks,




-hector



-- 
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] MySql select and insert

2001-04-25 Thread olinux o

what is your SQL select statement ?

olinux

--- johndmiller [EMAIL PROTECTED] wrote:
 Ok here is my problem.  I have this database and the
 key is comprised of
 two fields, filename and path to file.  When I read
 based on this key, I
 get 0 records found. When I insert the same record,
 it will say that the
 key already exists.(which id does).  Why can't MySql
 findthe record.
 
 Also when I log into MySql and type the search in
 manually, it doesnot
 find it, then when I put a wild card at the end of
 the path and use like
 MySql finds the record.  The File name and Path are
 derived from the
 system so it is not atyping error.  Any know what is
 up with it
 

__
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.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] How to keep selection on radio buttons when the form is refreshed?

2001-04-25 Thread Joel Gilbert

Hi,
If you want to keep the selection, use the value of the form radio
buttons to determine whether the button is selected or not. One way to do it
is:
?php
echo Radio1INPUT TYPE=RADIO NAME=radio1 VALUE=value;
if( isset($radio3) )
{
 if( $radio1 == 'value' )
echo  CHECKED;
}
echo BR;
?
This will check if the radio button has been selected, and if so it adds the
CHECKED keyword to the radio tag.
You can do similar things with other form inputs, such as text, textfield,
dropdown menus, etc.

Hector M Banda [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,
 I have some radio buttons like: department, vendor, etc, on my form but at
 the time I submit or refresh the form, my radio buttons do not keep the
 selection.

 I have not idea in how to do tell  PHP to keep the values of the objects
 when the form is refresed.

 Thanks,




 -hector



 --
 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] Password field!

2001-04-25 Thread David Balatero

Yes, that will work, just a) make sure that the password column in your
database is 32 chars exactly [varchar(32) or something, as md5 hashes
are 32 chars in length], and b) in the sql code you don’t want to say
WHERE user = '$md5($pass)', rather, WHERE user = 'md5($pass)', or else
it will treat $md5() as a variable, instead of the md5() function. Also,
I find the easiest way to auth a user, especially if you'll need to auth
him/her on more than one occasion, is writing a small function to do
that:

?php

$md5_pass = md5($orig_pass); 
// this creates a 32 char string of encrypted chars

function authUser($user, $pass) {
$sql = SELECT id FROM user_table WHERE (user = '$user') AND
(pass = '$pass');
$result = mysql_query($sql);
if (!$result) {
die(Error querying DB in
authUser()br.mysql_error());
}
return mysql_num_rows($result);
}

/ then you call on the function to auth. If the function returns 1,
then the user is authenticated, if 0, it fails. /

$is_auth = authUser($submitted_user, $md5_pass);
if ($is_auth == 0) {
echo Sorry, bad user/pass. Hit back and try again.;
}
else {
echo You logged in successfully!;
}

?

Hope this helps!

-- David Balatero

-Original Message-
From: Paulo Henrique Lomanto [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 25, 2001 12:23 PM
To: Pedro M. S. Oliveira; PHP db
Subject: RES: [PHP-DB] Password field!


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi.

You can do this:

Encrypt a passowrd before insert into db using $var =
md5('your_password'); and insert the $var into your pass field into
your db.

To verify the password, get the pass entered by user and do
$md5('user_pass') and do a select into your db like this:

SELECT user, ip FROM your_table WHERE user = '.$user_entered.' AND
pass = '.$md5('user_pass').';

if this select return a row, the user pass is valid. If not, this is
not valid. And your password are encrypted! :)

[]´s

Lomanto, Paulo H.

- -Mensagem original-
De: Pedro M. S. Oliveira [mailto:[EMAIL PROTECTED]]
Enviada em: quarta-feira, 25 de abril de 2001 16:01
Para: PHP db
Assunto: [PHP-DB] Password field!


Hello all!
i was wondering if any1 of you could help me with something.
i have a table with 3 fields user_ip, user and pass.
how can i encript the pass and then read compare it with a pass
inserted on the web page?
thanx


***
Pedro Miguel Silva Oliveira
Cell Phone: +351 96 5867227
SMS: [EMAIL PROTECTED]
Email: [EMAIL PROTECTED]


-BEGIN PGP SIGNATURE-
Version: PGPfreeware 7.0.3 for non-commercial use http://www.pgp.com

iQA/AwUBOuckBZyz9Qg5WP+kEQITSQCguN65L93RIeqmynzoV8uMArXinJEAoIPQ
WiDfcwq/ZJXTvDPPL6Xm3zwt
=jwsZ
-END PGP SIGNATURE-


-- 
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] extracting login name

2001-04-25 Thread Zak Greant

If you are running PHP as an Apache module, you should have access to the
user authentication data as $PHP_AUTH_USER and $PHP_AUTH_PW - see the
features section of the PHP manual for more information.

--zak


- Original Message -
From: olinux [EMAIL PROTECTED]
To: PHP-DB [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, April 26, 2001 1:45 AM
Subject: [PHP-DB] extracting login name


Hey all,
I have a htpsswd protected directory and would like the client to only log
on once.  Is there a way i can get their USERNAME so that i can pull the
correct records from the db?

thanks much
olinux



-- 
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] Postgres/IIS/PHP3

2001-04-25 Thread J Northey

yep...Version 3 is still going strong.

Q:  Can php3 (on Win2k-IIS 5) be hooked up to Postgres?

If so, where can one obtain the module to hook into php3?
eg. extension=php3_pgsql.dll

???

regards,

J Northey

-- 
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] extracting login name

2001-04-25 Thread Zak Greant

Quite right - thanks for the correction Paul! :)

--zak



- Original Message -
From: Paul Burney [EMAIL PROTECTED]
To: olinux [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Wednesday, April 25, 2001 11:07 PM
Subject: Re: [PHP-DB] extracting login name


 on 4/26/01 12:45 AM, olinux at [EMAIL PROTECTED] wrote:

  I have a htpsswd protected directory and would like the client to only
  log on once.  Is there a way i can get their USERNAME so that i can pull
  the correct records from the db?

 IIRC, $PHP_AUTH_USER and $PHP_AUTH_PW are only set if PHP is sending the
 authentication.  If they don't work for you, you should be able to use the
 environment variable $REMOTE_USER.



-- 
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] compilation does not support pg_cmdtuples()?

2001-04-25 Thread Yasuo Ohgaki

Oh. You seems to have php_pgsql.dll that pg_cmdtuples() compiled in.
(Where did you get it? I don't have environment to compile PHP/Win and I need
it)

I guess all you need to do is copy php_pgsql.dll which works to other machine.

Other possibility is your error_reporting. You might set E_ALL for one,
different setting for other.

Regards,
--
Yasuo Ohgaki


Brad Hubbard [EMAIL PROTECTED] wrote in message
015301c0cdfc$bc211030$3200a8c0@BADNOTE">news:015301c0cdfc$bc211030$3200a8c0@BADNOTE...
 Does anyone know what causes PHP to generate the following error/warning?

 Warning: This compilation does not support pg_cmdtuples()

 I have what appear to be two identically configured systems PHP4.04pl1 and
 PostgreSQL 7.0.2-17, one generates this warning, the other does not?

 TIA.

 Brad Hubbard
 Congo Systems
 12 Northgate Drive,
 Thomastown, Victoria, Australia 3074
 Email: [EMAIL PROTECTED]
 Ph: +61-3-94645981
 Fax: +61-3-94645982
 Mob: +61-419107559




 --
 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] Retrieving and Printing Categories

2001-04-25 Thread Jordan Elver

Hi,
I've got a load of records that are in different categories.
What is the best way to get all the records or selected records and print 
them in such a way that they are grouped (on the page) in their relevent 
category, like:

Fruit
- Apples
- Pears
- Bananas

Vegetables
- Carrots
- Cabbages

etc, etc.

Sometime my categories are ina dfferent table, don't know if this matters?
How can I do this?

TIA,

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]