RE: [PHP-DB] Access counter

2001-07-23 Thread Walter, Marcel

Another idea of mine:
You could start sessions  and register a variable...
and everytime a new user wants to request a page you can find 
out whether its a new user or not if you check the variable ...

If it is new, then do the stuff below ... elso don´t ...

Cheers, 
Marcel

> -Original Message-
> From: leo g. divinagracia iii [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, July 24, 2001 06:25
> Cc:   PHP-DB
> Subject:  Re: [PHP-DB] Access counter
> 
> in a simple way, yes.
> 
> if you really want unique users, you can setup a table and insert the IP
> addresses in their and query it everytime.
> 
> the PHP variable that keeps track of the user'a IP address can also be
> checked by storing it in a variable and re-checked each time the page is
> loaded.
> 
> Shahmat Dahlan wrote:
> > 
> > If I do the below, like you stated, that means the counter will update
> > everytime a visitor refreshes the content.
> > 
> > Would it be possible for the counter script not to increase the value by
> 1
> > when a visitor merely refreshes. Is it possible to let the script
> increase the
> > value by only by one, only if the the visitor for a new content (by
> clearing
> > the cache, e.g.).
> > 
> > Thanks you replying..
> > 
> > "leo g. divinagracia iii" wrote:
> > 
> > > in pseudo-code:
> > >
> > > make a text file - associate it a URL
> > >
> > > when a user comes along, have a PHP script on top of the web page to
> > >
> > > 1. open the text file
> > > 2. counter = counter +1
> > > 3. write update
> > > 3.5 print number of hits somewhere on webpage
> > > 4. close file...
> > >
> > > Shahmat Dahlan wrote:
> > > >
> > > > I'd like to do a counter with PHP, how do you do this? I thought
> maybe I
> > > > could either use cookie or session or session? Which should I use ?
> > > >
> 
> 
> -- 
> Leo G. Divinagracia III
> [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]


If you have received this e-mail in error or wish to read our e-mail disclaimer 
statement and monitoring policy, please refer to
http://www.drkw.com/disc/email/ or contact the sender.

--
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] Counting Number of Instances in a One2Many Relationships

2001-07-23 Thread Mike Gifford

Hi Paul (both of you),

Thanks for your suggestions:

Paul DuBois wrote:
SELECT publisherID, COUNT(*) FROM WLPpublisher GROUP BY publisherID

Paul Burney wrote:
SELECT COUNT(bibID) FROM bookDB WHERE publisherID='$your_publisher_id';

And the final code that did the trick was actually a combination of the two:
SELECT publisherID,COUNT(bibID) AS bibCount FROM WLPbib GROUP BY publisherID

Thank you both for your suggestions.  Not sure that either one would have 
allowed me to get the results I wanted.

Mike

Paul DuBois wrote:

