Re: [PHP-DB] Undefined Constant

2002-11-27 Thread Tyler Whitesides
Hi,
Thank you all for your quick help, it was just a Youve been up too long
working on this and it is the middle of the night mistakes.  Once I put
quotes around my constant, everything worked.
Thanks again,
Tyler
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 26, 2002 11:39 PM
Subject: Re: [PHP-DB] Undefined Constant


 On Wednesday 27 November 2002 15:24, Tyler Whitesides wrote:
  Hi,
 
  Although I have been working with PHP for a while, working with
  Databases is something that I am only so so at.  This code is supposed
to
  grab the price from the database given the auto_increment id is inside
of
  $casing.  I am trying to get the $row[price] to echo so that Javascript
  recieves a string, converts it to an integer, and later on in the code,
  gives the user a total.  Any ideas?

 Use:

   $row['price']

 --
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *


 /*
 The world really isn't any worse.  It's just that the news coverage
 is so much better.
 */


 --
 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] Re: MySQL/PHP Iterative Tree

2002-11-27 Thread David Elliott
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Greetings John

On 26 November 2002 at 18:54:04 -0500 (which was 23:54 where I live) John W.
Holmes wrote and made these points

 This is OK for some simple trees, however it does have some limitations.

 (1) Adding another tree / series of nodes into the middle if the set.

 Not if you can define what the absolute max size of a node will be.

Most of my applications I can not, and this is a limitation that I would never
want to impose on on my apps.

If you can then good.

 (2) A child node that belongs to more than one parent.

 I give a certain company the node numbers of 6-5006. Now assign that left
 and right pair a unique id. Now you can have multiple people with that
 same ID.

I might have misunderstood you but sorry but this is a big no no in my all
my apps. Every item must have a unique ID. This is a fundamental basis of
all my systems.

- --
 See you in Cyber space,   ___
  David   |David  Elliott|   Software Engineer|
 _| [EMAIL PROTECTED] | PGP Key ID 0x650F4534  |
| Would it help if I got out and pushed?  -Princess Leia  |

-BEGIN PGP SIGNATURE-
Version: 6.5.8ckt http://www.ipgpp.com/

iQA/AwUBPeSW6PmK8eZlD0U0EQJ+HwCg4UQSEN5ee3i5kUiiM7aBsDH0cl4AmwbM
/l5gv6cPCULmf9KUWJ46LY2a
=4Hwb
-END PGP SIGNATURE-


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




[PHP-DB] MySQL: charset

2002-11-27 Thread Radovan Radic
Hi

How can i change default charset for mysql database.
I want to change default charset on cp1251 just for one database
'dblibrary'. I have seen something like
mysql --default-character-set=cp1251, but i dont know does it work?

Thanks



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




[PHP-DB] Re: MySQL: charset

2002-11-27 Thread Radovan Radic

