Re: [PHP-DB] SQL statement

2005-01-07 Thread Jochem Maas
PHPDiscuss - PHP Newsgroups and mailing lists wrote:
Hello everybody,
I'm building a small application and I have trouble passing a POST
variable form one page to another inside the SQL statement.
The query displayed below works great without the
.$_POST['CompanyName']. 

$query_company_listing = SELECT CompanyID, CompanyName,
CompanyOrDepartment, BillingAddress, City, PostalCode, PhoneNumber FROM
company WHERE company.CompanyName=.$_POST['CompanyName'].  ORDER BY
CompanyName ASC;
you need to quote the string (company name) in the actual sql, compare 
the following 2 statements (lets assume companyname is 'IBM'):

WRONG (this is what you are doing now):
SELECT CompanyID, CompanyName,CompanyOrDepartment, BillingAddress, City, 
PostalCode, PhoneNumber FROM company WHERE company.CompanyName=IBM 
ORDER BY CompanyName ASC

RIGHT:
SELECT CompanyID, CompanyName,CompanyOrDepartment, BillingAddress, City, 
PostalCode, PhoneNumber FROM company WHERE company.CompanyName='IBM' 
ORDER BY CompanyName ASC

there may be times when the companyname contains a single quote - that 
will break your query unless you escape the single quote in the name 
before placing the string into the query string... mysql.com can tell 
you more.

But it messes up if I include it because the first  is considered as the
end of the previous one and so on, so the code gets messed up.
I'll really appreciate any/all help!
Have you all an excellent year!
Jorge
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] how can PHP 4 extension for SQLite 3

2005-01-07 Thread garycao
hi,all
   I want to use sqlite 3 in php4,and I found this:
PHP 4 extension for SQLite. (Official) http://pecl.php.net/package/SQLite 
   but it only support sqlite 2,Have anyone hacked it to support sqlite 3?

regards
gary
2005-1-7


[PHP-DB] Re: SQL statement syntaxis

2005-01-07 Thread PHPDiscuss - PHP Newsgroups and mailing lists
Hello everybody,
I just want to thank you all for your help!!
I got three emails helping me out. The problem was that I wasn't including
the ' around the .
When I typed '.$_POST['CompanyName'].' it worked great!

Thank you!!
Jorge

PHPDiscuss - PHP Newsgroups and mailing lists wrote:

 Hello everybody,
 I'm building a small application and I have trouble passing a POST
 variable form one page to another inside the SQL statement.

 The query (displayed below) works great without the
 .$_POST['CompanyName']. 

 $query_company_listing = SELECT CompanyID, CompanyName,
 CompanyOrDepartment, BillingAddress, City, PostalCode, PhoneNumber FROM
 company WHERE company.CompanyName=.$_POST['CompanyName'].  ORDER BY
 CompanyName ASC;

 But it messes up if I include it because the first  is considered as the
 end of the previous one and so on. So the code gets messed up.

 Any help will be greatly appreciated!
 Have everybody a wonderful 2005!
 Jorge

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



RE: [PHP-DB] SQL statement syntaxis

2005-01-07 Thread Bastien Koert
missing the singles quotes around the company name text element
$query_company_listing = SELECT CompanyID, CompanyName,
CompanyOrDepartment, BillingAddress, City, PostalCode, PhoneNumber FROM
company WHERE company.CompanyName='.$_POST['CompanyName'].'  ORDER BY
CompanyName ASC;
bastien
From: [EMAIL PROTECTED] (PHPDiscuss - PHP Newsgroups and mailing 
lists)
To: php-db@lists.php.net
Subject: [PHP-DB] SQL statement syntaxis
Date: 6 Jan 2005 19:12:16 -

Hello everybody,
I'm building a small application and I have trouble passing a POST
variable form one page to another inside the SQL statement.
The query (displayed below) works great without the
.$_POST['CompanyName'].
$query_company_listing = SELECT CompanyID, CompanyName,
CompanyOrDepartment, BillingAddress, City, PostalCode, PhoneNumber FROM
company WHERE company.CompanyName=.$_POST['CompanyName'].  ORDER BY
CompanyName ASC;
But it messes up if I include it because the first  is considered as the
end of the previous one and so on. So the code gets messed up.
Any help will be greatly appreciated!
Have everybody a wonderful 2005!
Jorge
--
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] select text from a text file