>> Hello All,
>>
>> I'd like a simple query to determine how MANY books in a database are 
>> released by A publisher.  This shouldn't be a big deal, but I've 
>> looked at a number of solutions and am coming up short.  MySQL is 
>> being accessed via phplib, but I'm sure that it's just how I'm 
>> expressing the general MySQL query.
>>
>> The bookID & publisherID are both listed in the bookDB.  I just want a 
>> query which will go through the database and return the publisherID 
>> and a count of the number of books.
>>
>> I'd like to end up with an array that expresses $publisherID => Number 
>> of books so that I can tap this later...
> 
> 
> How about:
> 
> SELECT publisherID, COUNT(*) FROM WLPpublisher GROUP BY publisherID
> 
>>
>> I first tried to approach it by doing this which fell because of 
>> @@IDENTITY
>> $q2  = "SELECT publisherID FROM WLPpublisher";
>> $q2  = "SELECT @@IDENTITY AS publisherID FROM WLPpublisher";
>> echo $q2 . "";
>> $lastPublisherID = $this->db->query($q2);
>> $q3  = "SELECT bibID,publisherID FROM WLPbib WHERE publisherID='$i'";
>> echo $q3 . "";
>> for ($i=0; ($i < $lastPublisherID); $i++) {
>> $pub_count_ary[$i] = $this->db->num_rows($q3);
>> }
>>
>> I next tried to use a query like this, but couldn't figure out how to 
>> express the relationship between the two:
>> $q2  = "SELECT bibID,publisherID,COUNT(*)
>> FROM WLPbib
>> GROUP BY publisherID";
>> $this->db->query($q2);
>> while ($this->db->next_record()) {
>> $pub_count_ary[$i] = $this->db->Record[publisherID];
>> $i++;
>> }
>>
>> Finally, I tried this which didn't work either:
>> $q2  = "SELECT bibID,publisherID FROM WLPbib";
>> $this->db->query($q2);
>> $i = 0;
>> while ($this->db->next_record()) {
>> $pub_count_ary[$i] = $this->db->Record[publisherID];
>> $i++;
>> }
>>
>> The relevant table's here:
>>
>> CREATE TABLE WLPbib (
>> bibID mediumint(9) NOT NULL,
>> languageID varchar(5),
>> publisherID mediumint(9),
>> categoryID smallint(6),
>> type varchar(55),
>> title varchar(255),
>> pageNumber varchar(55),
>> source_bibID varchar(55),
>> publicationDate varchar(5),
>> dateAdded date,
>> publishedLanguage varchar(5),
>> URL varchar(100),
>> status varchar(5),
>> PRIMARY KEY (bibID)
>> );
>>
>> Suggestions are appreciated!
>>
>> Mike
>>
>>
>> -- 
>> 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]
> 
> 
> 



-- 
Mike Gifford, OpenConcept Consulting, http://openconcept.ca
Offering everything your organization needs for an effective web site.
Abolish Nuclear Weapons Now!: http://pgs.ca/petition/
It is a miracle that curiosity survives formal education. - A Einstein


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

2001-07-23 Thread leo g. divinagracia iii

in a simple way, yes.

if you really want unique users, you can setup a table and insert the IP
addresses in their and query it everytime.

the PHP variable that keeps track of the user'a IP address can also be
checked by storing it in a variable and re-checked each time the page is
loaded.

Shahmat Dahlan wrote:
> 
> If I do the below, like you stated, that means the counter will update
> everytime a visitor refreshes the content.
> 
> Would it be possible for the counter script not to increase the value by 1
> when a visitor merely refreshes. Is it possible to let the script increase the
> value by only by one, only if the the visitor for a new content (by clearing
> the cache, e.g.).
> 
> Thanks you replying..
> 
> "leo g. divinagracia iii" wrote:
> 
> > in pseudo-code:
> >
> > make a text file - associate it a URL
> >
> > when a user comes along, have a PHP script on top of the web page to
> >
> > 1. open the text file
> > 2. counter = counter +1
> > 3. write update
> > 3.5 print number of hits somewhere on webpage
> > 4. close file...
> >
> > Shahmat Dahlan wrote:
> > >
> > > I'd like to do a counter with PHP, how do you do this? I thought maybe I
> > > could either use cookie or session or session? Which should I use ?
> > >


-- 
Leo G. Divinagracia III
[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] config php w/ mysql

2001-07-23 Thread Beau Lebens

also, make sure you have selected a db to work on onece connected to the
mysql server

mysql_select_db or something like that

beau

// -Original Message-
// From: leo g. divinagracia iii [mailto:[EMAIL PROTECTED]]
// Sent: Tuesday, 24 July 2001 12:21 PM
// Cc: [EMAIL PROTECTED]
// Subject: Re: [PHP-DB] config php w/ mysql
// 
// 
// 
// 
// Darrell wrote:
// > 
// > I got mysql installed on my win2000 machine, and have 
// apache running with
// > php 4 all working correctly.
// > 
// > but I can't get php to work with the db...
// > 
// > I'm pretty sure I can connect with mysql_connect(...) 
// because it doesn't die
// > at that spot.  rather, when I try to do the 
// mysql_query(...) it dies each
// > time.
// > 
// > how do I have to configure mysql or php to get them to communicate
// > correctly?  I know my query is correct because I can run 
// it in mySQLGUI just
// > fine...
// > 
// 
// die... do you mean mean the result of mysql_query(...) is FALSE?
// 
// check that result first?  maybe the queries are returning no data or
// something...  i mean if you can connect, then PHP and MySQL 
// are working
// together just fine...
// 
// i'd check the data first...
// 
// -- 
// Leo G. Divinagracia III
// [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 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] config php w/ mysql

