Re: [PHP-DB] counting multiple columns based on different values

2002-02-13 Thread Jason Cox

I see what you mean.  The following query will return a result set where the
clientID is returned twice, once of each status, with the number of times
each status appears.  You would have to run through your result array and
match the clientID and the status your looking for to get the count.

SELECT client.clientID,result.status,count(*) FROM client LEFT JOIN rating
ON (rating.clientID = client.clientID) WHERE rating.status=2 OR r1.status-3
GROUP BY clientID,status;

I think this is the only real way to combine those queries in mysql.  If
mysql fully supported sub-selects then there would be a better way but it
doesn't.

Jason Cox

- Original Message -
From: "John Hawkins" <[EMAIL PROTECTED]>
To: "Jason Cox" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 9:08 PM
Subject: Re: [PHP-DB] counting multiple columns based on different values


> Oops. I spoke too soon.
>
> This didn't quite get it. My results came back with
> column 3 and 4 having the exact same number in them
> for each record rather than column 3 having the count
> of status 3's and column 4 having a count of the
> status 4's.
>
> I've tried messing with the left join syntax trying to
> make it happen, but, I'll be honest with you, I've
> never used a left join before.
>
> Thanks again for your help.
>
> John
>
>
>
> --- Jason Cox <[EMAIL PROTECTED]> wrote:
> > Perhaps the world is just a little more perfect
> > today...
> >
> > Try this:
> >
> > SELECT
> >
>
clients.clientname,clients.ID,count(ratings2.clientID),count(ratings2.client
> > ID) from clients LEFT JOIN ratings as ratings2 on
> > (clients.ID =
> > ratings2.clientID) LEFT JOIN ratings as ratings3 on
> > (clients.ID =
> > ratings3.clientID) WHERE ratings2.status = '2' AND
> > ratings3.status = '3'
> > GROUP BY clients.clientname;
> >
> > That should do the trick.  Enjoy!!
> >
> > Jason Cox
> >
> > - Original Message -
> > From: "John Hawkins" <[EMAIL PROTECTED]>
> > To: "php-db list" <[EMAIL PROTECTED]>
> > Sent: Wednesday, February 13, 2002 7:11 PM
> > Subject: [PHP-DB] counting multiple columns based on
> > different values
> >
> >
> > > I'm gonna go out on a limb and guess that I'm
> > missing
> > > something obvious (and easy) because this sure
> > seems
> > > like it should be able to be done.
> > >
> > > Here's the issue: I need to pull the client name
> > and
> > > ID out of one table and then, count the records in
> > a
> > > different table (called ratings) that match two
> > > different criteria.
> > >
> > > If I was doing 2 different sql statments, they
> > would
> > > look like this:
> > >
> > > select clientname, clients.ID, count(*) FROM
> > clients,
> > > ratings WHERE clients.ID = ratings.clientID AND
> > > ratings.status = '2'
> > > select clientname, clients.ID, count(*) FROM
> > clients,
> > > ratings WHERE clients.ID = ratings.clientID AND
> > > ratings.status = '3'
> > >
> > > In a perfect world, I'd be able to receive the
> > > following data from a single query:
> > >
> > >
> > > | ClientName | ClientID | Status-2 | Status-3|
> > > | Bob| 28   | 103  | 87  |
> > > | Steve  | 29   | 11   | 106 |
> > > | Jerry  | 30   | 50   | 82  |
> > >
> > > I sure hope I explained that well enough.
> > >
> > > Thanks!
> > >
> > > John
> > >
> > > __
> > > Do You Yahoo!?
> > > Send FREE Valentine eCards with Yahoo! Greetings!
> > > http://greetings.yahoo.com
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit:
> > http://www.php.net/unsub.php
> > >
> > >
> > >
> >
>
>
> __
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


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




Re: [PHP-DB] counting multiple columns based on different values

2002-02-13 Thread John Hawkins

Oops. I spoke too soon.

This didn't quite get it. My results came back with
column 3 and 4 having the exact same number in them
for each record rather than column 3 having the count
of status 3's and column 4 having a count of the
status 4's.

I've tried messing with the left join syntax trying to
make it happen, but, I'll be honest with you, I've
never used a left join before.

Thanks again for your help.

John



--- Jason Cox <[EMAIL PROTECTED]> wrote:
> Perhaps the world is just a little more perfect
> today...
> 
> Try this:
> 
> SELECT
>
clients.clientname,clients.ID,count(ratings2.clientID),count(ratings2.client
> ID) from clients LEFT JOIN ratings as ratings2 on
> (clients.ID =
> ratings2.clientID) LEFT JOIN ratings as ratings3 on
> (clients.ID =
> ratings3.clientID) WHERE ratings2.status = '2' AND
> ratings3.status = '3'
> GROUP BY clients.clientname;
> 
> That should do the trick.  Enjoy!!
> 
> Jason Cox
> 
> - Original Message -
> From: "John Hawkins" <[EMAIL PROTECTED]>
> To: "php-db list" <[EMAIL PROTECTED]>
> Sent: Wednesday, February 13, 2002 7:11 PM
> Subject: [PHP-DB] counting multiple columns based on
> different values
> 
> 
> > I'm gonna go out on a limb and guess that I'm
> missing
> > something obvious (and easy) because this sure
> seems
> > like it should be able to be done.
> >
> > Here's the issue: I need to pull the client name
> and
> > ID out of one table and then, count the records in
> a
> > different table (called ratings) that match two
> > different criteria.
> >
> > If I was doing 2 different sql statments, they
> would
> > look like this:
> >
> > select clientname, clients.ID, count(*) FROM
> clients,
> > ratings WHERE clients.ID = ratings.clientID AND
> > ratings.status = '2'
> > select clientname, clients.ID, count(*) FROM
> clients,
> > ratings WHERE clients.ID = ratings.clientID AND
> > ratings.status = '3'
> >
> > In a perfect world, I'd be able to receive the
> > following data from a single query:
> >
> >
> > | ClientName | ClientID | Status-2 | Status-3|
> > | Bob| 28   | 103  | 87  |
> > | Steve  | 29   | 11   | 106 |
> > | Jerry  | 30   | 50   | 82  |
> >
> > I sure hope I explained that well enough.
> >
> > Thanks!
> >
> > John
> >
> > __
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> >
> >
> 


__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




Re: [PHP-DB] counting multiple columns based on different values

2002-02-13 Thread John Hawkins

All is right in the world! This worked like a charm!
Thank you So much!

John


--- Jason Cox <[EMAIL PROTECTED]> wrote:
> Perhaps the world is just a little more perfect
> today...
> 
> Try this:
> 
> SELECT
>
clients.clientname,clients.ID,count(ratings2.clientID),count(ratings2.client
> ID) from clients LEFT JOIN ratings as ratings2 on
> (clients.ID =
> ratings2.clientID) LEFT JOIN ratings as ratings3 on
> (clients.ID =
> ratings3.clientID) WHERE ratings2.status = '2' AND
> ratings3.status = '3'
> GROUP BY clients.clientname;
> 
> That should do the trick.  Enjoy!!
> 
> Jason Cox
> 
> - Original Message -
> From: "John Hawkins" <[EMAIL PROTECTED]>
> To: "php-db list" <[EMAIL PROTECTED]>
> Sent: Wednesday, February 13, 2002 7:11 PM
> Subject: [PHP-DB] counting multiple columns based on
> different values
> 
> 
> > I'm gonna go out on a limb and guess that I'm
> missing
> > something obvious (and easy) because this sure
> seems
> > like it should be able to be done.
> >
> > Here's the issue: I need to pull the client name
> and
> > ID out of one table and then, count the records in
> a
> > different table (called ratings) that match two
> > different criteria.
> >
> > If I was doing 2 different sql statments, they
> would
> > look like this:
> >
> > select clientname, clients.ID, count(*) FROM
> clients,
> > ratings WHERE clients.ID = ratings.clientID AND
> > ratings.status = '2'
> > select clientname, clients.ID, count(*) FROM
> clients,
> > ratings WHERE clients.ID = ratings.clientID AND
> > ratings.status = '3'
> >
> > In a perfect world, I'd be able to receive the
> > following data from a single query:
> >
> >
> > | ClientName | ClientID | Status-2 | Status-3|
> > | Bob| 28   | 103  | 87  |
> > | Steve  | 29   | 11   | 106 |
> > | Jerry  | 30   | 50   | 82  |
> >
> > I sure hope I explained that well enough.
> >
> > Thanks!
> >
> > John
> >
> > __
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> >
> >
> 