2005-01-07 Thread Ed
Hi,

Thanks for answering the question.

I'm going to make it write to a database rather than text file after
searching google and coming accross common problems with text files.

I've now just got to figure out how to mark the message as read in the
database so it does not re-appear next time the user clicks update.

I'm going to build a function that will put the message in the correct table
using an if clause, is that the best method?

Ed
- Original Message - 
From: Andrew Kreps [EMAIL PROTECTED]
To: Ed [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Thursday, January 06, 2005 6:55 PM
Subject: Re: [PHP-DB] select text from a text file


 On Wed, 5 Jan 2005 11:58:59 -, Ed [EMAIL PROTECTED] wrote:
  Happy new year folks!
 
  The titlemight make this seem like an easy to answer question
 
  However here's the complicated bit (well for me anyway).
 
  In my text file that is written to by the users in a chatroom it looks
like this:
 
  nickname||color||what the user is saying||user
 
  how can i make it so that if they have a private message when they press
update it pulls the message from the text file and displays it in the frame
but also deletes the text?
 

 You should be using a database for this, it makes things so much
 easier.  That being said, here's one way to go about the text file
 version:

 Open the file, read through it line by line.
 As you read it, push the lines into an array.
 If you find a private message for the user, store that in a variable,
 and do not push it into the array.
 Finish reading the file.
 If there's a private message, you've got it in a variable, and you can
 overwrite the private message file with the array you've stored, which
 is all of the current private messages minus the one you're about to
 display.

 Please note, this does not scale at all, especially in the fast-paced
 world of chat rooms.  You will likely end up with file locking
 problems if you proceed with the flat-file method.


  Also, how can i make it so that if in a drop down menu they select the
word everybody it goes to a file called messages.txt and if they select
user or user2 or user3 from the list it writes to private.txt is this
at all possible? user and user2 etc arent hardcoded it's pulling the names
from a list of online users.
 

 Are you talking about appending messages to a text file?  In that
 case, you can have the dropdown submit with the message, and in the
 PHP code have a case for 'everybody' where it writes to messages.txt,
 and if it's not 'everybody', write it to private.txt with the username
 that was selected from the dropdown as part of the row.

 Does that answer your question?

 -- 
 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] setFetchMode problem with mssql/w2003/php503

2005-01-07 Thread Jochem Maas
ltlists wrote:
I'm getting this error when attempting to use setFetchMode() 

PHP Fatal error:  Call to undefined method DB_result::setFetchMode()
in new.php on line 27
which means that class DB_result does not have a setFetchMode()
method. did you read past the colon (:) in the error message?
did it cross your mind to search for the class that does contain that
method??