2001-07-23 Thread leo g. divinagracia iii



Darrell wrote:
> 
> I got mysql installed on my win2000 machine, and have apache running with
> php 4 all working correctly.
> 
> but I can't get php to work with the db...
> 
> I'm pretty sure I can connect with mysql_connect(...) because it doesn't die
> at that spot.  rather, when I try to do the mysql_query(...) it dies each
> time.
> 
> how do I have to configure mysql or php to get them to communicate
> correctly?  I know my query is correct because I can run it in mySQLGUI just
> fine...
> 

die... do you mean mean the result of mysql_query(...) is FALSE?

check that result first?  maybe the queries are returning no data or
something...  i mean if you can connect, then PHP and MySQL are working
together just fine...

i'd check the data first...

-- 
Leo G. Divinagracia III
[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] Counting Number of Instances in a One2ManyRelationships

2001-07-23 Thread Paul Burney

on 7/23/01 6:53 PM, Mike Gifford at [EMAIL PROTECTED] wrote:

> I'd like a simple query to determine how MANY books in a database are released
> by A publisher.  This shouldn't be a big deal, but I've looked at a number of
> solutions and am coming up short.  MySQL is being accessed via phplib, but I'm
> sure that it's just how I'm expressing the general MySQL query.

Maybe I'm not quite getting it, but how about:

SELECT COUNT(bibID) FROM bookDB WHERE publisherID='$your_publisher_id';

> The bookID & publisherID are both listed in the bookDB.  I just want a query
> which will go through the database and return the publisherID and a count of
> the number of books.

You can do a group by to get them all at once:

SELECT COUNT(*) AS book_count, publisherID FROM bookDB GROUP BY publisherID;

Then use your favorite mysql_fetch_*** and access them.

Hope that helps.

Sincerely,

Paul Burney

++
Paul Burney
Webmaster && Open Source Developer
UCLA -> GSE&IS -> ETU
(310) 825-8365
<[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] Access counter

2001-07-23 Thread Shahmat Dahlan

If I do the below, like you stated, that means the counter will update
everytime a visitor refreshes the content.

Would it be possible for the counter script not to increase the value by 1
when a visitor merely refreshes. Is it possible to let the script increase the
value by only by one, only if the the visitor for a new content (by clearing
the cache, e.g.).

Thanks you replying..


"leo g. divinagracia iii" wrote:

> in pseudo-code:
>
> make a text file - associate it a URL
>
> when a user comes along, have a PHP script on top of the web page to
>
> 1. open the text file
> 2. counter = counter +1
> 3. write update
> 3.5 print number of hits somewhere on webpage
> 4. close file...
>
> Shahmat Dahlan wrote:
> >
> > I'd like to do a counter with PHP, how do you do this? I thought maybe I
> > could either use cookie or session or session? Which should I use ?
> >
> > regards and thanks is adnved
> >
> > --
> > 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]
>
> --
> Leo G. Divinagracia III
> [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 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] Counting Number of Instances in a One2Many Relationships

2001-07-23 Thread Mike Gifford

Hello All,

I'd like a simple query to determine how MANY books in a database are released 
by A publisher.  This shouldn't be a big deal, but I've looked at a number of 
solutions and am coming up short.  MySQL is being accessed via phplib, but I'm 
sure that it's just how I'm expressing the general MySQL query.

The bookID & publisherID are both listed in the bookDB.  I just want a query 
which will go through the database and return the publisherID and a count of the 
number of books.