Radovan Radic [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 How can i change default charset for mysql database.
 I want to change default charset on cp1251 just for one database
 'dblibrary'. I have seen something like
 mysql --default-character-set=cp1251, but i dont know does it work?

 Thanks

I thought i could do this somehow when connecting from PHP because i need
other databases to be in latin charset.
MySQL 3.23.41 -nt
PHP 4.2.3



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




Re: [PHP-DB] Connecting to MS SQL 7

2002-11-27 Thread Adam Voigt
A. I think the php3_ isn't a good sign. 
B. You should remove whatever you found on the web and downloaded.
C. Copy all the DLL's in the dll folder (under your PHP folder) to
C:\WINNT\SYSTEM32
D. Re-copy the php.ini-recommended from your PHP folder to
C:\WINNT\php.ini and see if it stops looking for php3.

On Tue, 2002-11-26 at 18:36, Mark Farmer wrote:
 I have successfully installed PHP 4.2.3 on a Win NT 4 server, running IIS 4, 
 and can execute PHP functions now.
 
 However, when I try to connect to an MS SQL 7 database on the same box, I 
 receive this error: PHP Warning: Unable to load dynamic library 
 './php3_mssql70.dll' - %1 is not a valid Windows NT application, and my 
 mssql_connect statment fails.
 
 What I had done was to find a copy of php3_mssql70.dll on the web and copy 
 it onto the server -- various faqs told me this needed to happen in order 
 for database calls to work.
 
 Why isn't this dll being recognized as a valid Windows NT application, then?
 
 Thank you.
 
 _
 STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
 http://join.msn.com/?page=features/junkmail
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Resource id #2

2002-11-27 Thread Adam Voigt
Umm, he is putting them into an array, I quote:

while ($row = mysql_fetch_array($result)) {
  $row['Books.Title'];
  $row['Books.Author'];
  $row['Books.ISBN'];
  $row['BookList.dbase'];
  $row['BookList.dbase_user'];
  $row['BoxSet.BoxSet'];
  $row['Category.Category'];
  $row['Category.Sub_category'];
  $row['Publisher.Publisher'];
  $row['AuthUsers.email'];
  
  }

See the while condition?

On Wed, 2002-11-27 at 06:03, Chris Barnes wrote:
 You need to put your $result into an array. you can use:
 
 $result_array = mysql_fetch_array($result);
 
 then, if you know the field names in the array, print them like so:
 
 echo $result_array[field1];
 echo $result_array[field2];
 
 or if you dont know their names you can refer to their position numbers
 starting from 0 e.g.
 
 echo $result_array[0];
 echo $result_array[1];
 
 using the position numbers you could put together a quick script to
 crawl through the array and print all the fields with a few lines of
 code.
 
 On Wed, 2002-11-27 at 05:09, The Cossins Fam wrote:
  Hello.
  
  I am using MySQL as a database for a departmental library.  I have written
  a quick search script, but keep getting resource id #2 as a result to my
  search.  I have read the online documentation for the
  mysql_fetch_array() function and must say, I don't see that I'm missing
  anything.  However, I've only started programming, much less working with
  PHP, so perhaps someone can help me out.  Here's my code:
  
  ?
  
  $quickSearch = mcse;
  
  $table1 = Books;
  $table2 = BookList;
  $table3 = BoxSet;
  $table4 = Category;
  $table5 = Publisher;
  $table6 = AuthUsers;
  $table7 = CD;
  
  $connection = mysql_connect(localhost, root) or die(Couldn't connect
  to the library database.);
  
  $db_select = mysql_select_db(library, $connection) or die(Couldn't
  select the library database.);
  
  $search = SELECT * FROM $table1 LEFT JOIN $table2 ON Books.BookListID =
  BookList.BookListID
  LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
  LEFT JOIN $table4 ON Books.CategoryID = Category.CategoryID
  LEFT JOIN $table5 ON Books.PublisherID = Publisher.PublisherID
  LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
  LEFT JOIN $table7 ON Books.CD = CD.CD_ID
  WHERE Books.Title LIKE \%'$quickSearch'%\
  OR Books.Author LIKE \%'$quickSearch'%\
  OR Books.ISBN LIKE \%'$quickSearch'%\
  OR BookList.dbase LIKE \%'$quickSearch'%\
  OR BookList.dbase_user LIKE \%'$quickSearch'%\
  OR BoxSet.BoxSet LIKE \%'$quickSearch'%\
  OR Category.Category LIKE \%'$quickSearch'%\
  OR Category.Sub_category LIKE \%'$quickSearch'%\
  OR Publisher.Publisher LIKE \%'$quickSearch'%\;
  
  $result = mysql_query($search, $connection) or die(Couldn't search the
  library.);
  
  while ($row = mysql_fetch_array($result)) {
  $row['Books.Title'];
  $row['Books.Author'];
  $row['Books.ISBN'];
  $row['BookList.dbase'];
  $row['BookList.dbase_user'];
  $row['BoxSet.BoxSet'];
  $row['Category.Category'];
  $row['Category.Sub_category'];
  $row['Publisher.Publisher'];
  $row['AuthUsers.email'];
  
  }
  
  
  ?
  
  I then have some HTML to display the result of the search.  I don't
  receive any error messages - I just see an empty table from the HTML
  code I wrote.  I added an echo of the $result to find the resouce id
  #2.
  
  Thanks for any help you can provide.
  
  --joel
  
  
  
  
  
  
  
  _
  The new MSN 8: advanced junk mail protection and 2 months FREE* 
  http://join.msn.com/?page=features/junkmail
  
  
  -- 
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


[PHP-DB] PHP4, Apache 1.3.x, and mod ssl install document?

2002-11-27 Thread RClark
Hello all,

I have a FreeBSD server which has been updated to 4.7 STABLE. I have updated
my ports collection and installed mysql server. Does anyone have an updated
doc on how to install apache with PHP4 and modssl support either from ports
collection or from source. I would greatly appreciate it.

Thanks
Ron



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




Re: [PHP-DB] PHP4, Apache 1.3.x, and mod ssl install document?

2002-11-27 Thread Adam Voigt
Off the top of my head (general guidelines, don't use word for word):

mkdir /usr/local/apache
cd /usr/local/apache
wget http://www.apache.org/dist/httpd/apache_1.3.27.tar.gz
tar -zxf *
cd apache_1.3.27
./configure --prefix=/usr/local/apache_1.3.27
mkdir /usr/local/modssl
cd /usr/local/modssl
wget http://www.modssl.org/source/mod_ssl-2.8.12-1.3.27.tar.gz
tar -zxf *
cd mod_ssl-2.8.12-1.3.27
./configure --with-apache=/usr/local/apache/apache_1.3.27
cd /usr/local/apache/apache_1.3.27

./configure --prefix=/usr/local/apache_1.3.27 --enable-module=ssl
--enable-module=so

make
make certificate type=test (OPTIONAL)
make install
mkdir /usr/local/php
cd /usr/local/php

lynx
http://www.php.net/do_download.php?mr=http%3A%2F%2Fwww.php.net%2Fdf=php-4.2.3.tar.gz
(Save the file with lynx)

tar -zxf *
cd php_4.2.3

./configure --with-apxs=/usr/local/apache_1.3.27/bin/apxs
--with-mysql=/usr

make
make install

Add the line:

application/x-httpd-php .php

To somewhere near the bottom of your httpd.conf
and while your in httpd.conf configure the values you like.

On Wed, 2002-11-27 at 10:38, RClark wrote:
 Hello all,
 
 I have a FreeBSD server which has been updated to 4.7 STABLE. I have updated
 my ports collection and installed mysql server. Does anyone have an updated
 doc on how to install apache with PHP4 and modssl support either from ports
 collection or from source. I would greatly appreciate it.
 
 Thanks
 Ron
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] PHP4, Apache 1.3.x, and mod ssl install document?

2002-11-27 Thread Peter Beckman
Actually, it's easier:

cd /usr/ports/www/apache13-modssl
make install
cd /usr/ports/www/mod_php4
make install
apachectl start (or restart)

Peter

On Wed, 27 Nov 2002, RClark wrote:

 Hello all,

 I have a FreeBSD server which has been updated to 4.7 STABLE. I have updated
 my ports collection and installed mysql server. Does anyone have an updated
 doc on how to install apache with PHP4 and modssl support either from ports
 collection or from source. I would greatly appreciate it.

 Thanks
 Ron



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


---
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] Resource id #2