__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




[PHP-DB] Re: Problems with pg_FieldNum

2002-02-13 Thread Yasuo Ohgaki

Brady A. Johnson wrote:
> Greetings,
> 
> I am having trouble with the PostgreSQL pg_FieldNum() funciton.  When I 
> execute the following:
> 
>   $DB = pg_Connect ( "dbname=lists" );
>   $Recs = pg_Exec ( $DB, "SELECT 123 AS \"ABC\"" );
> 
>   $FieldName = pg_FieldName ( $Recs, 0 );
>   print ( "FieldName: $FieldName" );
> 
>   $FieldNum = pg_FieldNum ( $Recs, $FieldName );
>   print ( "FieldNum: $FieldNum" );
> 
> I get:
> 
>   FieldName: ABC
>   FieldNum: -1
> 
> It seems that no matter what I pass to pg_FieldNum(), I get -1 (error) in 
> return.
> 
> Anyone spot what I am doing wrong?
> 
> I am using PostgreSQL 7.0.2 and PHP 4.0.3 on RH Linux 7.0.
> 

I think you need to upgrade your PHP versoin.
I'm using 4.2.0-dev/PostgreSQL 7.1.3. I do not
have problem at all with following script.



-- 
Yasuo Ohgaki


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




[PHP-DB] RE: Logging visits using a database

2002-02-13 Thread Gurhan Ozen

Hi
I have never used it but sounds like analog would fit your needs pretty
well. Check them out at:
http://analog.sourceforge.net/

Hope this helps..

Gurhan


-Original Message-
From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 6:29 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Logging visits using a database


Hi

Excuse the cross post

I am thinking about building a logging tool to do visit analysis using SQL,
rather than doing log file analysis.

The aim is to analyse requests for dynamic pages called via php as well as
static pages. Static pages will use an include for logging. Php calls may
have two or three extra parameters which relate to products that are
displayed (this is for ecommerce) which I also want to log. I am looking
particularly at HTTP_REFERER, paths through the site, and most viewed
products.

Questions

1. Am I reinventing the wheel? and would it be better to buy a package
(Spending money brings me out in a nasty rash, and leaves me feeling a
little unsteady on my feet, but is sometimes the best option), or use a free
one. The intended audience is non technical managerial type bods so nothing
too difficult to understand :)

2. If I do use an existing package, are there any that are good with dynamic
sites and the parameters passed to scripts, rather than just logging static
pages?

3. Writing a database driven stats package on a medium traffic site (3-500
visits a day, Average 8-12 pages per visit=6000 inserts a day, peaking at
2-3 per second ) will mean lots of inserts, and a few reads when the
analysis is run. Running MySql on a 1.5GHz 512MB machine, is it better to
leave the table unindexed and put up with slow analysis, or will the machine
cope with indexes? The data could be aggregated periodically, but if
possible left intact for up to a year to follow trends.

4. Is a (MySql?) database driven system a good answer, or just the wrong way
to go??

Any thoughts and experience much appreciated before I commit to hours of
work and gallons of coffee

Thanx

Peter


---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
---


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


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




Re: [PHP-DB] counting multiple columns based on different values

2002-02-13 Thread Jason Cox

Perhaps the world is just a little more perfect today...

Try this:

SELECT
clients.clientname,clients.ID,count(ratings2.clientID),count(ratings2.client
ID) from clients LEFT JOIN ratings as ratings2 on (clients.ID =
ratings2.clientID) LEFT JOIN ratings as ratings3 on (clients.ID =
ratings3.clientID) WHERE ratings2.status = '2' AND ratings3.status = '3'
GROUP BY clients.clientname;

That should do the trick.  Enjoy!!

Jason Cox

- Original Message -
From: "John Hawkins" <[EMAIL PROTECTED]>
To: "php-db list" <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 7:11 PM
Subject: [PHP-DB] counting multiple columns based on different values


> I'm gonna go out on a limb and guess that I'm missing
> something obvious (and easy) because this sure seems
> like it should be able to be done.
>
> Here's the issue: I need to pull the client name and
> ID out of one table and then, count the records in a
> different table (called ratings) that match two
> different criteria.
>
> If I was doing 2 different sql statments, they would
> look like this:
>
> select clientname, clients.ID, count(*) FROM clients,
> ratings WHERE clients.ID = ratings.clientID AND
> ratings.status = '2'
> select clientname, clients.ID, count(*) FROM clients,
> ratings WHERE clients.ID = ratings.clientID AND
> ratings.status = '3'
>
> In a perfect world, I'd be able to receive the
> following data from a single query:
>
>
> | ClientName | ClientID | Status-2 | Status-3|
> | Bob| 28   | 103  | 87  |
> | Steve  | 29   | 11   | 106 |
> | Jerry  | 30   | 50   | 82  |
>
> I sure hope I explained that well enough.
>
> Thanks!
>
> John
>
> __
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>


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




[PHP-DB] counting multiple columns based on different values

2002-02-13 Thread John Hawkins

I'm gonna go out on a limb and guess that I'm missing
something obvious (and easy) because this sure seems
like it should be able to be done.

Here's the issue: I need to pull the client name and
ID out of one table and then, count the records in a
different table (called ratings) that match two
different criteria. 

If I was doing 2 different sql statments, they would
look like this:
 
select clientname, clients.ID, count(*) FROM clients,
ratings WHERE clients.ID = ratings.clientID AND
ratings.status = '2' 
select clientname, clients.ID, count(*) FROM clients,
ratings WHERE clients.ID = ratings.clientID AND
ratings.status = '3' 

In a perfect world, I'd be able to receive the
following data from a single query:


| ClientName | ClientID | Status-2 | Status-3|
| Bob| 28   | 103  | 87  |
| Steve  | 29   | 11   | 106 |
| Jerry  | 30   | 50   | 82  |

I sure hope I explained that well enough. 

Thanks!

John

__
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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




Re: [PHP-DB] Flipping through database records

2002-02-13 Thread Jason Cox

You would pass the array index between pages.  For instance, let's say I had
the following db schema:

table: user
username varchar(10)
fname varchar(10)
lname varchar(10)
dob data(14)
...ect

Now let's say that there are 10 records in the table.  Each time I visit the
page I would do something like the following:

$query = "SELECT * FROM user ORDER BY username;";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);
mysql_data_seek($result,$idx); //$idx is the Get var that is passed in
$row = mysql_fetch_array($result);
echo "username: ".$row["username"]." ect...";

if($idx > 0)
echo "prev";
if($idx < $num_rows-1)
 echo "next";

That should give you the general idea.  The array that you get from mysql on
every page will be about the same.  Since we're doing an 'order by' atleast
the rows will be in the same order every time.  The only thing you'll have
to worry about is if someone adds rows while your browsing.  Even then the
only thing that might happen is that you browse on a record that you've
already seen because one was inserted either before or after the one you
were just looking at.

Hope that clears it up a bit.  To answer a previous quesiton for another
post, no you wouldn't store the array in the session.  That wouldn't be a
good idea unless you want to expose your data to the world.

--jason
- Original Message -
From: "Dan Swensen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 12, 2002 11:40 PM
Subject: Re: [PHP-DB] Flipping through database records