I'd like to end up with an array that expresses $publisherID => Number of books 
so that I can tap this later...

I first tried to approach it by doing this which fell because of @@IDENTITY
$q2  = "SELECT publisherID FROM WLPpublisher";
$q2  = "SELECT @@IDENTITY AS publisherID FROM WLPpublisher";
echo $q2 . "";
$lastPublisherID = $this->db->query($q2);
$q3  = "SELECT bibID,publisherID FROM WLPbib WHERE publisherID='$i'";
echo $q3 . "";
for ($i=0; ($i < $lastPublisherID); $i++) {
$pub_count_ary[$i] = $this->db->num_rows($q3);
}

I next tried to use a query like this, but couldn't figure out how to express 
the relationship between the two:
$q2  = "SELECT bibID,publisherID,COUNT(*)
FROM WLPbib
GROUP BY publisherID";
$this->db->query($q2);
while ($this->db->next_record()) {
$pub_count_ary[$i] = $this->db->Record[publisherID];
$i++;
}

Finally, I tried this which didn't work either:
$q2  = "SELECT bibID,publisherID FROM WLPbib";
$this->db->query($q2);
$i = 0;
while ($this->db->next_record()) {
$pub_count_ary[$i] = $this->db->Record[publisherID];
$i++;
}

The relevant table's here:

CREATE TABLE WLPbib (
bibID mediumint(9) NOT NULL,
languageID varchar(5),
publisherID mediumint(9),
categoryID smallint(6),
type varchar(55),
title varchar(255),
pageNumber varchar(55),
source_bibID varchar(55),
publicationDate varchar(5),
dateAdded date,
publishedLanguage varchar(5),
URL varchar(100),
status varchar(5),
PRIMARY KEY (bibID)
);

Suggestions are appreciated!

Mike


-- 
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] case-insensitive select?

2001-07-23 Thread eon


i use ...

SELECT *, UPPER(name) AS testfield FROM testtable ORDER BY testfield

hope it helps.




-- 
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] cancel <20010723135436.90722.qmail@pb1.pair.com>

2001-07-23 Thread Mikusch, Rita

Those emails he's sending might be caused by a virus. I've received about 30
weird emails over the last couple days all from the same person. So have a
few other people in our office. Fortunately our server's been deleting the
virus attachments. 

It was the "W32/SirCam@MM" virus. I don't know anything about it. If you
suddenly find yourself sending lots and lots of weird emails . . . you might
want to check that out at symantec or mcafee :)

Rita.

-Original Message-
From: Tom Hodder [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 23, 2001 10:13 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] cancel <[EMAIL PROTECTED]>


What was all that about~??

-Original Message-
From: Christian St-Pierre [mailto:[EMAIL PROTECTED]]
Sent: 23 July 2001 16:02
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: [PHP-DB] cancel <[EMAIL PROTECTED]>


This message was cancelled from within Mozilla.

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

2001-07-23 Thread leo g. divinagracia iii

in pseudo-code:

make a text file - associate it a URL

when a user comes along, have a PHP script on top of the web page to 

1. open the text file
2. counter = counter +1
3. write update
3.5 print number of hits somewhere on webpage
4. close file...


Shahmat Dahlan wrote:
> 
> I'd like to do a counter with PHP, how do you do this? I thought maybe I
> could either use cookie or session or session? Which should I use ?
> 
> regards and thanks is adnved
> 
> --
> 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]

-- 
Leo G. Divinagracia III
[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] line breaks in mySQL text fields

2001-07-23 Thread kmurrah

How do I add new line characters to a text field in mySQL ?

i.e. i need to manually insert "returns" into my text ...

thanks in advance,

KennM

-- 
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] PHP x Progress

2001-07-23 Thread Mark Newnham

Yes, ODBC - If you are using unix, i recommend the openlink MT drivers
(www.openlinksw.com) There is no native mode interface available for
PROGRESS.

> -Original Message-
> From: André [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 23, 2001 11:42 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] PHP x Progress
> 
> 
> How I can access a Progress database? ODBC?
> 
> 
> 
> -- 
> 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] PHP x Progress