My code looks like this for now, almost the same as some of the
samples getting around:
$db = DB::connect(mssql://blah:[EMAIL PROTECTED]/blah);
if (DB::isError($db)) {
die ($db-getMessage());
}
$res=$db-query(select * from Contacts);
if (DB::isError($res)) { 
 print $res-getMessage() . \nDetails: 
  .$res-getUserInfo();
} else { 
$res-setFetchMode(DB_FETCHMODE_ASSOC);

If looks as if you are trying to call the setFetchMode() method
on the 'resultset' object in your first example and in your second 
example (the function) you are calling the same method on the 'db' 
object. so this might work better:

$db-setFetchMode(DB_FETCHMODE_ASSOC);
I'm assuming $db is actually a a valid object of class DB
$row=$res-fetchRow();
$field0=$row['ID'];
$field1=$row['Name'];
$res-free();
$db-disconnect();
}
Just incase this could be an installation related problem I should
explain that I am using this in a virtual PC environment with IIS6,
PEAR was downloaded via a normal machine and then copied to the
virtual PC and go-pear was run (I think that's it).
A function based connection like this:
function execute_query($db,$sql) {
debug($sql);
$db-setFetchMode(DB_FETCHMODE_ASSOC);
return $db-getAll($sql);
}
seems to return data instead of erroring out.
I'm just a bit lost as to why the first lot of code has a problem
with DB_result.
If anyone can help that would be great.   
Thanks for your time.

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


Re: [PHP-DB] SQL statement

2005-01-07 Thread Jochem Maas
Jason,
can you please turn off the return receipts on emails you send to the list.
it's bloody annoying to have 'The Sender wishes to be notified' 
popup messages everytime I read one of your emails (and, alas, I don't 
have the skill to hack the return receipt crap right out of Tbird). BTW 
your not the only one that has it turned on - so this goes to the rest 
of you as well

:-)
cheers!

Jason Walker wrote:
First off - $_POST['CompanyName'] is valid, right?
...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Fetch data from dbf file?

2005-01-07 Thread Supri anto
hi all,
did anyone know how to fetch data from dbf file (Clipper) ? 

best regards,
suprie
-- 
Jangan tanyakan apa yang Indonesia telah berikan pada mu
tapi bertanyalah apa yang telah engkau berikan kepada Indonesia

-BEGIN GEEK CODE BLOCK-
Version: 3.1
GU/IT  d- s: a-- C++ UL P L++ E W++ N* o-- K- 
w PS  Y-- PGP- t++ 5 X R++ tv  b+ DI D+ G e+ h* r- z?
 --END GEEK CODE BLOCK--

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



RE: [PHP-DB] Trying to connext to MySQL with PEAR

2005-01-07 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 06 January 2005 21:10, Norland, Martin wrote:

  -Original Message-
  From: Ford, Mike [mailto:[EMAIL PROTECTED]
  Sent: Thursday, January 06, 2005 1:13 PM
  Subject: RE: [PHP-DB] Trying to connext to MySQL with PEAR [snip]
  Oh dear, as a fully-paid-up pedant, I'm afriad I can't resist this
  one: 
  
  Doesn't affect the answer, but this occurrence of 'effect' should
  be 'affect'. ;) 
  
  Cheers!
  
  Mike
 
 * Joining in on the fun *
 
 I'm afraid you spelled afraid incorrectly.  I'll be sending you the
 bill for my services related to this matter.

Please send it to Mr Murphy, who obviously insinuated one of his pet
gremlins into my keyboard for those few moments...! ;)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] PHP query to mysql database returns emtpy data, but Query Browser shows records

2005-01-07 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 07 January 2005 03:25, Jason Walker wrote:

 Graeme - you were moving in the right direction. Since the
 data in the field
 is varchar(250), the only thing that changes is the fact that the last
 number is 3 digits. Other page queries were also affected
 with 4 x 2 digit
 numbers in the category field (eg. '37 48 49 52').
 
 By adding '%' between each number and using 'LIKE' as opposed
 to '=', the
 queries through PHP return the correct value.
 
 I think is very strange as 3x numbers work fine when using
 spaces (' ')
 between each criteria (as in '37 48 53').
 
 The change would look something like:
 
 SELECT description from cpProducts where category like '39%47%48%172'

That's not a good idea, as it would also match entries like:

 391 247 48 172
 39 147 148 172
 395 347 1486 1172

etc.

I think you really need to find out exactly what's in those failing records,
and why it's not matching your query.

 

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



Re: [PHP-DB] select text from a text file

2005-01-07 Thread Jochem Maas
Ed wrote:
Hi,
Thanks for answering the question.
I'm going to make it write to a database rather than text file after
searching google and coming accross common problems with text files.
I've now just got to figure out how to mark the message as read in the
database so it does not re-appear next time the user clicks update.
TIMESTAMP? you can save in the session when a use last grabbed messages 
(clicked update) and only return newer messages (i.e. message have a 
'created' timestamp) then update the timestamp in the session. there is 
a window in which it is possible to have a request inserts a new message 
in between another request's selecting of all new messages and updating 
the session timestamp value (in such cases the person at the client end 
of the second request will never see the new message insert in the first 
request) - to handle that you have to implement some kind of locking 
mechanism.

good luck is all can say. (PHP implements a 'share nothing' architecture 
- not, perse, the easiest or most efficient type of system to build 
realtime multi-user environments in - AFAICT)

I'm going to build a function that will put the message in the correct table
using an if clause, is that the best method?
your the best judge of that - heh if it works that's the main thing - 
making it work fast that's something to look at later... and then there 
is the issue of writing code that neat, tidy, well commented and 
readable 6 months down the line.