2002-11-27 Thread Mark
But what do all those $row['fieldname'} rows do? Call me ignorant
(you wouldn't be the first), but a statement that simply has a
variable name doesn't DO anything. Should these have echos in front
of them?

--- Adam Voigt [EMAIL PROTECTED] wrote:
 Umm, he is putting them into an array, I quote:
 
 while ($row = mysql_fetch_array($result)) {
   $row['Books.Title'];
   $row['Books.Author'];
   $row['Books.ISBN'];
   $row['BookList.dbase'];
   $row['BookList.dbase_user'];
   $row['BoxSet.BoxSet'];
   $row['Category.Category'];
   $row['Category.Sub_category'];
   $row['Publisher.Publisher'];
   $row['AuthUsers.email'];
   
   }
 
 See the while condition?
 
 On Wed, 2002-11-27 at 06:03, Chris Barnes wrote:
  You need to put your $result into an array. you can use:
  
  $result_array = mysql_fetch_array($result);
  
  then, if you know the field names in the array, print them like
 so:
  
  echo $result_array[field1];
  echo $result_array[field2];
  
  or if you dont know their names you can refer to their position
 numbers
  starting from 0 e.g.
  
  echo $result_array[0];
  echo $result_array[1];
  
  using the position numbers you could put together a quick script
 to
  crawl through the array and print all the fields with a few lines
 of
  code.
  
  On Wed, 2002-11-27 at 05:09, The Cossins Fam wrote:
   Hello.
   
   I am using MySQL as a database for a departmental library.  I
 have written
   a quick search script, but keep getting resource id #2 as a
 result to my
   search.  I have read the online documentation for the
   mysql_fetch_array() function and must say, I don't see that I'm
 missing
   anything.  However, I've only started programming, much less
 working with
   PHP, so perhaps someone can help me out.  Here's my code:
   
   ?
   
   $quickSearch = mcse;
   
   $table1 = Books;
   $table2 = BookList;
   $table3 = BoxSet;
   $table4 = Category;
   $table5 = Publisher;
   $table6 = AuthUsers;
   $table7 = CD;
   
   $connection = mysql_connect(localhost, root) or
 die(Couldn't connect
   to the library database.);
   
   $db_select = mysql_select_db(library, $connection) or
 die(Couldn't
   select the library database.);
   
   $search = SELECT * FROM $table1 LEFT JOIN $table2 ON
 Books.BookListID =
   BookList.BookListID
   LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
   LEFT JOIN $table4 ON Books.CategoryID =
 Category.CategoryID
   LEFT JOIN $table5 ON Books.PublisherID =
 Publisher.PublisherID
   LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
   LEFT JOIN $table7 ON Books.CD = CD.CD_ID
   WHERE Books.Title LIKE \%'$quickSearch'%\
   OR Books.Author LIKE \%'$quickSearch'%\
   OR Books.ISBN LIKE \%'$quickSearch'%\
   OR BookList.dbase LIKE \%'$quickSearch'%\
   OR BookList.dbase_user LIKE \%'$quickSearch'%\
   OR BoxSet.BoxSet LIKE \%'$quickSearch'%\
   OR Category.Category LIKE \%'$quickSearch'%\
   OR Category.Sub_category LIKE \%'$quickSearch'%\
   OR Publisher.Publisher LIKE \%'$quickSearch'%\;
   
   $result = mysql_query($search, $connection) or die(Couldn't
 search the
   library.);
   
   while ($row = mysql_fetch_array($result)) {
   $row['Books.Title'];
   $row['Books.Author'];
   $row['Books.ISBN'];
   $row['BookList.dbase'];
   $row['BookList.dbase_user'];
   $row['BoxSet.BoxSet'];
   $row['Category.Category'];
   $row['Category.Sub_category'];
   $row['Publisher.Publisher'];
   $row['AuthUsers.email'];
   
   }
   
   
   ?
   
   I then have some HTML to display the result of the search.  I
 don't
   receive any error messages - I just see an empty table from the
 HTML
   code I wrote.  I added an echo of the $result to find the
 resouce id
   #2.
   
   Thanks for any help you can provide.
   
   --joel
   
   
   
   
   
   
   
  
 _
   The new MSN 8: advanced junk mail protection and 2 months FREE*
 
   http://join.msn.com/?page=features/junkmail
   
   
   -- 
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
   
  
 -- 
 Adam Voigt ([EMAIL PROTECTED])
 The Cryptocomm Group
 My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
 

 ATTACHMENT part 2 application/pgp-signature name=signature.asc



=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
PHP Database 

[PHP-DB] is innodb faster than MyISAM???

2002-11-27 Thread Dave
i just read a benchmark on innodb.org
http://www.innodb.com/bench.html

that says under the innodb vs MyISAM section...

MyISAM is the default table type used in MySQL and InnoDB is a table type
supporting transactions in MySQL. I wrote a Perl program which inserts 100
000 rows to a table with 3 integer columns and two indexes. Then another
Perl program fetches each row either through a secondary index or the
primary key. The Perl programs for each test are at the end of this web
page.
I ran the tests on a Linux 2-CPU Xeon 450 MHz. The times below are wall
clock times. The results were:

  InnoDBMyISAM

100 000 inserts25 s. 40 s.

100 000 selects on
primary key57 s. 58 s.

100 000 selects on
secondary key  68 s. 95 s.



Is this true? For regular inserts that seems cool - obviously transactions
would take a little more,
but hey, why bother with MyISAM then?

dave



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




Re: [PHP-DB] Resource id #2

2002-11-27 Thread Adam Voigt
They don't do anything, but my point was, he said that what he pulled
from the DB needed to be put into an array, and I was pointing out, it
already was.

On Wed, 2002-11-27 at 12:23, Mark wrote:
 But what do all those $row['fieldname'} rows do? Call me ignorant
 (you wouldn't be the first), but a statement that simply has a
 variable name doesn't DO anything. Should these have echos in front
 of them?
 
 --- Adam Voigt [EMAIL PROTECTED] wrote:
  Umm, he is putting them into an array, I quote:
  
  while ($row = mysql_fetch_array($result)) {
$row['Books.Title'];
$row['Books.Author'];
$row['Books.ISBN'];
$row['BookList.dbase'];
$row['BookList.dbase_user'];
$row['BoxSet.BoxSet'];
$row['Category.Category'];
$row['Category.Sub_category'];
$row['Publisher.Publisher'];
$row['AuthUsers.email'];

}
  
  See the while condition?
  
  On Wed, 2002-11-27 at 06:03, Chris Barnes wrote:
   You need to put your $result into an array. you can use:
   
   $result_array = mysql_fetch_array($result);
   
   then, if you know the field names in the array, print them like
  so:
   
   echo $result_array[field1];
   echo $result_array[field2];
   
   or if you dont know their names you can refer to their position
  numbers
   starting from 0 e.g.
   
   echo $result_array[0];
   echo $result_array[1];
   
   using the position numbers you could put together a quick script
  to
   crawl through the array and print all the fields with a few lines
  of
   code.
   
   On Wed, 2002-11-27 at 05:09, The Cossins Fam wrote:
Hello.

I am using MySQL as a database for a departmental library.  I
  have written
a quick search script, but keep getting resource id #2 as a
  result to my
search.  I have read the online documentation for the
mysql_fetch_array() function and must say, I don't see that I'm
  missing
anything.  However, I've only started programming, much less
  working with
PHP, so perhaps someone can help me out.  Here's my code:

?

$quickSearch = mcse;

$table1 = Books;
$table2 = BookList;
$table3 = BoxSet;
$table4 = Category;
$table5 = Publisher;
$table6 = AuthUsers;
$table7 = CD;

$connection = mysql_connect(localhost, root) or
  die(Couldn't connect
to the library database.);

$db_select = mysql_select_db(library, $connection) or
  die(Couldn't
select the library database.);

$search = SELECT * FROM $table1 LEFT JOIN $table2 ON
  Books.BookListID =
BookList.BookListID
LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
LEFT JOIN $table4 ON Books.CategoryID =
  Category.CategoryID
LEFT JOIN $table5 ON Books.PublisherID =
  Publisher.PublisherID
LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
LEFT JOIN $table7 ON Books.CD = CD.CD_ID
WHERE Books.Title LIKE \%'$quickSearch'%\
OR Books.Author LIKE \%'$quickSearch'%\
OR Books.ISBN LIKE \%'$quickSearch'%\
OR BookList.dbase LIKE \%'$quickSearch'%\
OR BookList.dbase_user LIKE \%'$quickSearch'%\
OR BoxSet.BoxSet LIKE \%'$quickSearch'%\
OR Category.Category LIKE \%'$quickSearch'%\
OR Category.Sub_category LIKE \%'$quickSearch'%\
OR Publisher.Publisher LIKE \%'$quickSearch'%\;

$result = mysql_query($search, $connection) or die(Couldn't
  search the
library.);

while ($row = mysql_fetch_array($result)) {
$row['Books.Title'];
$row['Books.Author'];
$row['Books.ISBN'];
$row['BookList.dbase'];
$row['BookList.dbase_user'];
$row['BoxSet.BoxSet'];
$row['Category.Category'];
$row['Category.Sub_category'];
$row['Publisher.Publisher'];
$row['AuthUsers.email'];

}


?

I then have some HTML to display the result of the search.  I
  don't
receive any error messages - I just see an empty table from the
  HTML
code I wrote.  I added an echo of the $result to find the
  resouce id
#2.

Thanks for any help you can provide.

--joel







   
  _
The new MSN 8: advanced junk mail protection and 2 months FREE*
  
http://join.msn.com/?page=features/junkmail


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

   
  -- 
  Adam Voigt ([EMAIL PROTECTED])
  The Cryptocomm Group
  My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
  
 
  ATTACHMENT part 2 application/pgp-signature name=signature.asc
 
 
 
 =
 Mark Weinstock
 [EMAIL PROTECTED]
 ***
 You can't demand something as a 

[PHP-DB] imap_search problems

2002-11-27 Thread Peter Beckman
I'm writing a command line script to go through a mailbox on the file
system.  PHP the binary is compiled with imap, I've confirmed by using
imap_headers to get the array of the 10,051 messages and printed the array
out.

Here's my code:

#!/usr/local/bin/php -q
?php

$id = $_SERVER[argv][1];

ini_set(max_execution_time,9000);

list($usec, $sec) = explode( ,microtime());
$start = ((float)$usec + (float)$sec);

$mbox = imap_open(/home/beckman/public_html/spamtracker/a-copy-of-spam, , ) 
or die(can't open);

print Finding '$id' (Executing imap_search($mbox,'$id'))\n;
$matches = imap_search($mbox, '$id');
print_r($matches);

#while(list($key,$val)=each($matches)) {
#   echo $key: $val\n;
#}

imap_close($mbox);
?

Here's what I get when searching for a variety of different possibilities (no results 
being returned in $matches):

Finding 'ALL fat' (Executing imap_search(Resource id #1,'ALL fat'))
Finding 'ALL fat' (Executing imap_search(Resource id #1,'ALL fat'))
Finding 'BODY fat' (Executing imap_search(Resource id #1,'BODY fat'))

Then I put SE_UID as the last option in imap_search:
Finding 'BODY fat' (Executing imap_search(Resource id #1,'BODY fat',SE_UID))
Finding 'TO [EMAIL PROTECTED]' (Executing imap_search(Resource id #1,'TO 
[EMAIL PROTECTED]',SE_UID))

I get nothing in $matches ever.  What is going on?  Am I doing it wrong?
I've read the documentation and the contributed notes and copied and pasted
replacing the search strings and continue to fail.  Argh.

I know the word fat is in the body of more than 50 messages, as well as
in the headers, as there are 10,051 pieces of spam I'm trying to parse.

Peter
---
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] imap_search problems

2002-11-27 Thread Peter Beckman
Don't you hate it when, right after you post to the list, you figure out
your problem? :-)

I removed the quotes around $id after using:

$err = imap_errors();
print_r($err);

to determine what the problem was.

Anyway, Happy Thanksgiving all, happy troubleshooting and never forget to use
the debugging tools the nice people at PHP gave you for Christmas.

Beckman

On Wed, 27 Nov 2002, Peter Beckman wrote:

 I'm writing a command line script to go through a mailbox on the file
 system.  PHP the binary is compiled with imap, I've confirmed by using
 imap_headers to get the array of the 10,051 messages and printed the array
 out.

 Here's my code:

 #!/usr/local/bin/php -q
 ?php

 $id = $_SERVER[argv][1];

 ini_set(max_execution_time,9000);

 list($usec, $sec) = explode( ,microtime());
 $start = ((float)$usec + (float)$sec);

 $mbox = imap_open(/home/beckman/public_html/spamtracker/a-copy-of-spam, , 
) or die(can't open);

 print Finding '$id' (Executing imap_search($mbox,'$id'))\n;
 $matches = imap_search($mbox, '$id');
 print_r($matches);

 #while(list($key,$val)=each($matches)) {
 #   echo $key: $val\n;
 #}

 imap_close($mbox);
 ?

 Here's what I get when searching for a variety of different possibilities (no 
results being returned in $matches):

 Finding 'ALL fat' (Executing imap_search(Resource id #1,'ALL fat'))
 Finding 'ALL fat' (Executing imap_search(Resource id #1,'ALL fat'))
 Finding 'BODY fat' (Executing imap_search(Resource id #1,'BODY fat'))

 Then I put SE_UID as the last option in imap_search:
 Finding 'BODY fat' (Executing imap_search(Resource id #1,'BODY fat',SE_UID))
 Finding 'TO [EMAIL PROTECTED]' (Executing imap_search(Resource id #1,'TO 
[EMAIL PROTECTED]',SE_UID))

 I get nothing in $matches ever.  What is going on?  Am I doing it wrong?
 I've read the documentation and the contributed notes and copied and pasted
 replacing the search strings and continue to fail.  Argh.

 I know the word fat is in the body of more than 50 messages, as well as
 in the headers, as there are 10,051 pieces of spam I'm trying to parse.

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


---
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: FW: [PHP-DB] PHP and PostrgeSQL tutorial

2002-11-27 Thread Daniel Wells
I have tried the designmagick tutorial and cant get ti to post data to the
DB.  It tells me I have posted data and a new row appears, but only th
eid field has any data.

Are there any other tutorials or am I doing something wrong?  I am cutting
and pasting from the tutorial.  I do have to make adjustments to the web
page talking to the DB server (the connection).  But everything else is
the same.

On Wed, 10 Jan 2001 17:25:28 +0800, Ronnie Esguerra wrote:

 
 
 http://designmagick.50megs.com
 
 Ronnie
.php.net


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




[PHP-DB] 'Remote' data

2002-11-27 Thread Bartosz Matosiuk
Hi

I need to create function which would read a data (mysql) from the table
from the other page, put this data in my MySQL table and return them on my
page. My problem is that I have no idea how to get that data.

Please give me a hint or maybe you know some articles about that,


Thanks
Bartosz



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




[PHP-DB] Session questions

2002-11-27 Thread Chris Payne
Hi there everyone,

 I have a login system which uses sessions, and when people login it puts
the date they logged in in their profile and moves their last login date
over to another field, that works fine, but how can I check if someone has
logged out via code?  In other words, if someone does what they want and
then just closes the browser without logging out no record is saved, how can
I tell whether they have logged out / gone from the website ?  I need to
know this for security.

Which brings me to my next question :-)

How would I make it so only 1 person can login at any time with any given
username/password combo?  I know I have to track the sessions, but not sure
how :-(

Any help would really be appreciated.

Chris


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




RE: [PHP-DB] Session questions

2002-11-27 Thread John W. Holmes
  I have a login system which uses sessions, and when people login it
puts
 the date they logged in in their profile and moves their last login
date
 over to another field, that works fine, but how can I check if someone
has
 logged out via code?  In other words, if someone does what they want
and
 then just closes the browser without logging out no record is saved,
how
 can
 I tell whether they have logged out / gone from the website ?  I need
to
 know this for security.

You can't know for sure. It's a limitation of HTTP. What you do is
assume that if after X minutes, the user hasn't done anything, then they
have left. If you're using sessions, the files will be cleaned up after
X minutes, anyhow, and they will lose their login. 

 Which brings me to my next question :-)
 
 How would I make it so only 1 person can login at any time with any
given
 username/password combo?  I know I have to track the sessions, but not
 sure
 how :-(

Set a flag in the database that says whether that user is logged in. If
that username tries to log in again, set an error. The problem you'll
run into with this, though, is you'll have to implement a cleanup
system to unset the flag after X minutes of inactivity. Also, if I
accidentally close my window and then go back to log in, it won't let me
because the flag is still set until your cleanup program unsets it. 

---John Holmes...



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




Re: [PHP-DB] Session questions

2002-11-27 Thread Marco Tabini
Here's a couple of suggestions:

1) You can use javascript to trap the window's closure and create a new
window that simply calls one of your scripts that closes the session.
This is not 100% foolproof, however, so you need to come up with a
backup plan, like closing sessions automatically with a batch process in
the backend.

2) That's easy enough--just store a unique token in their session and
in the database when they log in. If, when they come to you with a
particular user id they do not have the right token, then that means
that either (a) somebody is trying to steal a session or (b) two people
have signed on with the same username, in which case you can decide who
gets the boot. This, too, is not a completely foolproof method
(particularly if you don't use SSL), but it's a good starting point.

Hope this helps.

Cheers,


Marco

-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers

Come visit us at http://www.phparch.com!




On Wed, 2002-11-27 at 20:19, Chris Payne wrote:
 Hi there everyone,
 
  I have a login system which uses sessions, and when people login it puts
 the date they logged in in their profile and moves their last login date
 over to another field, that works fine, but how can I check if someone has
 logged out via code?  In other words, if someone does what they want and
 then just closes the browser without logging out no record is saved, how can
 I tell whether they have logged out / gone from the website ?  I need to
 know this for security.
 
 Which brings me to my next question :-)
 
 How would I make it so only 1 person can login at any time with any given
 username/password combo?  I know I have to track the sessions, but not sure
 how :-(
 
 Any help would really be appreciated.
 
 Chris
 
 
 -- 
 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] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Gavin Amm
Hi,

I'm trying to pick up data from my MySQL database, use a foreach loop to
extact the data from the result  put that data into a select list.

I have tried the following code with  without the $row = ... line, both
unsucessfully:

?PHP
$db = mysql_connect(myhost, username, );
mysql_select_db(mydatabase, $db);

## FETCH INFO
$sql_dept = SELECT dept FROM content GROUP BY dept;
$sql_deptsub = SELECT deptsub FROM content GROUP BY deptsub;

mysql_close($db);
?


select name=dept
  option-select-/option
?PHP
$result = mysql_query($sql_dept, $db);
$row = mysql_fetch_array($result);
foreach ($row as $value) {echo option
value=\$value\$value/option\n;}
?
/select


I get the following error message in my HTML output code:

bWarning/b:  1 is not a valid MySQL-Link resource in
b/home/.../public_html/content.php/b on line b48/bbr
br
bWarning/b:  Invalid argument supplied for foreach() in
b/home/.../public_html/content.php/b on line b49/bbr

Line 48 is the line begining with: foreach...


Any help would be appreciated.
Thanks,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




Re: [PHP-DB] foreach loop from MySQL select query to HTML selectlist

2002-11-27 Thread John Coder
On Wed, 2002-11-27 at 23:33, Gavin Amm wrote:
 Hi,
 
 I'm trying to pick up data from my MySQL database, use a foreach loop to
 extact the data from the result  put that data into a select list.
 
 I have tried the following code with  without the $row = ... line, both
 unsucessfully:
 
 ?PHP
 $db = mysql_connect(myhost, username, );
 mysql_select_db(mydatabase, $db);
 
 ## FETCH INFO
 $sql_dept = SELECT dept FROM content GROUP BY dept;
 $sql_deptsub = SELECT deptsub FROM content GROUP BY deptsub;
 
 mysql_close($db);

How can run a query when it's closed? move this to after the select and
see if it works.
 ?
 
 
 select name=dept
   option-select-/option
 ?PHP
   $result = mysql_query($sql_dept, $db);
   $row = mysql_fetch_array($result);
   foreach ($row as $value) {echo option
 value=\$value\$value/option\n;}
 ?
 /select

Put your mysql_close here if you want to close it.

John Coder


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




RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Gavin Amm
good point! whoops.
ok, i've moved the $result_dept  $result_deptsub queries,
now i'm getting 2 of the same entries in my html code:

select name=dept
  option-select-/option
  option value=auditaudit/option
  option value=auditaudit/option
/select

any thoughts?
Gav

-Original Message-
From: John Coder [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 28 November 2002 3:44 PM
To: Gavin Amm
Cc: Php-Db (E-mail)
Subject: Re: [PHP-DB] foreach loop from MySQL select query to HTML
select list


On Wed, 2002-11-27 at 23:33, Gavin Amm wrote:
 Hi,
 
 I'm trying to pick up data from my MySQL database, use a foreach loop to
 extact the data from the result  put that data into a select list.
 
 I have tried the following code with  without the $row = ... line, both
 unsucessfully:
 
 ?PHP
 $db = mysql_connect(myhost, username, );
 mysql_select_db(mydatabase, $db);
 
 ## FETCH INFO
 $sql_dept = SELECT dept FROM content GROUP BY dept;
 $sql_deptsub = SELECT deptsub FROM content GROUP BY deptsub;
 
 mysql_close($db);

How can run a query when it's closed? move this to after the select and
see if it works.
 ?
 
 
 select name=dept
   option-select-/option
 ?PHP
   $result = mysql_query($sql_dept, $db);
   $row = mysql_fetch_array($result);
   foreach ($row as $value) {echo option
 value=\$value\$value/option\n;}
 ?
 /select

Put your mysql_close here if you want to close it.

John Coder


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


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




RE: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Gavin Amm
ok,

i've looked around the web a bit more  it would appear you can't just use a
foreach function, apparently you need to use a while{foreach{}} structure. i
was hoping you could just use the foreach function?

so this is the code now:

select name=deptsub_select
  option-select-/option
?PHP
while ($row = mysql_fetch_array($result_deptsub)){
  foreach ($row as $value) {
echo option value=\$value\$value/option\n;
  }
}
?
/select


but now the output HTML code is doubling up:

select name=dept
option-select-/option
option value=auditaudit/option
option value=auditaudit/option
option value=consultingconsulting/option
option value=consultingconsulting/option
...
/select


cheers,
Gav


This e-mail and any attachments are intended solely for the named addressee,
are confidential and may contain legally privileged information. 

The copying or distribution of them or of any information they contain, by
anyone other than the addressee, is prohibited. If you received this e-mail
in error, please notify us immediately by return e-mail or telephone +61 2
9413 2944 and destroy the original message. Thank you. 

As Email is subject to viruses we advise that all Emails and any attachments
should be scanned by an up to-date Anti Virus programme automatically by
your system. It is the responsibility of the recipient to ensure that all
Emails and any attachments are cleared of Viruses before opening. KSG can
not accept any responsibility for viruses that maybe contained here in.
Please advise KSG by return Email if you believe any Email sent by our
system may contain a virus. It should be noted that most Anti Virus
programmes can not scan encrypted file attachments (example - documents
saved with a password). Thus extra care should be taken when opening these
files. 

Liability limited by the Accountants Scheme, approved under the Professional
Standards Act 1994 (NSW). 



Level 4 
54 Neridah StreetPO Box 1290 
CHATSWOOD   NSW   2067   CHATSWOOD   NSW   2057 


Ph: +61 2 9413 2944  Fax: +61 2 9413 9901

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




Re: [PHP-DB] foreach loop from MySQL select query to HTML select list

2002-11-27 Thread Jason Wong
On Thursday 28 November 2002 14:21, Gavin Amm wrote:
 ok,

 i've looked around the web a bit more  it would appear you can't just use
 a foreach function, apparently you need to use a while{foreach{}}
 structure. i was hoping you could just use the foreach function?

 so this is the code now:

 select name=deptsub_select
   option-select-/option
 ?PHP
 while ($row = mysql_fetch_array($result_deptsub)){
   foreach ($row as $value) {
 echo option value=\$value\$value/option\n;
   }
 }
 ?
 /select


 but now the output HTML code is doubling up:

 select name=dept
 option-select-/option
 option value=auditaudit/option
 option value=auditaudit/option
 option value=consultingconsulting/option
 option value=consultingconsulting/option
 ...
 /select

mysql_fetch_array() by default returns an array that's associative AND numeric 
(print_r($row) to see what it looks like).

Use mysql_fetch_assoc() instead.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
There are things that are so serious that you can only joke about them
- Heisenberg
*/


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