2001-07-23 Thread André

How I can access a Progress database? ODBC?



-- 
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] cancel <20010723135436.90722.qmail@pb1.pair.com>

2001-07-23 Thread Tom Hodder

What was all that about~??

-Original Message-
From: Christian St-Pierre [mailto:[EMAIL PROTECTED]]
Sent: 23 July 2001 16:02
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: [PHP-DB] cancel <[EMAIL PROTECTED]>


This message was cancelled from within Mozilla.

-- 
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_[p]connect() and mysql_error()/mysql_errno()

2001-07-23 Thread Paul DuBois

I see in the PHP 4.0.6 release notes that mysql_error() and mysql_errno()
have been fixed so that you can get error information from them when
a connect call fails. (Previously they worked only after successfully
establishing a connection, so that you had to use $php_errormsg with
track_errors turned on to get connection error information.)

I want to write connection code that takes advantage of this, so that
it uses the MySQL error functions if they're the fixed versions, and
falls back to $php_errormsg otherwise.  Does the following look reasonable?

if (!($conn_id = @mysql_connect ($host, $user, $password)))
{
 # If mysql_errno()/mysql_error() work for failed connections, use
 # them (invoke with no arguments). Otherwise, use $php_errormsg.
 if (mysql_errno ())
 {
 die (sprintf ("Cannot connect to database server: %s (%d)\n",
 htmlspecialchars (mysql_error ()),
 mysql_errno ()));
 }
 else
 {
 die ("Cannot connect to database server: "
 . htmlspecialchars ($php_errormsg) . "\n");
 }
}


I'm assuming that the proper way to invoke mysql_error()/mysql_errno()
after a failed connection is with *no* argument, because when a failure
occurs $conn_id won't have any reasonable value and shouldn't be passed
to those functions.

-- 
Paul DuBois, [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] Re: retrieving special characters from MySQL

2001-07-23 Thread Andrew

THX to everyone for the help!!!