Ed
- Original Message - 
From: Andrew Kreps [EMAIL PROTECTED]
To: Ed [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Thursday, January 06, 2005 6:55 PM
Subject: Re: [PHP-DB] select text from a text file


On Wed, 5 Jan 2005 11:58:59 -, Ed [EMAIL PROTECTED] wrote:
Happy new year folks!
The titlemight make this seem like an easy to answer question
However here's the complicated bit (well for me anyway).
In my text file that is written to by the users in a chatroom it looks
like this:
nickname||color||what the user is saying||user
how can i make it so that if they have a private message when they press
update it pulls the message from the text file and displays it in the frame
but also deletes the text?
You should be using a database for this, it makes things so much
easier.  That being said, here's one way to go about the text file
version:
Open the file, read through it line by line.
As you read it, push the lines into an array.
If you find a private message for the user, store that in a variable,
and do not push it into the array.
Finish reading the file.
If there's a private message, you've got it in a variable, and you can
overwrite the private message file with the array you've stored, which
is all of the current private messages minus the one you're about to
display.
Please note, this does not scale at all, especially in the fast-paced
world of chat rooms.  You will likely end up with file locking
problems if you proceed with the flat-file method.

Also, how can i make it so that if in a drop down menu they select the
word everybody it goes to a file called messages.txt and if they select
user or user2 or user3 from the list it writes to private.txt is this
at all possible? user and user2 etc arent hardcoded it's pulling the names
from a list of online users.
Are you talking about appending messages to a text file?  In that
case, you can have the dropdown submit with the message, and in the
PHP code have a case for 'everybody' where it writes to messages.txt,
and if it's not 'everybody', write it to private.txt with the username
that was selected from the dropdown as part of the row.
Does that answer your question?
--
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] select text from a text file

2005-01-07 Thread Ed
Hi,

The timestamp idea is an intresting idea and i'll give that method some
thought. I only want it to pull one private message at a time out of the
private message field so it might start getting very messy doing that
method - but it certainly does make it worth considering.

Ed
- Original Message - 
From: Jochem Maas [EMAIL PROTECTED]
To: Ed [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Friday, January 07, 2005 11:37 AM
Subject: Re: [PHP-DB] select text from a text file


 Ed wrote:
  Hi,
 
  Thanks for answering the question.
 
  I'm going to make it write to a database rather than text file after
  searching google and coming accross common problems with text files.
 
  I've now just got to figure out how to mark the message as read in the
  database so it does not re-appear next time the user clicks update.

 TIMESTAMP? you can save in the session when a use last grabbed messages
 (clicked update) and only return newer messages (i.e. message have a
 'created' timestamp) then update the timestamp in the session. there is
 a window in which it is possible to have a request inserts a new message
 in between another request's selecting of all new messages and updating
 the session timestamp value (in such cases the person at the client end
 of the second request will never see the new message insert in the first
 request) - to handle that you have to implement some kind of locking
 mechanism.

 good luck is all can say. (PHP implements a 'share nothing' architecture
 - not, perse, the easiest or most efficient type of system to build
 realtime multi-user environments in - AFAICT)

 
  I'm going to build a function that will put the message in the correct
table
  using an if clause, is that the best method?

 your the best judge of that - heh if it works that's the main thing -
 making it work fast that's something to look at later... and then there
 is the issue of writing code that neat, tidy, well commented and
 readable 6 months down the line.

 
  Ed
  - Original Message - 
  From: Andrew Kreps [EMAIL PROTECTED]
  To: Ed [EMAIL PROTECTED]; php-db@lists.php.net
  Sent: Thursday, January 06, 2005 6:55 PM
  Subject: Re: [PHP-DB] select text from a text file
 
 
 
 On Wed, 5 Jan 2005 11:58:59 -, Ed [EMAIL PROTECTED] wrote:
 
 Happy new year folks!
 
 The titlemight make this seem like an easy to answer question
 
 However here's the complicated bit (well for me anyway).
 
 In my text file that is written to by the users in a chatroom it looks
 
  like this:
 
 nickname||color||what the user is saying||user
 
 how can i make it so that if they have a private message when they
press
 
  update it pulls the message from the text file and displays it in the
frame
  but also deletes the text?
 
 You should be using a database for this, it makes things so much
 easier.  That being said, here's one way to go about the text file
 version:
 
 Open the file, read through it line by line.
 As you read it, push the lines into an array.
 If you find a private message for the user, store that in a variable,
 and do not push it into the array.
 Finish reading the file.
 If there's a private message, you've got it in a variable, and you can
 overwrite the private message file with the array you've stored, which
 is all of the current private messages minus the one you're about to
 display.
 
 Please note, this does not scale at all, especially in the fast-paced
 world of chat rooms.  You will likely end up with file locking
 problems if you proceed with the flat-file method.
 
 
 
 Also, how can i make it so that if in a drop down menu they select the
 
  word everybody it goes to a file called messages.txt and if they
select
  user or user2 or user3 from the list it writes to private.txt is
this
  at all possible? user and user2 etc arent hardcoded it's pulling the
names
  from a list of online users.
 
 Are you talking about appending messages to a text file?  In that
 case, you can have the dropdown submit with the message, and in the
 PHP code have a case for 'everybody' where it writes to messages.txt,
 and if it's not 'everybody', write it to private.txt with the username
 that was selected from the dropdown as part of the row.
 
 Does that answer your question?
 
 -- 
 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] select text from a text file