> Actually, now that I think of it... how would you move from one record to
> the next, if not querying by userid?
>
> Optimally, I would like to have a page that displays one row from a table,
> and links that will allow a user to go to the next or previous row via
> hyperlink. At first glance I can't think how you would do that querying
by,
> say, lname or the like.
>
> - Original Message -
> From: "Todd WIlliamsen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, February 12, 2002 10:09 PM
> Subject: Re: [PHP-DB] Flipping through database records
>
>
> > how about just not do it by userid?  query some other column thats in
> there
> >
> > maybe by last name?
> >
> > SELECT * FROM $tablename WHERE lname = $lname LIMIT [#results per page]
> >
> > That should eliminate gaps
> > "Olinux" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Interesting Jason, just to make sure I'm clear:
> > >
> > > basically, you would query the table and
> > > while loop through the query result and create an
> > > array and then store that in a session?
> > >
> > > olinux
> > >
> > >
> > > --- Jason Cox <[EMAIL PROTECTED]> wrote:
> > > > Dan,
> > > >
> > > > Here's an idea for you:
> > > >
> > > > Rather than try to pass the uid through the pages,
> > > > pass a counter that will
> > > > act as an index to your result array.  For example,
> > > > let's say you have a
> > > > query like: select * from myTable order by someCol;
> > > > The order by will help
> > > > give some sort of uniformity to the list on each
> > > > page.  Each time you access
> > > > the page, you would run this query and stuff
> > > > everything into an array.  The
> > > > index would be passed in and indicate which record
> > > > in the array to display.
> > > > You would know whether to display the 'prev' and
> > > > 'next' labels by comparing
> > > > the index to the size of the array.
> > > >
> > > > If your table is large than you can optimize your
> > > > query so you're not
> > > > returning all the rows everytime.  If the index was
> > > > $idx then you could do
> > > > something like: select * from myTable order by
> > > > someCol limit $idx;  So if
> > > > you had a hundred records and your index was 10 then
> > > > you would only get the
> > > > first 10 records.  Since we're including the order
> > > > by clause, the 10 should
> > > > pretty much stay the same if the table doesn't
> > > > change very often.  With this
> > > > technique you would need to do a count() to find out
> > > > the maximum number rows
> > > > in the table.  Since a count() is faster than a
> > > > query returning many rows,
> > > > the combination of these two statements would be a
> > > > bit faster than running
> > > > the original query on a large table.  But then
> > > > again, on a large table I
> > > > doubt someone would want to browse each row.  That's
> > > > kinda like looking for
> > > > a good book by browsing the card catalog at the
> > > > library... :)
> > > >
> > > > Hope that helps,
> > > > Jason Cox
> > >
> > > __
> > > Do You Yahoo!?
> > > Send FREE Valentine eCards with Yahoo! Greetings!
> > > http://greetings.yahoo.com
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, v

[PHP-DB] Logging visits using a database

2002-02-13 Thread Peter Lovatt

Hi

Excuse the cross post

I am thinking about building a logging tool to do visit analysis using SQL,
rather than doing log file analysis.

The aim is to analyse requests for dynamic pages called via php as well as
static pages. Static pages will use an include for logging. Php calls may
have two or three extra parameters which relate to products that are
displayed (this is for ecommerce) which I also want to log. I am looking
particularly at HTTP_REFERER, paths through the site, and most viewed
products.

Questions

1. Am I reinventing the wheel? and would it be better to buy a package
(Spending money brings me out in a nasty rash, and leaves me feeling a
little unsteady on my feet, but is sometimes the best option), or use a free
one. The intended audience is non technical managerial type bods so nothing
too difficult to understand :)

2. If I do use an existing package, are there any that are good with dynamic
sites and the parameters passed to scripts, rather than just logging static
pages?

3. Writing a database driven stats package on a medium traffic site (3-500
visits a day, Average 8-12 pages per visit=6000 inserts a day, peaking at
2-3 per second ) will mean lots of inserts, and a few reads when the
analysis is run. Running MySql on a 1.5GHz 512MB machine, is it better to
leave the table unindexed and put up with slow analysis, or will the machine
cope with indexes? The data could be aggregated periodically, but if
possible left intact for up to a year to follow trends.

4. Is a (MySql?) database driven system a good answer, or just the wrong way
to go??

Any thoughts and experience much appreciated before I commit to hours of
work and gallons of coffee

Thanx

Peter


---
Excellence in internet and open source software
---
Sunmaia
www.sunmaia.net
[EMAIL PROTECTED]
tel. 0121-242-1473
---


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




[PHP-DB] phpmyadmin and mysql

2002-02-13 Thread mike

Anyone know the ins and outs of phpMyAdmin?  I have been getting the
"accessed denied" error.  The user is set right the passwd is set right and
I am using the ip address of the website.  Am I missing something.  I know
the database was orginally created by the admin control panel (maybe cgi)
and then used by cgi.  Would that matter?

[EMAIL PROTECTED]

thanks in advance,
mike



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




Re: [PHP-DB] A while loop prob ?

2002-02-13 Thread William Fong

Heh, with the help from Mr. Emery, I see the/a part of the problem now.  You
have to fetch the results before you can extract the data into variables.
After you do the query, you must run a/the mysql_fetch_array.

HTH

-w


--
William Fong - [EMAIL PROTECTED]
Phone: 626.968.6424 x210  |  Fax: 626.968.6877
Wireless #: 805.490.7732|  Wireless E-mail: [EMAIL PROTECTED]




- Original Message -
From: "Dave Carrera" <[EMAIL PROTECTED]>
To: "php List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 11:40 AM
Subject: [PHP-DB] A while loop prob ?


: Hi All
:
: What have I done wrong here.
:
: 3 yes 3 hours I have been plaing with this loop.
:
: All it shows is the last record in my db.
:
: It should show and record containing any string in the search.
:
: Error works
:
: Please help I beg you...
:
: As always thank you for any help
:
: Dave C
:
: - My Code Starts Here 
:
: if ($submit){
: if($search == ""){
: $error1 = "No Records found. Please use at least
: 1 character in search box";
: }
: else
: {
: $srchsql = "select * from $tbn where name like \"%$search%\" ";
: $srchresult = mysql_query($srchsql, $con);
: $name =$srchrow['name'];
: $details =$srchrow['details'];
: $price =$srchrow['price'];
: $imgloc =$srchrow['imgloc'];
: while (list($name, $details, $price, $imgloc)
: =mysql_fetch_array($srchresult)){
:
: $display_srch_rows =
: "$imgloc$name$details$price
: ";
: }
: }
: }
:
: Dave Carrera
: Website Designer
: http://www.davecarrera.com
:
:
:
:
: --
: PHP Database Mailing List (http://www.php.net/)
: To unsubscribe, visit: http://www.php.net/unsub.php
:
:



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




RE: [PHP-DB] Connecting to ms acces dbase from php

2002-02-13 Thread Gurhan Ozen

You need to install data source name at :
 Start --> Settings --> Control PAnel --> Data Sources(ODBC)

Gurhan

-Original Message-
From: Renaldo De Silva [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 2:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connecting to ms acces dbase from php


Anyone know how this is done, I know it has something to do with installing
ODBC drivers, I downloaded them but I don't understand what I'm doing, Also
can you use an acces database on the same machine or do you have to connect
to a remote machine over some kind of network to use odbc.

Can anyone help.

Thanks

--
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] undeclared variable error

2002-02-13 Thread Rick Emery

change:


to:



note the semi-colon

-Original Message-
From: Dan Howard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 2:34 PM
To: Rick Emery; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] undeclared variable error


Thanks Rick,

That took care of the $submit error, but I still have the following error
showing: 

PHP Warning: Undefined variable: PHP_SELF in c:\inetpub\wwwroot\testform.php
on line 14 

Here is line 14:



I still don't know what's going on here.

Thanks for your patience and help for us newbies!

Dan




-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 12:11 PM
To: 'Dan Howard'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] undeclared variable error


change:
if ($submit) { 

to:
if (ISSET($submit)) { 

-Original Message-
From: Dan Howard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 12:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] undeclared variable error


Folks,

I am very new to PHP, and have been working through some tutorials.  I have
been able to post data from mySQL, but when I tried to do a form page to
enter data into the database I get the following error:

PHP Warning: Undefined variable: submit in c:\inetpub\wwwroot\testform.php
on line 4 PHP Warning: Undefined variable: PHP_SELF in
c:\inetpub\wwwroot\testform.php on line 14 

Here is the code:

 

 

 

 

First name: 

Last name: 

Address: 

Position: 

 

 

 

 

 

Does anyone have any ideas, or where I need to look more to learn what the
problem is here?  TIA

Dan

-- 
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] undeclared variable error

2002-02-13 Thread Dan Howard

Thanks Rick,

That took care of the $submit error, but I still have the following error
showing: 

PHP Warning: Undefined variable: PHP_SELF in c:\inetpub\wwwroot\testform.php
on line 14 

Here is line 14:



I still don't know what's going on here.

Thanks for your patience and help for us newbies!

Dan