"Steve Brett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> pull it out then use stripslashes() as you display it ...
>
> Steve
>
> "Andrew" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi, I'm having trouble getting special characters out of MySQL using php
> > 4.06.
> >
> > I add a field like "McDonald's" from PHP and in mysql client I can see
the
> > entry (McDonald's) is put into the database correctly. However the
problem
> > arises when I query it and it prints out (McDonald\'s). Is there any way
> for
> > php to pull out the string as it is in the database without putting in
the
> > escape character ( \ )  
> >
> > thx
> >
> >
>
>



-- 
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] Re: retrieving special characters from MySQL

2001-07-23 Thread Steve Brett

pull it out then use stripslashes() as you display it ...

Steve

"Andrew" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi, I'm having trouble getting special characters out of MySQL using php
> 4.06.
>
> I add a field like "McDonald's" from PHP and in mysql client I can see the
> entry (McDonald's) is put into the database correctly. However the problem
> arises when I query it and it prints out (McDonald\'s). Is there any way
for
> php to pull out the string as it is in the database without putting in the
> escape character ( \ )  
>
> thx
>
>



-- 
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 special characters from MySQL

2001-07-23 Thread Andrew

Hi, I'm having trouble getting special characters out of MySQL using php
4.06.

I add a field like "McDonald's" from PHP and in mysql client I can see the
entry (McDonald's) is put into the database correctly. However the problem
arises when I query it and it prints out (McDonald\'s). Is there any way for
php to pull out the string as it is in the database without putting in the
escape character ( \ )  

thx



-- 
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] HTML tags destory formatting?

2001-07-23 Thread Geoffrey Makstutis

Thanks for the response, but that is exaclty what I am doing. Here's an example:

I input the following into a varchar field:

 This is the first line of text.

 This is the second line of text.

 This is some text with a link

 This is the next line.

 This is the last line.

On inserting into the database I tell it to do a nl2br() prior to the insert.

The output from a print() statement is:

 This is the first line of text.

 This is the second line of text.

 This is some text with a link
 This is the next line.
 This is the last line.

You see that the formatting is lost after the  tag.

Any suggestions?

Geoffrey

[EMAIL PROTECTED] wrote:
>
>There are two cases possible:
>1. Store already HTML-formatted text in db. Then you do nothing
>   before sending it to the screen; never use nl2br() here!
>2. Store plain text, may be with a simpliest tags like b, i, u,
>   ol, ul, li, a, img. Then put it through the nl2br() function
>   before outputting to browser.
>   It's easy for the editor that will update news on the site. So she
>   can, for example, copy text from Word document into the form's
>in natural paragraphs, & in browser it will look the
>   same, without need to insert  or  for paragraph formatting.
>Just select which one is more suitable for u.
>Monday, July 23, 2001, 2:37:15 PM, Geoffrey Makstutis <[EMAIL PROTECTED]> wrote:
>GM> Hi,
>GM> I'm getting a problem when I pull text from a mySQL database. The text is froma
>GM> varchar field and contains some HTML tags. New lines are translated to , 
but
>GM> when the field is outputted, anything coming after an HTML tag loses its 
formatting
>GM> (ie. no line breaks converted to ).
>GM> Can anyone suggest a solution?
>--
>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]

-
Geoffrey Makstutis
<[EMAIL PROTECTED]>

51% Studios
   Architecture + Design
   1-5 Clerkenwell Road
   London EC1M 5PA

   www.51pct.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] HTML tags destory formatting?

2001-07-23 Thread Sandis Jerics

There are two cases possible:

1. Store already HTML-formatted text in db. Then you do nothing
   before sending it to the screen; never use nl2br() here!

2. Store plain text, may be with a simpliest tags like b, i, u,
   ol, ul, li, a, img. Then put it through the nl2br() function
   before outputting to browser.
   It's easy for the editor that will update news on the site. So she
   can, for example, copy text from Word document into the form's
in natural paragraphs, & in browser it will look the
   same, without need to insert  or  for paragraph formatting.

Just select which one is more suitable for u.

Monday, July 23, 2001, 2:37:15 PM, Geoffrey Makstutis <[EMAIL PROTECTED]> wrote:

GM> Hi,

GM> I'm getting a problem when I pull text from a mySQL database. The text is froma 
GM> varchar field and contains some HTML tags. New lines are translated to , but 
GM> when the field is outputted, anything coming after an HTML tag loses its 
formatting 
GM> (ie. no line breaks converted to ).

GM> Can anyone suggest a solution?


-- 
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] HTML tags destory formatting?

2001-07-23 Thread Geoffrey Makstutis

Hi,

I'm getting a problem when I pull text from a mySQL database. The text is froma 
varchar field and contains some HTML tags. New lines are translated to , but 
when the field is outputted, anything coming after an HTML tag loses its formatting 
(ie. no line breaks converted to ).

Can anyone suggest a solution?

Geoffrey
-
Geoffrey Makstutis
<[EMAIL PROTECTED]>

51% Studios
   Architecture + Design
   1-5 Clerkenwell Road
   London EC1M 5PA

   www.51pct.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] Problem with BDB ,can anybody help me!!!

2001-07-23 Thread marcos

I have a Linux Server, with Apache 1.3.19 + PHP 4.0.6 and MySQL 3.23.37, and
i have a trouble with Transactions in PHP code:

When i write a transaction, and some error (PHP lang error) occurs, the
transaction are autocommited, and only part of the querys are made, with the
inconsistence of data, that this make, here a example of my problem:

.
.
.
// Start transaction
$q = "BEGIN WORK"
$db->query($q);
if( $db->errno) {
echo "Can't start transaction.";
return;
}

$q = "UPDATE ";
$db->query($q);
if( $db->errno) {
echo "Error.";
$db->query( "ROLLBACK");
return;
}

$q = "DELETE ";
$db->query($q);
if( $db->errno) {
echo "Error.";
$db->query( "ROLLBACK");
return;
}