2005-01-07 Thread Jochem Maas
Ed wrote:
Hi,
The timestamp idea is an intresting idea and i'll give that method some
thought. I only want it to pull one private message at a time out of the
private message field so it might start getting very messy doing that
method - but it certainly does make it worth considering.
I see (I think) - the timestamp idea was aimed at a public general list 
of messages. in the case of private messages - they are always aimed at 
one particular user therefore in such a case a simple flag (true/false) 
to state whether its been viewed would probably work - or you could just 
delete the last grabbed message after you have selected it for output.

have fun!
Ed
- Original Message - 
From: Jochem Maas [EMAIL PROTECTED]
To: Ed [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Friday, January 07, 2005 11:37 AM
Subject: Re: [PHP-DB] select text from a text file


Ed wrote:
Hi,
Thanks for answering the question.
I'm going to make it write to a database rather than text file after
searching google and coming accross common problems with text files.
I've now just got to figure out how to mark the message as read in the
database so it does not re-appear next time the user clicks update.
TIMESTAMP? you can save in the session when a use last grabbed messages
(clicked update) and only return newer messages (i.e. message have a
'created' timestamp) then update the timestamp in the session. there is
a window in which it is possible to have a request inserts a new message
in between another request's selecting of all new messages and updating
the session timestamp value (in such cases the person at the client end
of the second request will never see the new message insert in the first
request) - to handle that you have to implement some kind of locking
mechanism.
good luck is all can say. (PHP implements a 'share nothing' architecture
- not, perse, the easiest or most efficient type of system to build
realtime multi-user environments in - AFAICT)

I'm going to build a function that will put the message in the correct
table
using an if clause, is that the best method?
your the best judge of that - heh if it works that's the main thing -
making it work fast that's something to look at later... and then there
is the issue of writing code that neat, tidy, well commented and
readable 6 months down the line.

Ed
- Original Message - 
From: Andrew Kreps [EMAIL PROTECTED]
To: Ed [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Thursday, January 06, 2005 6:55 PM
Subject: Re: [PHP-DB] select text from a text file



On Wed, 5 Jan 2005 11:58:59 -, Ed [EMAIL PROTECTED] wrote:

Happy new year folks!
The titlemight make this seem like an easy to answer question
However here's the complicated bit (well for me anyway).
In my text file that is written to by the users in a chatroom it looks
like this:

nickname||color||what the user is saying||user
how can i make it so that if they have a private message when they
press
update it pulls the message from the text file and displays it in the
frame
but also deletes the text?

You should be using a database for this, it makes things so much
easier.  That being said, here's one way to go about the text file
version:
Open the file, read through it line by line.
As you read it, push the lines into an array.
If you find a private message for the user, store that in a variable,
and do not push it into the array.
Finish reading the file.
If there's a private message, you've got it in a variable, and you can
overwrite the private message file with the array you've stored, which
is all of the current private messages minus the one you're about to
display.
Please note, this does not scale at all, especially in the fast-paced
world of chat rooms.  You will likely end up with file locking
problems if you proceed with the flat-file method.


Also, how can i make it so that if in a drop down menu they select the
word everybody it goes to a file called messages.txt and if they
select
user or user2 or user3 from the list it writes to private.txt is
this
at all possible? user and user2 etc arent hardcoded it's pulling the
names
from a list of online users.

Are you talking about appending messages to a text file?  In that
case, you can have the dropdown submit with the message, and in the
PHP code have a case for 'everybody' where it writes to messages.txt,
and if it's not 'everybody', write it to private.txt with the username
that was selected from the dropdown as part of the row.
Does that answer your question?
--
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] Fetch data from dbf file?

2005-01-07 Thread Jochem Maas
Supri anto wrote:
hi all,
did anyone know how to fetch data from dbf file (Clipper) ? 
use some code.
don't expect too much help if all you can be bothered to write are
single line questions.
I googled 'DBF + PHP' and came up with this:
http://half2.mirrors.phpclasses.org/browse/package/1302.html
now I'm pretty sure they have google in your country too, so why don't
you use it before coming onto a mailing list and expecting other people
to do your research for you?
best regards,
suprie
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] select text from a text file