-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 12:11 PM
To: 'Dan Howard'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] undeclared variable error


change:
if ($submit) { 

to:
if (ISSET($submit)) { 

-Original Message-
From: Dan Howard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 12:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] undeclared variable error


Folks,

I am very new to PHP, and have been working through some tutorials.  I have
been able to post data from mySQL, but when I tried to do a form page to
enter data into the database I get the following error:

PHP Warning: Undefined variable: submit in c:\inetpub\wwwroot\testform.php
on line 4 PHP Warning: Undefined variable: PHP_SELF in
c:\inetpub\wwwroot\testform.php on line 14 

Here is the code:

 

 

 

 

First name: 

Last name: 

Address: 

Position: 

 

 

 

 

 

Does anyone have any ideas, or where I need to look more to learn what the
problem is here?  TIA

Dan

-- 
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: MS SQL Server 7

2002-02-13 Thread Lerp

Hi there. Have you tried it with the odbc functions? Same prob?

Cheers, Joe :)

"Todd Williamsen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am trying to get PHP to work with MS SQL Server 7, but its not liking
> something
>
> when I do a mssql_connect()  it says "
>
> Fatal error: Call to undefined function: mssql_connect() in
> c:\inetpub\wwwroot\test.php on line 7
>
> I have added the proper extensions, have put them in the right directory.
>
> Seems like its not recognizing MS SQL Server dll file
>
>
>



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




RE: [PHP-DB] A while loop prob ?

2002-02-13 Thread Rick Emery

Need to show us more code.

For instance: where is $srchrow set?