// Here a error halts the code
exit; // halt by hand

// Some other querys
$q = "DELETE ";
$db->query($q);
if( $db->errno) {
echo "Error.";
$db->query( "ROLLBACK");
return;
}

$db->query("COMMIT");

In this example the $db->query("COMMIT"); command are never executed, and
the 2 first querys are executed, and the last and never executed.

How i can solve this??
Can anybody help me!!

-- 
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] who's logged on / how to I find out about other sessions

2001-07-23 Thread Tom Carter


Hi Christian,

What most sites do is to keep track of the latest time that a user requested
a page (ie when a page is requested store the current time).

Then a definitiion of "logged-in" is made usually this is "has requested
a page in the last 30 minutes" so the query to count the users whose time of
last access was within 30 mins of now.

Hope this makes sense,

Tom

> Hi,
>
> I'm writing a bbs/messageboard system and am trying to figure out how to
tell
> what other users are logged on.
>
> I know I could store the info in a table in my login code but then how do
I
> find out if people are logged out
> with out making them actually use a logout button or the like.
>
> I was going to do it that way but I have noticed that phpnuke sites can
list
> the number of logged in sites etc;
> but their code is a little beyond me atm
>
> Is there a way to list other session vars ?
>
> any ideas welcome
>
> with thanks
>
> Christian
>
>
> Christian Cable
> ICT Assistant
> Careers Service; Lancaster University
> Tel: (01524) 594072  Fax: (01524) 592072
> http://www.lancs.ac.uk/staff/cable/
>
>
>
> --
> 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] INTERBASE & PHP

2001-07-23 Thread Enrico Comini

With Interbase functions I have to make 2 select.
"SELECT count(*).. to count valid record
and 
"SELECT * .. to extract the records

There is a simple solutions to have unique Select ?
I use Pgsql too but here I Have the pg_numrows variable.





-- 
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] Re: PHP, Apache & PostgreSQL

2001-07-23 Thread Steve Brett

php is not compiled with postgresql support.

Steve

"Sean McCoy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> When I execute a pg_connect() in a .php file, I get an error indicating
that
> the function is not defined...
>
> That's because, in the Apache error log I'm getting the following:
>
> PHP Warning:  Unable to load dynamic library '/usr/lib/pgsql.so' -
> libpq.so.2.0: cannot open shared object file: No such file or directory in
> Unknown on line 0
>
> I have confirmed that my pgsql.so and libpq.so.* files are in my directory
> specified in the php.ini file. And that the exention for pgsql.so exists
in
> the php.ini also.
>
> Would anyone know what I missed here?
> Thanks,
> Sean McCoy
> [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] Match () Against () with mysql & php..

2001-07-23 Thread Koutsogiannopoulos Karolos

Hello again everyone...

I am doing some research for a project of mine and i was wondering if
someone is familliar with the match () against ()  function of mysql?
I know it returns a number etc 1.4343434 like a similarity number but how
can i convert this string to percentage like all the big search engines??

Regards.

___
PGP KEY ID: 0xA86600E9
___




[PHP-DB] Access counter

2001-07-23 Thread Shahmat Dahlan

I'd like to do a counter with PHP, how do you do this? I thought maybe I
could either use cookie or session or session? Which should I use ?

regards and thanks is adnved


-- 
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] who's logged on / how to I find out about other sessions

2001-07-23 Thread Cable, Christian

Hi,

I'm writing a bbs/messageboard system and am trying to figure out how to tell
what other users are logged on.

I know I could store the info in a table in my login code but then how do I
find out if people are logged out 
with out making them actually use a logout button or the like.

I was going to do it that way but I have noticed that phpnuke sites can list
the number of logged in sites etc;
but their code is a little beyond me atm

Is there a way to list other session vars ?

any ideas welcome

with thanks

Christian


Christian Cable
ICT Assistant
Careers Service; Lancaster University
Tel: (01524) 594072  Fax: (01524) 592072
http://www.lancs.ac.uk/staff/cable/



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