2005-01-07 Thread Bastien Koert
simple, add  a 'read flag' column to the table, when the record is viewed, 
activate this flag (say 0 for unread and 1 for read) (Note: read is a mysql 
keyword don't use that for a column name) and then only show the ones unread

bastien
From: Ed [EMAIL PROTECTED]
To: Andrew Kreps [EMAIL PROTECTED]
CC: php-db@lists.php.net
Subject: Re: [PHP-DB] select text from a text file
Date: Fri, 7 Jan 2005 08:58:18 -
Hi,
Thanks for answering the question.
I'm going to make it write to a database rather than text file after
searching google and coming accross common problems with text files.
I've now just got to figure out how to mark the message as read in the
database so it does not re-appear next time the user clicks update.
I'm going to build a function that will put the message in the correct 
table
using an if clause, is that the best method?

Ed
- Original Message -
From: Andrew Kreps [EMAIL PROTECTED]
To: Ed [EMAIL PROTECTED]; php-db@lists.php.net
Sent: Thursday, January 06, 2005 6:55 PM
Subject: Re: [PHP-DB] select text from a text file
 On Wed, 5 Jan 2005 11:58:59 -, Ed [EMAIL PROTECTED] wrote:
  Happy new year folks!
 
  The titlemight make this seem like an easy to answer question
 
  However here's the complicated bit (well for me anyway).
 
  In my text file that is written to by the users in a chatroom it looks
like this:
 
  nickname||color||what the user is saying||user
 
  how can i make it so that if they have a private message when they 
press
update it pulls the message from the text file and displays it in the frame
but also deletes the text?
 

 You should be using a database for this, it makes things so much
 easier.  That being said, here's one way to go about the text file
 version:

 Open the file, read through it line by line.
 As you read it, push the lines into an array.
 If you find a private message for the user, store that in a variable,
 and do not push it into the array.
 Finish reading the file.
 If there's a private message, you've got it in a variable, and you can
 overwrite the private message file with the array you've stored, which
 is all of the current private messages minus the one you're about to
 display.

 Please note, this does not scale at all, especially in the fast-paced
 world of chat rooms.  You will likely end up with file locking
 problems if you proceed with the flat-file method.


  Also, how can i make it so that if in a drop down menu they select the
word everybody it goes to a file called messages.txt and if they select
user or user2 or user3 from the list it writes to private.txt is this
at all possible? user and user2 etc arent hardcoded it's pulling the names
from a list of online users.
 

 Are you talking about appending messages to a text file?  In that
 case, you can have the dropdown submit with the message, and in the
 PHP code have a case for 'everybody' where it writes to messages.txt,
 and if it's not 'everybody', write it to private.txt with the username
 that was selected from the dropdown as part of the row.

 Does that answer your question?

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



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


RE: [PHP-DB] I'm trying to out perform Martin Norland....

2005-01-07 Thread Norland, Martin
 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, January 06, 2005 3:26 PM
 Subject: [PHP-DB] I'm trying to out perform Martin Norland

 in terms of helpfulness and volume of replies to Q's on this list 
 ;-)  but it doesn't help that my mails seem to take hours to reach the

 list (Martin's keep beating mine to show up).
 
 is the list-server against me? or do others also see loads of lag?
 
Luck of the draw.  I've sent mails that immediately posted to the list,
and I've sent mails (like the recent MySQL PK) that took almost 4 hours.
No idea where the bottleneck is - maybe just that php.nets mailserver is
busy.

Backoff algorithms make a larger and larger [but still random] window
each failure - the idea being that if 4000 people sending mail
simultaneously get failures from overloading the server - everyone
calling back in exactly 10 minutes won't help anyone.  If we get a
collision when we call back, we figure we still have too many and we
backoff again.  So, if your mail has no problems the first time - it
gets through fine.  One failure, maybe a half hour.  Two, and you're
looking at the hours.

Semi Ooh Tee, but I can't say that on this list or it doesn't get
posted at all (which, as I've mentioned here before, is stupid).

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] select text from a text file

2005-01-07 Thread Ed
Hi,

I've been looking at ways todo this, and as yet haven't figured out howto
pull something from the database plus at the sametime update the record, can
someone tell me how this is done or where i could learn? i've looked all
over phpbuilder and a few other php forums but can't seem to find the
answer.

Ed
- Original Message - 
From: Bastien Koert [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Friday, January 07, 2005 2:06 PM
Subject: Re: [PHP-DB] select text from a text file


 simple, add  a 'read flag' column to the table, when the record is viewed,
 activate this flag (say 0 for unread and 1 for read) (Note: read is a
mysql
 keyword don't use that for a column name) and then only show the ones
unread

 bastien

 From: Ed [EMAIL PROTECTED]
 To: Andrew Kreps [EMAIL PROTECTED]
 CC: php-db@lists.php.net
 Subject: Re: [PHP-DB] select text from a text file
 Date: Fri, 7 Jan 2005 08:58:18 -
 
 Hi,
 
 Thanks for answering the question.
 
 I'm going to make it write to a database rather than text file after
 searching google and coming accross common problems with text files.
 
 I've now just got to figure out how to mark the message as read in the
 database so it does not re-appear next time the user clicks update.
 
 I'm going to build a function that will put the message in the correct
 table
 using an if clause, is that the best method?
 
 Ed
 - Original Message -
 From: Andrew Kreps [EMAIL PROTECTED]
 To: Ed [EMAIL PROTECTED]; php-db@lists.php.net
 Sent: Thursday, January 06, 2005 6:55 PM
 Subject: Re: [PHP-DB] select text from a text file
 
 
   On Wed, 5 Jan 2005 11:58:59 -, Ed [EMAIL PROTECTED] wrote:
Happy new year folks!
   
The titlemight make this seem like an easy to answer question
   
However here's the complicated bit (well for me anyway).
   
In my text file that is written to by the users in a chatroom it
looks
 like this:
   
nickname||color||what the user is saying||user
   
how can i make it so that if they have a private message when they
 press
 update it pulls the message from the text file and displays it in the
frame
 but also deletes the text?
   
  
   You should be using a database for this, it makes things so much
   easier.  That being said, here's one way to go about the text file
   version:
  
   Open the file, read through it line by line.
   As you read it, push the lines into an array.
   If you find a private message for the user, store that in a variable,
   and do not push it into the array.
   Finish reading the file.
   If there's a private message, you've got it in a variable, and you can
   overwrite the private message file with the array you've stored, which
   is all of the current private messages minus the one you're about to
   display.
  
   Please note, this does not scale at all, especially in the fast-paced
   world of chat rooms.  You will likely end up with file locking
   problems if you proceed with the flat-file method.
  
  
Also, how can i make it so that if in a drop down menu they select
the
 word everybody it goes to a file called messages.txt and if they select
 user or user2 or user3 from the list it writes to private.txt is
this
 at all possible? user and user2 etc arent hardcoded it's pulling the
names
 from a list of online users.
   
  
   Are you talking about appending messages to a text file?  In that
   case, you can have the dropdown submit with the message, and in the
   PHP code have a case for 'everybody' where it writes to messages.txt,
   and if it's not 'everybody', write it to private.txt with the username
   that was selected from the dropdown as part of the row.
  
   Does that answer your question?
  
   --
   PHP Database Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 




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



Re: [PHP-DB] SQL statement

2005-01-07 Thread graeme
Hi,
To stop the return receipt dialog appearing in Tbird...
Tools... Options... Advanced... Return Receipt and select Never send a 
return receipt. Or you can choose some of the other selections.

graeme
Jochem Maas wrote:
Jason,
can you please turn off the return receipts on emails you send to the 
list.

it's bloody annoying to have 'The Sender wishes to be notified' 
popup messages everytime I read one of your emails (and, alas, I don't 
have the skill to hack the return receipt crap right out of Tbird). 
BTW your not the only one that has it turned on - so this goes to the 
rest of you as well

:-)
cheers!

Jason Walker wrote:
First off - $_POST['CompanyName'] is valid, right?
...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php