Next, change:
if ($submit){

to:
if (ISSET($submit)) {

Why are you over-writing $name, $details, $price, $imgloc with list() before
you even use them?


-Original Message-
From: Dave Carrera [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 1:40 PM
To: php List
Subject: [PHP-DB] A while loop prob ?


Hi All

What have I done wrong here.

3 yes 3 hours I have been plaing with this loop.

All it shows is the last record in my db.

It should show and record containing any string in the search.

Error works

Please help I beg you...

As always thank you for any help

Dave C

- My Code Starts Here 

if ($submit){
if($search == ""){
$error1 = "No Records found. Please use at least
1 character in search box";
}
else
{
$srchsql = "select * from $tbn where name like \"%$search%\" ";
$srchresult = mysql_query($srchsql, $con);
$name =$srchrow['name'];
$details =$srchrow['details'];
$price =$srchrow['price'];
$imgloc =$srchrow['imgloc'];
while (list($name, $details, $price,
$imgloc)=mysql_fetch_array($srchresult)){

$display_srch_rows =
"$imgloc$name$details$price
";
}
}
}

Dave Carrera
Website Designer
http://www.davecarrera.com
 



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

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




Re: [PHP-DB] A while loop prob ?

2002-02-13 Thread William Fong

You forgot the:
- My Code Ends Here 

...


Jokes aside, and with some level of assumption, use:
if ( isset($submit) ){

Your while() should be:
while (list($name, $details, $price,
$imgloc)==mysql_fetch_array($srchresult)){


= - is to set a variable
== - is to compare two things


Not sure why you are hitting the Error.  Maybe its my inexperience.

HTH

-w



--
William Fong - [EMAIL PROTECTED]
Phone: 626.968.6424 x210  |  Fax: 626.968.6877
Wireless #: 805.490.7732|  Wireless E-mail: [EMAIL PROTECTED]




- Original Message -
From: "Dave Carrera" <[EMAIL PROTECTED]>
To: "php List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 11:40 AM
Subject: [PHP-DB] A while loop prob ?


: Hi All
:
: What have I done wrong here.
:
: 3 yes 3 hours I have been plaing with this loop.
:
: All it shows is the last record in my db.
:
: It should show and record containing any string in the search.
:
: Error works
:
: Please help I beg you...
:
: As always thank you for any help
:
: Dave C
:
: - My Code Starts Here 
:
: if ($submit){
: if($search == ""){
: $error1 = "No Records found. Please use at least
: 1 character in search box";
: }
: else
: {
: $srchsql = "select * from $tbn where name like \"%$search%\" ";
: $srchresult = mysql_query($srchsql, $con);
: $name =$srchrow['name'];
: $details =$srchrow['details'];
: $price =$srchrow['price'];
: $imgloc =$srchrow['imgloc'];
: while (list($name, $details, $price, $imgloc)
: =mysql_fetch_array($srchresult)){
:
: $display_srch_rows =
: "$imgloc$name$details$price
: ";
: }
: }
: }
:
: Dave Carrera
: Website Designer
: http://www.davecarrera.com
:
:
:
:
: --
: PHP Database Mailing List (http://www.php.net/)
: To unsubscribe, visit: http://www.php.net/unsub.php
:
:



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




Re: [PHP-DB] Passing form values with quotes, to itself

2002-02-13 Thread William Fong

Doesn't PHP have something that will automatically do this?  I can't
remember, but I think you had to enable it in php.ini or when you compile.

(just like to know for future reference).

thx.

-w

--
William Fong - [EMAIL PROTECTED]
Phone: 626.968.6424 x210  |  Fax: 626.968.6877
Wireless #: 805.490.7732|  Wireless E-mail: [EMAIL PROTECTED]




- Original Message -
From: "David Fudge" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 10:12 AM
Subject: Re: [PHP-DB] Passing form values with quotes, to itself


: before you submit to the db, you have to escape the quotes like this:
:
: $Body = addslashes($Body);
: all " " will show up as \" \"
: and ' ' will be \' \'
:
: when you pull the info from the db, you'll have to use "stripslashes()" to
: remove those you put in.
: $Body = stripslashes($Body_from_db);
:
: - Original Message -
: From: "Faye Keesic" <[EMAIL PROTECTED]>
: To: <[EMAIL PROTECTED]>
: Sent: Wednesday, February 13, 2002 1:02 PM
: Subject: [PHP-DB] Passing form values with quotes, to itself
:
:
: > Hi there.
: >
: > I have a form that contains several fields w/ text info (which may or
may
: > not contain single and double quotes).
: >
: > When the user clicks Preview, the form's action is set to call itself
: > ($PHP_SELF), and the info is displayed nicely so they can read it over,
: and
: > verify it before saving to the db.
: >
: > What I'm having problems with is that when the data has quotes, the text
: > data cuts off.
: >
: > If I use: 
: > then double quotes are cut off.
: >
: > If I use: 
: > then single quotes are cut off.
: >
: > I want nothing cut off!  I've tried addslashes()..still cuts off.
: >
: > I hope that all made sense...
: > --
: > Faye
: >
: >
: > --
: > PHP Database Mailing List (http://www.php.net/)
: > To unsubscribe, visit: http://www.php.net/unsub.php
: >
:
:
: --
: PHP Database Mailing List (http://www.php.net/)
: To unsubscribe, visit: http://www.php.net/unsub.php
:



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




[PHP-DB] A while loop prob ?

2002-02-13 Thread Dave Carrera

Hi All

What have I done wrong here.

3 yes 3 hours I have been plaing with this loop.

All it shows is the last record in my db.

It should show and record containing any string in the search.

Error works

Please help I beg you...

As always thank you for any help

Dave C

- My Code Starts Here 

if ($submit){
if($search == ""){
$error1 = "No Records found. Please use at least
1 character in search box";
}
else
{
$srchsql = "select * from $tbn where name like \"%$search%\" ";
$srchresult = mysql_query($srchsql, $con);
$name =$srchrow['name'];
$details =$srchrow['details'];
$price =$srchrow['price'];
$imgloc =$srchrow['imgloc'];
while (list($name, $details, $price, $imgloc)
=mysql_fetch_array($srchresult)){

$display_srch_rows =
"$imgloc$name$details$price
";
}
}
}

Dave Carrera
Website Designer
http://www.davecarrera.com
 



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




[PHP-DB] Connecting to ms acces dbase from php

2002-02-13 Thread Renaldo De Silva

Anyone know how this is done, I know it has something to do with installing 
ODBC drivers, I downloaded them but I don't understand what I'm doing, Also 
can you use an acces database on the same machine or do you have to connect 
to a remote machine over some kind of network to use odbc.

Can anyone help.

Thanks

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




Re: [PHP-DB] Passing form values with quotes, to itself

2002-02-13 Thread Jim Lucas [php]

it will still cut off with the double quots.  if you have a double quote
inside of a double quoted value property



This will still break.  it does care if they are escaped.

Jim Lucas
- Original Message -
From: "David Fudge" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 10:12 AM
Subject: Re: [PHP-DB] Passing form values with quotes, to itself


> before you submit to the db, you have to escape the quotes like this:
>
> $Body = addslashes($Body);
> all " " will show up as \" \"
> and ' ' will be \' \'
>
> when you pull the info from the db, you'll have to use "stripslashes()" to
> remove those you put in.
> $Body = stripslashes($Body_from_db);
>
> - Original Message -
> From: "Faye Keesic" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 13, 2002 1:02 PM
> Subject: [PHP-DB] Passing form values with quotes, to itself
>
>
> > Hi there.
> >
> > I have a form that contains several fields w/ text info (which may or
may
> > not contain single and double quotes).
> >
> > When the user clicks Preview, the form's action is set to call itself
> > ($PHP_SELF), and the info is displayed nicely so they can read it over,
> and
> > verify it before saving to the db.
> >
> > What I'm having problems with is that when the data has quotes, the text
> > data cuts off.
> >
> > If I use: 
> > then double quotes are cut off.
> >
> > If I use: 
> > then single quotes are cut off.
> >
> > I want nothing cut off!  I've tried addslashes()..still cuts off.
> >
> > I hope that all made sense...
> > --
> > Faye
> >
> >
> > --
> > 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] Passing form values with quotes, to itself

2002-02-13 Thread Jim Lucas [php]

Try this.



That should to the job.

Jim Lucas
- Original Message -
From: "Faye Keesic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 10:02 AM
Subject: [PHP-DB] Passing form values with quotes, to itself


> Hi there.
>
> I have a form that contains several fields w/ text info (which may or may
> not contain single and double quotes).
>
> When the user clicks Preview, the form's action is set to call itself
> ($PHP_SELF), and the info is displayed nicely so they can read it over,
and
> verify it before saving to the db.
>
> What I'm having problems with is that when the data has quotes, the text
> data cuts off.
>
> If I use: 
> then double quotes are cut off.
>
> If I use: 
> then single quotes are cut off.
>
> I want nothing cut off!  I've tried addslashes()..still cuts off.
>
> I hope that all made sense...
> --
> Faye
>
>
> --
> 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] Passing form values with quotes, to itself

2002-02-13 Thread Rick Emery

try:
">

Also, please include a sample field value and the results of our tests

-Original Message-
From: Faye Keesic [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 12:03 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Passing form values with quotes, to itself


Hi there.

I have a form that contains several fields w/ text info (which may or may
not contain single and double quotes).

When the user clicks Preview, the form's action is set to call itself
($PHP_SELF), and the info is displayed nicely so they can read it over, and
verify it before saving to the db.

What I'm having problems with is that when the data has quotes, the text
data cuts off.

If I use: 
then double quotes are cut off.

If I use: 
then single quotes are cut off.

I want nothing cut off!  I've tried addslashes()..still cuts off.

I hope that all made sense...
-- 
Faye


-- 
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] undeclared variable error

2002-02-13 Thread Rick Emery

change:
if ($submit) { 

to:
if (ISSET($submit)) { 

-Original Message-
From: Dan Howard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 12:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] undeclared variable error


Folks,

I am very new to PHP, and have been working through some tutorials.  I have
been able to post data from mySQL, but when I tried to do a form page to
enter data into the database I get the following error:

PHP Warning: Undefined variable: submit in c:\inetpub\wwwroot\testform.php
on line 4 PHP Warning: Undefined variable: PHP_SELF in
c:\inetpub\wwwroot\testform.php on line 14 

Here is the code:

 

 

 

 

First name: 

Last name: 

Address: 

Position: 

 

 

 

 

 

Does anyone have any ideas, or where I need to look more to learn what the
problem is here?  TIA

Dan

-- 
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] Required pages...

2002-02-13 Thread Andrés Felipe Hernández

I include this file on the top of all my scripts:



/admin/index.php is the script where i do the login

andrés

- Original Message -
From: "William Fong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 12, 2002 2:52 PM
Subject: Re: [PHP-DB] Required pages...


> I am not sure if JavaScript is a really good idea in this case because if
> the user has JavaScript turned off, what will happen?  I believe the
> HTTP_REFERRER is the best.  Not sure the exact syntax of that either.
>
> Another question pops up.  What will happen now if the user does not log
in?
> If a session has not been started, it shouldn't be displaying anything (or
> redirect to the login page).  Sessions is probably the way to go...
>
> HTH
>
> -w
>
> --
> William Fong - [EMAIL PROTECTED]
> Phone: 626.968.6424 x210  |  Fax: 626.968.6877
> Wireless #: 805.490.7732|  Wireless E-mail: [EMAIL PROTECTED]
>
>
>
>
> - Original Message -
> From: "Jonathan Underfoot" <[EMAIL PROTECTED]>
> To: "jas" <[EMAIL PROTECTED]>
> Cc: "[PHP-DB]" <[EMAIL PROTECTED]>
> Sent: Tuesday, February 12, 2002 2:21 PM
> Subject: Re: [PHP-DB] Required pages...
>
>
> : Personally, I'm not quite sure what the best way to do it would be.  (I
> : don't use sessions personally.) But I've noticed recently on certain
"less
> : than scrupulous" websites that they're using javascript to track down
the
> : user's last page (to make sure they voted.)  You'd have to track down
the
> : javascript commands on the netscape site, I don't know them offhand.  If
> : theres a PHP way to do it, I'm unsure of it.
> :
> : Regards,
> :
> : -Jonathan
> :
> :
> : - Original Message -
> : From: "jas" <[EMAIL PROTECTED]>
> : To: <[EMAIL PROTECTED]>
> : Sent: Tuesday, February 12, 2002 5:22 AM
> : Subject: [PHP-DB] Required pages...
> :
> :
> : > I am wondering if there is a way to force users to come from a certain
> : page.
> : > For an example I am using a login page which once authenticated allows
> : users
> : > to change the contents of a web site without knowing alot of code etc.
> : What
> : > I would like to do is make sure that the content management system
will
> : not
> : > be accessed unless the user logs in.  I am certain sessions is the way
> to
> : go
> : > on this, however I am still new enough to not understand exactly how
> they
> : > work and how to impliment them on a site.  I have read a little bit on
a
> : > tutorial on php.net.  If anyone can give me an example of how this
could
> : be
> : > accomplished I would appriciate it.
> : > Jas
> : >
> : >
> : >
> : > --
> : > PHP Database Mailing List (http://www.php.net/)
> : > To unsubscribe, visit: http://www.php.net/unsub.php
> : >
> :
> :
> : --
> : PHP Database Mailing List (http://www.php.net/)
> : To unsubscribe, visit: http://www.php.net/unsub.php
> :
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP-DB] undeclared variable error

2002-02-13 Thread Dan Howard

Folks,

I am very new to PHP, and have been working through some tutorials.  I have
been able to post data from mySQL, but when I tried to do a form page to
enter data into the database I get the following error:

PHP Warning: Undefined variable: submit in c:\inetpub\wwwroot\testform.php
on line 4 PHP Warning: Undefined variable: PHP_SELF in
c:\inetpub\wwwroot\testform.php on line 14 

Here is the code:

 

 

 

 

First name: 

Last name: 

Address: 

Position: 

 

 

 

 

 

Does anyone have any ideas, or where I need to look more to learn what the
problem is here?  TIA

Dan

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




Re: [PHP-DB] Passing form values with quotes, to itself

2002-02-13 Thread David Fudge

before you submit to the db, you have to escape the quotes like this:

$Body = addslashes($Body);
all " " will show up as \" \"
and ' ' will be \' \'

when you pull the info from the db, you'll have to use "stripslashes()" to
remove those you put in.
$Body = stripslashes($Body_from_db);

- Original Message -
From: "Faye Keesic" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 1:02 PM
Subject: [PHP-DB] Passing form values with quotes, to itself


> Hi there.
>
> I have a form that contains several fields w/ text info (which may or may
> not contain single and double quotes).
>
> When the user clicks Preview, the form's action is set to call itself
> ($PHP_SELF), and the info is displayed nicely so they can read it over,
and
> verify it before saving to the db.
>
> What I'm having problems with is that when the data has quotes, the text
> data cuts off.
>
> If I use: 
> then double quotes are cut off.
>
> If I use: 
> then single quotes are cut off.
>
> I want nothing cut off!  I've tried addslashes()..still cuts off.
>
> I hope that all made sense...
> --
> Faye
>
>
> --
> 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] Passing form values with quotes, to itself

2002-02-13 Thread Faye Keesic

Hi there.

I have a form that contains several fields w/ text info (which may or may
not contain single and double quotes).

When the user clicks Preview, the form's action is set to call itself
($PHP_SELF), and the info is displayed nicely so they can read it over, and
verify it before saving to the db.

What I'm having problems with is that when the data has quotes, the text
data cuts off.

If I use: 
then double quotes are cut off.

If I use: 
then single quotes are cut off.

I want nothing cut off!  I've tried addslashes()..still cuts off.

I hope that all made sense...
-- 
Faye


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




RE: [PHP-DB] First and Last Record Query

2002-02-13 Thread Rankin, Randy

>> Why are you iterating through the array?

Inexperience. 

Thanks for the help guys. I'll give it a try. 

Randy

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 11:43 AM
To: 'David Fudge'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] First and Last Record Query


Why are you iterating through the array?  Why not just:

$start_id = $row[0];
$end_id = $row[count($row)-1];

-Original Message-
From: David Fudge [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 11:40 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] First and Last Record Query


well, if you're using an array, you could use a for like this:

$row = mysql_fetch_row($result);
for( $i=0;$i
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 12:32 PM
Subject: [PHP-DB] First and Last Record Query


> Does anyone know how to grab only the first and last record of a query.
>
> I have a table named periods with two fields, period_id and period_name.
The
> user will select a start period and an end period from a drop down list,
> assigning $start_period and $end_period variables based on the period id.
If
> I run this query:
>
> Select period_name
> from periods
> where period_id between '$start_period_id' and '$end_period_id'
> order by period_id
>
> An array is returned which could include one or more records, depending
upon
> the user selection. I would like to grab the first and last record in the
> array so that the final result would be to echo something like "This
report
> is from $start_period through $end_period".
>
> Hope that makes sense ...
>
> Thanks in advance for any help.
>
> Randy Rankin
>


-- 
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] First and Last Record Query

2002-02-13 Thread David Fudge

yep, good point.  thanks. =)

- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'David Fudge'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 12:43 PM
Subject: RE: [PHP-DB] First and Last Record Query


> Why are you iterating through the array?  Why not just:
>
> $start_id = $row[0];
> $end_id = $row[count($row)-1];
>
> -Original Message-
> From: David Fudge [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 13, 2002 11:40 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] First and Last Record Query
>
>
> well, if you're using an array, you could use a for like this:
>
> $row = mysql_fetch_row($result);
> for( $i=0;$i {
> if( $i==0 )
> $start_id = $row[$i];
> elseif( $i == (count($row)-1) )
> $end_id = $row[$i];
> }
>
>
> - Original Message -
> From: "Rankin, Randy" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 13, 2002 12:32 PM
> Subject: [PHP-DB] First and Last Record Query
>
>
> > Does anyone know how to grab only the first and last record of a query.
> >
> > I have a table named periods with two fields, period_id and period_name.
> The
> > user will select a start period and an end period from a drop down list,
> > assigning $start_period and $end_period variables based on the period
id.
> If
> > I run this query:
> >
> > Select period_name
> > from periods
> > where period_id between '$start_period_id' and '$end_period_id'
> > order by period_id
> >
> > An array is returned which could include one or more records, depending
> upon
> > the user selection. I would like to grab the first and last record in
the
> > array so that the final result would be to echo something like "This
> report
> > is from $start_period through $end_period".
> >
> > Hope that makes sense ...
> >
> > Thanks in advance for any help.
> >
> > Randy Rankin
> >
>
>
> --
> 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] First and Last Record Query

2002-02-13 Thread Rick Emery

Why are you iterating through the array?  Why not just:

$start_id = $row[0];
$end_id = $row[count($row)-1];

-Original Message-
From: David Fudge [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 11:40 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] First and Last Record Query


well, if you're using an array, you could use a for like this:

$row = mysql_fetch_row($result);
for( $i=0;$i
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 12:32 PM
Subject: [PHP-DB] First and Last Record Query


> Does anyone know how to grab only the first and last record of a query.
>
> I have a table named periods with two fields, period_id and period_name.
The
> user will select a start period and an end period from a drop down list,
> assigning $start_period and $end_period variables based on the period id.
If
> I run this query:
>
> Select period_name
> from periods
> where period_id between '$start_period_id' and '$end_period_id'
> order by period_id
>
> An array is returned which could include one or more records, depending
upon
> the user selection. I would like to grab the first and last record in the
> array so that the final result would be to echo something like "This
report
> is from $start_period through $end_period".
>
> Hope that makes sense ...
>
> Thanks in advance for any help.
>
> Randy Rankin
>


-- 
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] First and Last Record Query

2002-02-13 Thread David Fudge

well, if you're using an array, you could use a for like this:

$row = mysql_fetch_row($result);
for( $i=0;$i
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 13, 2002 12:32 PM
Subject: [PHP-DB] First and Last Record Query


> Does anyone know how to grab only the first and last record of a query.
>
> I have a table named periods with two fields, period_id and period_name.
The
> user will select a start period and an end period from a drop down list,
> assigning $start_period and $end_period variables based on the period id.
If
> I run this query:
>
> Select period_name
> from periods
> where period_id between '$start_period_id' and '$end_period_id'
> order by period_id
>
> An array is returned which could include one or more records, depending
upon
> the user selection. I would like to grab the first and last record in the
> array so that the final result would be to echo something like "This
report
> is from $start_period through $end_period".
>
> Hope that makes sense ...
>
> Thanks in advance for any help.
>
> Randy Rankin
>


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




[PHP-DB] First and Last Record Query

2002-02-13 Thread Rankin, Randy

Does anyone know how to grab only the first and last record of a query. 

I have a table named periods with two fields, period_id and period_name. The
user will select a start period and an end period from a drop down list,
assigning $start_period and $end_period variables based on the period id. If
I run this query:

Select period_name
from periods
where period_id between '$start_period_id' and '$end_period_id'
order by period_id

An array is returned which could include one or more records, depending upon
the user selection. I would like to grab the first and last record in the
array so that the final result would be to echo something like "This report
is from $start_period through $end_period".

Hope that makes sense ...

Thanks in advance for any help. 

Randy Rankin



[PHP-DB] MS SQL Server 7

2002-02-13 Thread Todd WIlliamsen

I am trying to get PHP to work with MS SQL Server 7, but its not liking
something

when I do a mssql_connect()  it says "

Fatal error: Call to undefined function: mssql_connect() in
c:\inetpub\wwwroot\test.php on line 7

I have added the proper extensions, have put them in the right directory.

Seems like its not recognizing MS SQL Server dll file




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




[PHP-DB] Problems with pg_FieldNum

2002-02-13 Thread Brady A. Johnson

Greetings,

I am having trouble with the PostgreSQL pg_FieldNum() funciton.  When I 
execute the following:

  $DB = pg_Connect ( "dbname=lists" );
  $Recs = pg_Exec ( $DB, "SELECT 123 AS \"ABC\"" );

  $FieldName = pg_FieldName ( $Recs, 0 );
  print ( "FieldName: $FieldName" );

  $FieldNum = pg_FieldNum ( $Recs, $FieldName );
  print ( "FieldNum: $FieldNum" );

I get:

  FieldName: ABC
  FieldNum: -1

It seems that no matter what I pass to pg_FieldNum(), I get -1 (error) in 
return.

Anyone spot what I am doing wrong?

I am using PostgreSQL 7.0.2 and PHP 4.0.3 on RH Linux 7.0.

Thanks,

-Brady

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




RE: [PHP-DB] Need help (displaying select data from an array)

2002-02-13 Thread Rick Emery

session_start() does not take a parameter.  Use:

session_start();
session_register($clothes);


-Original Message-
From: Renaldo De Silva [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 8:16 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need help (displaying select data from an array)


First up soory for the long messge but I'm totally stuck, I've been stuck 
for the past 3 days. I'm trying to display the results of a search, The 
code I've written so far displays the first five results and the links to 
pages for the rest, how do I display only the rows that I want.

The code I've written so far

--->






 Search results...

";

$searchwords = split(" ", $search);

/*
foreach($searchwords as $line)
{
$sql_1.= "description like '%$line%' or ";
$sql_2.= " name like '%$line%' or";
$sql_3.= " type like '%$line%' or";
}
$rest = substr($sql_3, 0, strlen($sql_3)-3);

$partsql.= $sql_1 . $sql_2 . $sql_3 ;

$command = substr($partsql, 0, strlen($partsql)-3);
$search = $command;
*/

if (empty($search))
{
echo "You did not enter a search string, please go back and try again";
quit;
}
echo "";

mysql_select_db("clothes");

$list = "select * from products WHERE MATCH ( type,name,description ) 
AGAINST ('$search')";

$results = mysql_query($list);

$num_results = mysql_num_rows($results);

$num_temp = ceil($num_results / 5) ;
echo "";
$num_pages = $num_temp + 1;
echo "$num_pages pages";
echo "";

$row = mysql_fetch_array($results);

$i= 0;
$m= 5;

if ($p != 0 )
{
$i = 5 * $p;
$m = ($m * $p) + 5;
}
if ($num_results)
{
for ( $i=$i;  $i<$m; $i++)
{
$row = mysql_fetch_array($results);

   echo "Type:";
   echo  $row["type"];
   echo " Name:";
   echo  $row["name"];
   echo " Price:";
   echo  $row["price"];
   echo "";
   echo " Description:";
   echo  $row["description"];
 if ($row["image1"])
{
echo "";
echo " Image 1: ";
?>
http://cirkit.com/images/ ">
";
echo " Image 2: ";
?>
http://cirkit.com/images/ ">
";
echo " Image 3: ";
?>
http://cirkit.com/images/ ">
";
}
}
 //diplay no result found if search unsucessful
 else
 {
 echo "No results found. Please try another search phrase.";
 }
   // dislpays the links @ the bottom of 
the page
   echo "";
   echo "";
   for ($p=0; $p<$num_pages; $p++)
   {
   $id = "p=$p&search=$search";
   ?>
   
   
   
   

HOME






<<<--->>

Can anyone help me please, I'm new at this only been programming for 3 
weeks.

-- 
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] Error insert into MS-access through ODBC not aviable

2002-02-13 Thread Andrew Hill

Penockio,

You might find this helpful:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q175168

Best regards,
Andrew Hill
Director of Technology Evangelism
http://www.openlinksw.com/virtuoso/whatis.htm
OpenLink Virtuoso Internet Data Integration Server

> -Original Message-
> From: Penockio [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 12, 2002 12:51 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Error insert into MS-access through ODBC not aviable
>
>
> I can't use sql command "insert into " but I can use "select" and it
> condition.I use DSN that provide by ODBC and use MS-Access as source file.
>
> my code :
>
> $connect =  odbc_connect("sosdb","","") or die ("can not connect")
> ; ->successfult
>
> $order_trans_detail_sql = "insert into order_trans_detail
> (order_id,cus_id,order_place) values
> ('0212027','0071577722451188','548/12 123 Road Patumwan') ; " ;
>
> $exec = odbc_exec($connect,$order_trans_detail_sql )  or die
> ("cannot insert
> order trans detail") ; -> warning as below
>
> all field is text field for database MS-Access .and I connect it through
> ODBC by ms access driver use (DSN)
>
> I found
>   Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation
> must use an updateable query., SQL state S1000 in
>
>
>
>
> --
> 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] Need help (displaying select data from an array)

2002-02-13 Thread Renaldo De Silva

First up soory for the long messge but I'm totally stuck, I've been stuck 
for the past 3 days. I'm trying to display the results of a search, The 
code I've written so far displays the first five results and the links to 
pages for the rest, how do I display only the rows that I want.

The code I've written so far

--->






 Search results...

";

$searchwords = split(" ", $search);

/*
foreach($searchwords as $line)
{
$sql_1.= "description like '%$line%' or ";
$sql_2.= " name like '%$line%' or";
$sql_3.= " type like '%$line%' or";
}
$rest = substr($sql_3, 0, strlen($sql_3)-3);

$partsql.= $sql_1 . $sql_2 . $sql_3 ;

$command = substr($partsql, 0, strlen($partsql)-3);
$search = $command;
*/

if (empty($search))
{
echo "You did not enter a search string, please go back and try again";
quit;
}
echo "";

mysql_select_db("clothes");

$list = "select * from products WHERE MATCH ( type,name,description ) 
AGAINST ('$search')";

$results = mysql_query($list);

$num_results = mysql_num_rows($results);

$num_temp = ceil($num_results / 5) ;
echo "";
$num_pages = $num_temp + 1;
echo "$num_pages pages";
echo "";

$row = mysql_fetch_array($results);

$i= 0;
$m= 5;

if ($p != 0 )
{
$i = 5 * $p;
$m = ($m * $p) + 5;
}
if ($num_results)
{
for ( $i=$i;  $i<$m; $i++)
{
$row = mysql_fetch_array($results);

   echo "Type:";
   echo  $row["type"];
   echo " Name:";
   echo  $row["name"];
   echo " Price:";
   echo  $row["price"];
   echo "";
   echo " Description:";
   echo  $row["description"];
 if ($row["image1"])
{
echo "";
echo " Image 1: ";
?>
http://cirkit.com/images/ ">
";
echo " Image 2: ";
?>
http://cirkit.com/images/ ">
";
echo " Image 3: ";
?>
http://cirkit.com/images/ ">
";
}
}
 //diplay no result found if search unsucessful
 else
 {
 echo "No results found. Please try another search phrase.";
 }
   // dislpays the links @ the bottom of 
the page
   echo "";
   echo "";
   for ($p=0; $p<$num_pages; $p++)
   {
   $id = "p=$p&search=$search";
   ?>
   
   
   
   

HOME






<<<--->>

Can anyone help me please, I'm new at this only been programming for 3 
weeks.

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




[PHP-DB] Re: mysql_connect() and phpmyadmin

2002-02-13 Thread Raymond Lilleodegard

Hi Martin!

I dont think I understood your question right here.
Are you trying to connect to mysql ?

regards Raymond

"Martin Allan Jensen" <[EMAIL PROTECTED]> wrote in message
005901c1b40d$6143c390$040a@IceSystems">news:005901c1b40d$6143c390$040a@IceSystems...
I just don't understand why phpmyadmin works with it when i can't call
it.! I did try with "localhost"
but it won't still work..

PLEASE help i just can't understand it

Kind regards
Martin



-Original Message-
From: Martin Allan Jensen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 10:44 AM
To: Rick Emery
Subject: Re: [PHP-DB] mysql_connect()


It wasen't me hwo did it! but why do phpmyadmin work fine then??



Martin
- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 12, 2002 5:29 PM
Subject: RE: [PHP-DB] mysql_connect()


> Re-read my previous email.  You do not have mysql functionality compiled
> into PHP and you web server.  The clue is the phrase "undefined function:
> mysql_connect()".
> How did you load PHP, MYSQL, etc?
>
> -Original Message-
> From: Martin Allan Jensen [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 12, 2002 10:26 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] mysql_connect()
>
>
> Sorry folks, last time i wrote it to fast! Well here is the hole
> story
>
> We got an organisation to install a new version of phpmyadmin, mySQL and
PHP
> 4.0.6 on our Cobalt Raq 4r server (Linux)
>
> They got it installed and phpmyadmin is working finebut when i call
fro
> a script souch as
> %
>  // Connecting, selecting database
> $link = mysql_connect("127.0.0.10", "phpcoder_dk", "pdw")
> or die("Could not connect");
> print "Connected successfully";
> mysql_select_db("phpcoder_dk")
> or die("Could not select database");
>
> // Performing SQL query
> $query = "SELECT * FROM hits";
> $result = mysql_query($query)
> or die("Query failed");
> ?>
> %
>
> The script writes this.
> %
> Fatal error: Call to undefined function: mysql_connect() in
> /home/sites/site2/web/sql.php on line 3
> %
>
> You can test it at http://www.phpcoder.dk/sql.php
>
> I really hope that someone will help me cause i really can't find the
> problem by myself...!
>
> Kind regards
> Martin Allan Jensen
>
> --
> 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: Getting days after last login. Date problem

2002-02-13 Thread Adam Royle

Hey there...

Sometimes it is easier to store the date as a unix timestamp (seconds 
since midnight 1/1/1970) cause it allows you to format the date any way 
you want, and php has cool date and time functions which rely on a 
timestamp.

A time stamp example is like this:

Formatted date: " . 
date("j/m/Y",$time);

?>

would produce something like:

Timestamp: 1013605509
Formatted date: 13/02/2002


and then you can store the value of $timestamp in a database and 
calculate the formatted string later...

Adam



> Hi there,
>
> I would like to find out the changes on content after a members last 
> login.
>
> The format of the date stored in the member db is e.g.:   Feb 13, 2002
> The format of e.g pictures uploaded is:
> 2000-02-13
>
> How can I search for pictures which are uploaded since the members last
> login. Is ist possible to convert the memberdate format to the other 
> one and
> just search for something like picturedate > logindate?
>
> Thanx for any help
>
> Andy


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




Re: [PHP-DB] Getting days after last login. Date problem

2002-02-13 Thread Andy

Thanx!

Andy


"* R&Ze:" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi there,
> >
> > I would like to find out the changes on content after a members last
login.
> >
> > The format of the date stored in the member db is e.g.:   Feb 13, 2002
> > The format of e.g pictures uploaded is:
> > 2000-02-13
> >
> > How can I search for pictures which are uploaded since the members last
> > login. Is ist possible to convert the memberdate format to the other one
and
> > just search for something like picturedate > logindate?
> >
> > Thanx for any help
> >
> > Andy
>
>
> strtotime is what you're looking for:
>
> strtotime ("2000-02-13");
> strtotime ("Feb 13, 2002");
>
> Then you can just 'say':
>
> if (strtotime ("2000-02-13") > strtotime ("Feb 13, 2002")) {
>   print ("Picturedate after logindate");
> } else {
>   print ("Logindate after picturedate");
> }
>
> Pretty easy huh!? PHP Rulz!
>
> --
>
> * R&zE:



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




Re: [PHP-DB] Getting days after last login. Date problem

2002-02-13 Thread

> Hi there,
> 
> I would like to find out the changes on content after a members last login.
> 
> The format of the date stored in the member db is e.g.:   Feb 13, 2002
> The format of e.g pictures uploaded is:
> 2000-02-13
> 
> How can I search for pictures which are uploaded since the members last
> login. Is ist possible to convert the memberdate format to the other one and
> just search for something like picturedate > logindate?
> 
> Thanx for any help
> 
> Andy


strtotime is what you're looking for:

strtotime ("2000-02-13");
strtotime ("Feb 13, 2002");

Then you can just 'say':

if (strtotime ("2000-02-13") > strtotime ("Feb 13, 2002")) {
  print ("Picturedate after logindate");
} else {
  print ("Logindate after picturedate");
}

Pretty easy huh!? PHP Rulz!

-- 

* R&zE:

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




[PHP-DB] Getting days after last login. Date problem

2002-02-13 Thread Andy

Hi there,

I would like to find out the changes on content after a members last login.

The format of the date stored in the member db is e.g.:   Feb 13, 2002
The format of e.g pictures uploaded is:
2000-02-13

How can I search for pictures which are uploaded since the members last
login. Is ist possible to convert the memberdate format to the other one and
just search for something like picturedate > logindate?

Thanx for any help

Andy




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




RE: [PHP-DB] Access to Mysql

2002-02-13 Thread Richard Black

Funnily enough, I had to do something similar last week...

Command line utility which will create a sql file to create the MySQL 
database.

No guarantees that it works for everything, but it fulfilled my purposes...

Syntax is:

php -q odbc2mysql.php new_db output_file dsn [user] [password]

And will create a file which contains statements to set up the structure 
(creating ), and import the data.

DOESN'T bring across any indexes, or primary keys, cos I couldn't get the 
php odbc commands to work against Access. Dunno why. But you'll have to set 
those up yourself...

HTH,


Richy


==
Richard Black
Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 435 3504
Email: [EMAIL PROTECTED]


-Original Message-
From:   Alex Francis [SMTP:[EMAIL PROTECTED]]
Sent:   13 February 2002 09:55
To: [EMAIL PROTECTED]
Subject:[PHP-DB] Access to Mysql

I am a complete newbie at this so please excuse me if I seem stupid.

I have a guestbook on one site which was created using ASP and an Access
database. I have created a new site using the much more friendly PHP and
wish to get the data into my mysql database. Can I do this easily, and if 
so
can anyone point me to the required information

--
Alex Francis
Cameron Design
35, Drumillan Hill
Greenock PA16 0XD

Tel 01475 798106
[EMAIL PROTECTED]
http://www.camerondesign.co.uk

This message is sent in confidence for the addressee only. It may contain
legally privileged information.
Unauthorised recipients are requested to preserve this confidentiality and
to advise the sender
immediately of any error in transmission.



--
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] Error insert into MS-access through ODBC not aviable

2002-02-13 Thread Penockio

I can't use sql command "insert into " but I can use "select" and it
condition.I use DSN that provide by ODBC and use MS-Access as source file.

my code :

$connect =  odbc_connect("sosdb","","") or die ("can not connect")
; ->successfult

$order_trans_detail_sql = "insert into order_trans_detail
(order_id,cus_id,order_place) values
('0212027','0071577722451188','548/12 123 Road Patumwan') ; " ;

$exec = odbc_exec($connect,$order_trans_detail_sql )  or die ("cannot insert
order trans detail") ; -> warning as below

all field is text field for database MS-Access .and I connect it through
ODBC by ms access driver use (DSN)

I found
  Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation
must use an updateable query., SQL state S1000 in




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




[PHP-DB] Access to Mysql

2002-02-13 Thread Alex Francis

I am a complete newbie at this so please excuse me if I seem stupid.

I have a guestbook on one site which was created using ASP and an Access
database. I have created a new site using the much more friendly PHP and
wish to get the data into my mysql database. Can I do this easily, and if so
can anyone point me to the required information

--
Alex Francis
Cameron Design
35, Drumillan Hill
Greenock PA16 0XD

Tel 01475 798106
[EMAIL PROTECTED]
http://www.camerondesign.co.uk

This message is sent in confidence for the addressee only. It may contain
legally privileged information.
Unauthorised recipients are requested to preserve this confidentiality and
to advise the sender
immediately of any error in transmission.



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




[PHP-DB] can't insert into MS-access

2002-02-13 Thread Penockio

I can't use sql command "insert into " but I can use "select" and it
condition.I use DSN that provide by ODBC and use MS-Access as source file.
I found Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver]
Operation must use an updateable query., SQL state S1000 in

and my code is " insert into order_trans_detail
(order_id,cus_id,order_place) values
('0212027','0071577722451188','548/12 payatai Road Patumwan') ;" all
field is text field for database MS-Access .and I connect it through ODBC by
ms access driver use (DSN)c



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




RE: [PHP-DB] numeric string problem

2002-02-13 Thread matt stewart

yeah, i would go with Rick on this.
however, the reason i think it's not working is because it's comparing the
contents alphabetically ie. "2" is greater than "1" but is also greater than
"10", "19" etc etc alphabetically, just as anything beginning with "b"
is greater than "a" and also "aazzxsd".
if you absolutely must continue to use the varchar system, then do a check
on the string length first, and then if they are the same length do a <
check.

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: 12 February 2002 20:47
To: 'Mike'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] numeric string problem


The question is: why use varchar?  Why not use INT, then format to includes
commas when displaying?


-Original Message-
From: Mike [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 12, 2002 3:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] numeric string problem


Hi,
I am using VARCHAR for  price column : 600,000  700,000 etc
when I use :  PRICERANGE<='$Price'
it works fine except when the $Price moves to 7 digit as 1,000,000
in other words the" less than " does not work when comparing 6 digit and 7
digit  figures
I am not sure how to compensate for this.
Thanks
Mike



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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.319 / Virus Database: 178 - Release Date: 28/01/02
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.319 / Virus Database: 178 - Release Date: 28/01/02
 

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