Re: [PHP-DB] results on multiple pages

2002-04-17 Thread maxim

Are there any people who know the way to display results on multiple pages
if using Oracle database (preferrably using PHP Oracle finctions and not
Oracle8 functions)?

Best Regards,
Maxim Bubnov

 Richard Emery [EMAIL PROTECTED]:
 Why don't you let mysql sort and limit the records for you?  That's easy
 enough.  Just keep track of where you are in the database and select only
 the records that you need.

 - Original Message -
 From: James Kupernik [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, April 16, 2002 3:20 PM
 Subject: [PHP-DB] results on multiple pages


 I am retrieve records from my MySQL table and I want to display the
results
 12 per page along with allow for a sort. I was just send a query to the
 table with a limit each time, but it didn't sort all the records, so I
need
 to load all the results into a table to sort then display. Here is what I
 have for code

 ?php

 Mysql_connect(localhost,user,pass);

 mysql_select_db(countryloft);

 if (!$nextpg) {
$i = 0;
 } else {
$i = $i + 12;
 }

 $prodTbl = mysql_query(select * FROM countryloft WHERE category LIKE
 '%folk%' ORDER BY displayorder);

 $num_results = mysql_num_rows($prodTbl);

 $itemsPerPage = 12;

 echo table;

 $mycolumn = 1;
 $maxcolumn = 3;

 file://loop table until end of results
 for ($i=$i; $i  $itemsPerPage; $i++)
 {

$row = mysql_fetch_array($prodTbl);

echo td width=200 align=centera
 href=productinfo.php?prodID=.$row['record'].img

src=http://www.thecountryloft.com/countryloft/yellowpics/.$row['image3'].
 border=0;
echo brfont size=2.$row['title']./font;
echo brfont size=2.$row['price']./font/td\n;

if ($mycolumn == $maxcolumn)
{
echo /tr;
}

$mycolumn = $mycolumn + 1;

if ($mycolumn  $maxcolumn)
{
$mycolumn = 1;
}

 }

 echo /table\n;

 echo a href=$PHP_SELF?i=$inextpg=yesNext Page/a;

 ?

 Any help would be great!!

 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




[PHP-DB] Limitations on sending text to a database via text area forms

2002-04-17 Thread John Hughes

I am attempting to build a Web site that will allow users to create simple
text documents that will be stored in a database. I had been assuming I
could use a textarea form and have PHP pass it to a mySQL database.
However, when I attempted to send  a 393 word (2,216 characters) text block,
the browser (I.E. 6) refused to move.  I got no error or other indication of
trouble.  When I cut the text down under 275 words (1,531 characters), the
form was allowed to be submitted, stored and retrievable

Is this the limit on passing textarea form fields?

And more to point of this mailing list, what alternatives might I use to
circumvent this limit?

I need to keep the creation of these documents as simple as possible.
Anything more than copying and pasting is going to cause trouble more me.

John Hughes


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




[PHP-DB] creating a userdatabase with groups in PHP/MySQL

2002-04-17 Thread Sander Peters

Hello,

I have to make a loginprocedure for our intranet at my work.
I have to create a userdatabase with users and usergroups ( like Windows
NT/2000 User Manager and Novell).

Before I start with this job I wonder if maybe somebody created already
something like this in PHP/MySQL and I can just use it.
(This user database is not the security from MySQL! but just a seperated
userbase wich will look to a authorisationtable to determine WHO can enter
WHAT part of the Intranet.)

Or if you have some advise for me to create something like this, I'll be
very thankfull!

With greetings,

Sander Peters
The Netherlands



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




RE: [PHP-DB] Limitations on sending text to a database via text area forms

2002-04-17 Thread Beau Lebens

could you perhaps save the contents directly into a file, then read the file
into the database?

I know for a fact (http://www.dentedreality.com.au/webpad/) that you can use
a textarea to pump more info than that into a file, but haven't tried doing
it straight into a database.

HTH

Beau

// -Original Message-
// From: John Hughes [mailto:[EMAIL PROTECTED]]
// Sent: Wednesday, 17 April 2002 3:03 PM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] Limitations on sending text to a database via text
// area forms
// 
// 
// I am attempting to build a Web site that will allow users to 
// create simple
// text documents that will be stored in a database. I had been 
// assuming I
// could use a textarea form and have PHP pass it to a mySQL database.
// However, when I attempted to send  a 393 word (2,216 
// characters) text block,
// the browser (I.E. 6) refused to move.  I got no error or 
// other indication of
// trouble.  When I cut the text down under 275 words (1,531 
// characters), the
// form was allowed to be submitted, stored and retrievable
// 
// Is this the limit on passing textarea form fields?
// 
// And more to point of this mailing list, what alternatives 
// might I use to
// circumvent this limit?
// 
// I need to keep the creation of these documents as simple as possible.
// Anything more than copying and pasting is going to cause 
// trouble more me.
// 
// John Hughes
// 
// 
// -- 
// 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] dates in MYSQL

2002-04-17 Thread Alex Francis

This may be a stupid question but I am a complete newbie.

I am trying to automatically drop events from a noticeboard when the date
has passed. I have stored the date of the event in the database in the form
-MM-DD and wish to SELECT From the database WHERE date = todays date.
Is this possible or do I need to INSERT todays date into the database first.

--
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] Images and MySQL - please help

2002-04-17 Thread DrTebi

Hi,
I am trying to do this:
- I have an image stored in database 'A'
- a php script should load this image, and stamp it with a watermark
- then the php script should save the new image (with the watermark)
  in database 'B' ...

How can I do this? I guess somehow I have to buffer the output, manipulate
the buffer by adding the watermark, and then insert the image into the
database.

Is this possible? Any ideas?

Thanks!
DrTebi



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




RE: [PHP-DB] Images and MySQL - please help

2002-04-17 Thread Ruprecht Helms

Hi DrTebi,

fetch the image from database A and put it into a buffer then

 I guess somehow I have to buffer the output, manipulate
 the buffer by adding the watermark, and then insert the image into the
 database B
  ^^

Regards,
Ruprecht


--
E-Mail: Ruprecht Helms [EMAIL PROTECTED]
Date: 17-Apr-02
Time: 10:41:33

to be informed - http://www.rheyn.de -

This message was sent by XFMail
--

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




[PHP-DB] Re: [PHP] Re: Cross DB application

2002-04-17 Thread John Lim


Manuel,

 Prepared queries in practice are the same as what John Lim calls in this
 document http://php.weblogs.com/portable_sql as binding, except that
 he doesn't seem to be aware that it is the same thing, so he says that
 only some database can use it! :-) Metabase handles prepared queries
 with ALL supported databases.

Some databases such as MS Access/MySQL do not support binding. So
even if you support MySQL, you only get emulated binding in MySQL, and
not the performance increase you might have expected. I hope that is
clearer.

 Last but not least, PHP ADODB is an attempt of John Lim to develop
 something of his own copying ideas and names from everywhere and cash on
 it by selling PHPLens. He copied Microsoft ADODB to appeal better to
 Windows users. But since ADODB was not meant specifically for portable
 Web development, he still needed to copy features of Metabase like
 auto-incremented integer sequence values and limiting the range of rows
 returned in select queries result sets. Some of these things that were
 copied had their names changes to not look so obvious but they are still
 copies of Metabase features because only Metabase provided them before.


Manuel,  you have a habit of saying nasty things, and you set a bad example
by
doing so, because you are a good programmer who should be a leader in the
community.

 I wish i were smart enough  to have copied from you, but unfortunately I am
too old and stupid. Most of the techniques you mention i learnt before i
even knew PHP,
let alone before had the pleasure of knowing you :-)

Instead I learnt from people who have built some of the finest database
technology around-
the MySQL people who developed the limiting range of rows with SELECT LIMIT
(that is why the function is called SelectLimit in honor of them), and
auto-incrementing stuff from
the Sybase/MS SQL Server designers. I cannot resist mentioning a forgotten
database abstraction
system which I learnt a lot from, developed by Apple, called DAL. A
fantastic product
that is sadly gone, but not forgotten.

I have no problems saying that I developed ADOdb because I needed a database
class library to implement phpLens. The reason is simple, there is no other
database
class library for php that had sufficient functionality to meet the
sophisticated data
requirements that I had. Frankly I would have used Metabase or PEAR DB or
something
similar if it was mature enough. As to the deficiencies of Metabase and PEAR
DB, i don't
think a mud-slinging match is appropriate, but I believe in my work, and
think it stands
very well compared to other libraries.

Yours sincerely, John

ps: ADOdb is released under a BSD-style license, there are no restrictions
to its use.

http://php.weblogs.com/ADOdb



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




RE: [PHP-DB] dates in MYSQL

2002-04-17 Thread Ruprecht Helms


Hi Alex Francis,

 
 SELECT From the database WHERE date = todays date.
^ somethink like now() or date()

an other method you put the date in a variable that you get by the
datecommand and make

SELECT From table WHERE date = datevar (variable with current date)

Regards,
Ruprecht


--
E-Mail: Ruprecht Helms [EMAIL PROTECTED]
Date: 17-Apr-02
Time: 11:37:25

to be informed - http://www.rheyn.de -

This message was sent by XFMail
--

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




Re: [PHP-DB] Dates in MYSQL

2002-04-17 Thread DL Neil

Hi Alex,

 Got my select statement to work as follows:
 $query = ' SELECT * FROM notices WHERE TO_DAYS(eventdate) =
TO_DAYS(now())
 order by eventdate';

=well done!
However the TO-DAYS calls do seem a bit OTT.
Please post the schema for tbl:notices - specifically the datatype for
eventdate.

 Now trying to get the date more user friendly and tried:

 $query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M
%Y)FROM
 notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by
eventdate';
...
 When I echo ($eventdate) I get nothing. Not even an error.


The problem is that

$eventdate = $row[eventdate];

(which doesn't need the  around the whole of the RHS (some would put
them around eventdate), BTW)
doesn't tie up with:

DATE_FORMAT(eventdate, %D %M %Y)

Recommend you change them to:

DATE_FORMAT(eventdate, %D %M %Y) AS evdt
and
$eventdate = $row[evdt];

See how the SQL and PHP tie together?
Now you need to reconsider the other $row[] assignments.

=Keep it coming!
=dn


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




[PHP-DB] Re: OCIRowCount for a BEGIN...END block

2002-04-17 Thread John Lim

Hi Pedro,

There is the PL/SQL SQL%ROWCOUNT variable. Bind a PHP variable to it.


Pedro Garre [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 *This message was transferred with a trial version of CommuniGate(tm) Pro*
 Hi,

 OCIRowCount does not seem to work when inserts are made in a block:
 BEGIN insert ...; insert ...; insert ...; END;

 It returns 1, but 3 rows have actually been inserted.

 How can I get the correct number of rows inserted ?

 Thanks.

 Pedro.



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




[PHP-DB] Re: [PHP] Re: Cross DB application

2002-04-17 Thread John Lim

Hi Manuel,

Manuel Lemos [EMAIL PROTECTED] wrote

 Most of the popular database abstraction packages support prepared
 queries, except for your PHP ADODb. So, think about this before you keep
 throwing sand to the eyes of the users that do not know better, may be
 you understand the point of catching up on what everybody else is doing
 for a long time.

If you read the ADOdb source, you would know it is untrue. We support
prepared queries, and emulate them if the database does not support it.

 The reason for this is that you had the dumb idea to spam all the lists
 you could remember with the forged claim that ADODB was faster than
 every other database abstraction because your convinient benchmarks
 showed that.

Tomas Cox rewrote PEAR DB after the benchmarks were published to speed
it up. We even worked together to improve bits of PEAR DB. You just moan
about how unfair the benchmarks are.


 Since your database abstraction could not beat others on real
 abstraction features you used that to drag users to your package to push
 them the commercial tool that you sell and requires ADODB to run.


Visit http://php.weblogs.com/adodb-cool-applications for a long list of
applications using adodb with multiple databases. None of the apps
except the first link use our commercial product, phpLens.

 I think that pretty much refutes your statement.

 That was the lowest Microsoft-like marketing trick - trap them into your
 Windows clone database abstraction OS to sell them your tool for which
 you have no competitor because nobody else is doing anything like that
 for your own abstraction later.


I interviewed to work at microsoft in 1989, but as a techie, i would have
made microsoft bankrupt if they had let me run their marketing for them :-)

 Of course you may claim ADODB is faster than any other abstraction
 package, but that's because it does not abstract data type conversion to
 make user applications portable.


Actually it does, but only for dates, because I find that most other types
can be easily handled because PHP is a very good language. Char and
varchar and numbers map easily to string and float/integer, and so forth.

I have told you this before.

 It is the same as stating that driving a motocycle naked and without
 helmet you will drive faster than clothed with the helmet on. It is not
 the same thing, but unfortunately for the victim users that have fallen
 for your argument they did not notice that your abstraction can only be
 faster by doing less, meaning providing less portability support.


Of course. Unneeded portability that is not used by most users
is of no interest to me. You disagree. That is fine. The code is there
for people to read. Let them judge for themselves.

 John, as a marketeer you still have a lot to learn before you realize
 that you can't fool everybody!

 Next you will release ADODB XP the one that makes hidden connections to
 your site to track what the users are doing! hehehe :-)

 Don't worry, nobody will sue you for the abusing the monopoly of
 applications for your PHP ADO DB! :-)

 Manuel Lemos

Manuel, you might not believe me, but what you are saying will make people
shy away from working with you in the future. Treating people with respect
is more
productive. I don't really want to spend my time defending myself when I can
be doing something else.

So I leave this thread to you and to you alone. The floor is yours.
Keep it clean.

John



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




Re: [PHP-DB] Adding up the RESULT

2002-04-17 Thread Jason Wong

On Thursday 18 April 2002 00:08, Joel Colombo wrote:
 i was wondering about a PHP function like mysql_fetch_array
 but that would select all the ROW values of one FIELD
 rather the  mysql_fetch_array selecting all FIELDS of ONE row.

 does PHP have that function ?

Not yet.

 basically y do i need that ?

You don't :)

 because i am selecting a number of rows from my table from 1 to 35000 at a
 time
 i need the SUM of one field based on the ROWS selected
 but... no GROUP BY because the table has 2 fields: index, and fieldname

Why not do it in the database?

  SELECT SUM(price) FROM products;

 i have also posted this question in mailing.database.mysql but the traffic
 in that group has been too light...
 and posted to alt.php.sql but i will take any suggestions from any group on
 this one...

How about the MySQL mailing list?


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


/*
MSDOS didn't get as bad as it is overnight -- it took over ten years
of careful development.
(By [EMAIL PROTECTED])
*/

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




Re: [PHP-DB] OCIRowCount for a BEGIN...END block

2002-04-17 Thread Thies C. Arntzen

On Wed, Apr 17, 2002 at 01:03:49PM -0500, Pedro Garre wrote:
 *This message was transferred with a trial version of CommuniGate(tm) Pro*
 Hi,
 
 OCIRowCount does not seem to work when inserts are made in a block:
 BEGIN insert ...; insert ...; insert ...; END;
 
 It returns 1, but 3 rows have actually been inserted.
 
 How can I get the correct number of rows inserted ?

no idea. ocirowcount mappes 1 to 1 to the underlying oci
call. read the oracle-docs, if you find a way to get your
desired count back, i'd be glad to implement it in PHP.

re,
tc

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




Re: [PHP-DB] Adding up the RESULT

2002-04-17 Thread Joel Colombo

ok i thought the SUM only worked with GROUP BY
shit...

that makes me feel stupid but smarter now
thanx

Joel


Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 On Thursday 18 April 2002 00:08, Joel Colombo wrote:
  i was wondering about a PHP function like mysql_fetch_array
  but that would select all the ROW values of one FIELD
  rather the  mysql_fetch_array selecting all FIELDS of ONE row.
 
  does PHP have that function ?

 Not yet.

  basically y do i need that ?

 You don't :)

  because i am selecting a number of rows from my table from 1 to 35000 at
a
  time
  i need the SUM of one field based on the ROWS selected
  but... no GROUP BY because the table has 2 fields: index, and fieldname

 Why not do it in the database?

   SELECT SUM(price) FROM products;

  i have also posted this question in mailing.database.mysql but the
traffic
  in that group has been too light...
  and posted to alt.php.sql but i will take any suggestions from any group
on
  this one...

 How about the MySQL mailing list?


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


 /*
 MSDOS didn't get as bad as it is overnight -- it took over ten years
 of careful development.
 (By [EMAIL PROTECTED])
 */



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




[PHP-DB] What is mysql error 28?

2002-04-17 Thread Leif K-Brooks

I have a website which has, among other things, virtual items.  The items
are stored in table items, the different types of items in item_types.  I
use the following query to get a user's items:
SELECT DISTINCT t1.id,t1.itemtype,t2.name FROM items as t1,item_types as t2
WHERE (t1.itemtype = t2.id AND t1.owner = '$theirrealinfo[username]' AND
t1.placein='inventory')


A few minutes ago, items mysteriosly started getting then followowing error
from mysql_error(): Got error 28 in table handler.  Thanks to anyone who
can help!
P.S. They just started working again.  I'm still sending this because I want
to know what was wrong.  Thanks again! 



RE: [PHP-DB] What is mysql error 28?

2002-04-17 Thread Gurhan Ozen

Hi Leif,
Anytime you get an MySQL error code number use perror program to see what it
is..

[root@atsiz /root]# perror 28
Error code  28:  No space left on device

It seems like you don't have enough space to write to your table.
Gurhan


-Original Message-
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 1:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] What is mysql error 28?


I have a website which has, among other things, virtual items.  The items
are stored in table items, the different types of items in item_types.  I
use the following query to get a user's items:
SELECT DISTINCT t1.id,t1.itemtype,t2.name FROM items as t1,item_types as t2
WHERE (t1.itemtype = t2.id AND t1.owner = '$theirrealinfo[username]' AND
t1.placein='inventory')


A few minutes ago, items mysteriosly started getting then followowing error
from mysql_error(): Got error 28 in table handler.  Thanks to anyone who
can help!
P.S. They just started working again.  I'm still sending this because I want
to know what was wrong.  Thanks again!


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




RE: [PHP-DB] Re: [PHP] Re: Cross DB application

2002-04-17 Thread SP

There must be people on this list that have ported their web apps from
different databases and could share their experiences.

mysql - postesql
mysql - ms sql server
ms sql server - oracle



-Original Message-
From: John Lim [mailto:[EMAIL PROTECTED]]
Sent: April 17, 2002 12:38 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Re: [PHP] Re: Cross DB application


Hi Manuel,

Manuel Lemos [EMAIL PROTECTED] wrote

 Most of the popular database abstraction packages support prepared
 queries, except for your PHP ADODb. So, think about this before you keep
 throwing sand to the eyes of the users that do not know better, may be
 you understand the point of catching up on what everybody else is doing
 for a long time.

If you read the ADOdb source, you would know it is untrue. We support
prepared queries, and emulate them if the database does not support it.

 The reason for this is that you had the dumb idea to spam all the lists
 you could remember with the forged claim that ADODB was faster than
 every other database abstraction because your convinient benchmarks
 showed that.

Tomas Cox rewrote PEAR DB after the benchmarks were published to speed
it up. We even worked together to improve bits of PEAR DB. You just moan
about how unfair the benchmarks are.


 Since your database abstraction could not beat others on real
 abstraction features you used that to drag users to your package to push
 them the commercial tool that you sell and requires ADODB to run.


Visit http://php.weblogs.com/adodb-cool-applications for a long list of
applications using adodb with multiple databases. None of the apps
except the first link use our commercial product, phpLens.

 I think that pretty much refutes your statement.

 That was the lowest Microsoft-like marketing trick - trap them into your
 Windows clone database abstraction OS to sell them your tool for which
 you have no competitor because nobody else is doing anything like that
 for your own abstraction later.


I interviewed to work at microsoft in 1989, but as a techie, i would have
made microsoft bankrupt if they had let me run their marketing for them :-)

 Of course you may claim ADODB is faster than any other abstraction
 package, but that's because it does not abstract data type conversion to
 make user applications portable.


Actually it does, but only for dates, because I find that most other types
can be easily handled because PHP is a very good language. Char and
varchar and numbers map easily to string and float/integer, and so forth.

I have told you this before.

 It is the same as stating that driving a motocycle naked and without
 helmet you will drive faster than clothed with the helmet on. It is not
 the same thing, but unfortunately for the victim users that have fallen
 for your argument they did not notice that your abstraction can only be
 faster by doing less, meaning providing less portability support.


Of course. Unneeded portability that is not used by most users
is of no interest to me. You disagree. That is fine. The code is there
for people to read. Let them judge for themselves.

 John, as a marketeer you still have a lot to learn before you realize
 that you can't fool everybody!

 Next you will release ADODB XP the one that makes hidden connections to
 your site to track what the users are doing! hehehe :-)

 Don't worry, nobody will sue you for the abusing the monopoly of
 applications for your PHP ADO DB! :-)

 Manuel Lemos

Manuel, you might not believe me, but what you are saying will make people
shy away from working with you in the future. Treating people with respect
is more
productive. I don't really want to spend my time defending myself when I can
be doing something else.

So I leave this thread to you and to you alone. The floor is yours.
Keep it clean.

John



--
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] Dates in MYSQL

2002-04-17 Thread Alex Francis

Tried the following as suggested - Still no dates showing

$query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M %Y)as
evdt FROM notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by
eventdate';


$result=mysql_db_query($dbname, $query, $link);

if (!$result) { echo( mysql_error()); }
else


while ($row = mysql_fetch_array($result))


$entername = $row[entername];
$eventdate = $row[evdt];
$eventheading = $row[eventheading];
$id = $row[id];

Database table notices as follows
id int  NULL autoincrement
entername text   NOT NULL
enterdate text   NOT NULL
eventdate text   NOT NULL
eventheading text   NOT NULL
eventbody text   NOT NULL




--
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.
Dl Neil [EMAIL PROTECTED] wrote in message
0b8401c1e62e$03072ad0$0600a8c0@jrbrown">news:0b8401c1e62e$03072ad0$0600a8c0@jrbrown...
 Hi Alex,

  Got my select statement to work as follows:
  $query = ' SELECT * FROM notices WHERE TO_DAYS(eventdate) =
 TO_DAYS(now())
  order by eventdate';

 =well done!
 However the TO-DAYS calls do seem a bit OTT.
 Please post the schema for tbl:notices - specifically the datatype for
 eventdate.

  Now trying to get the date more user friendly and tried:
 
  $query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M
 %Y)FROM
  notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by
 eventdate';
 ...
  When I echo ($eventdate) I get nothing. Not even an error.


 The problem is that

 $eventdate = $row[eventdate];

 (which doesn't need the  around the whole of the RHS (some would put
 them around eventdate), BTW)
 doesn't tie up with:

 DATE_FORMAT(eventdate, %D %M %Y)

 Recommend you change them to:

 DATE_FORMAT(eventdate, %D %M %Y) AS evdt
 and
 $eventdate = $row[evdt];

 See how the SQL and PHP tie together?
 Now you need to reconsider the other $row[] assignments.

 =Keep it coming!
 =dn




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




Re: [PHP-DB] Dates in MYSQL

2002-04-17 Thread Mike

Alex,

 enterdate text   NOT NULL
 eventdate text   NOT NULL

First, I think I would change the above to a date or datetime or one of the
other date  time fields used by mysql instead of text fields.

Second  I don't think you really need to use TO DAYS and now. This is what I
do.

use php date function to get the current date,

$todaysdate = date(Ymd);

then do the query,

$query = SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M %Y) as
evdt FROM notices WHERE eventdate = $todaysdate ORDER BY
eventdate;




Mike
- Original Message -
From: Alex Francis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, April 17, 2002 5:26 PM
Subject: Re: [PHP-DB] Dates in MYSQL


 Tried the following as suggested - Still no dates showing

 $query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M %Y)as
 evdt FROM notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by
 eventdate';


 $result=mysql_db_query($dbname, $query, $link);

 if (!$result) { echo( mysql_error()); }
 else


 while ($row = mysql_fetch_array($result))


 $entername = $row[entername];
 $eventdate = $row[evdt];
 $eventheading = $row[eventheading];
 $id = $row[id];

 Database table notices as follows
 id int  NULL autoincrement
 entername text   NOT NULL
 enterdate text   NOT NULL
 eventdate text   NOT NULL
 eventheading text   NOT NULL
 eventbody text   NOT NULL




 --
 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.
 Dl Neil [EMAIL PROTECTED] wrote in message
 0b8401c1e62e$03072ad0$0600a8c0@jrbrown">news:0b8401c1e62e$03072ad0$0600a8c0@jrbrown...
  Hi Alex,
 
   Got my select statement to work as follows:
   $query = ' SELECT * FROM notices WHERE TO_DAYS(eventdate) =
  TO_DAYS(now())
   order by eventdate';
 
  =well done!
  However the TO-DAYS calls do seem a bit OTT.
  Please post the schema for tbl:notices - specifically the datatype for
  eventdate.
 
   Now trying to get the date more user friendly and tried:
  
   $query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M
  %Y)FROM
   notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by
  eventdate';
  ...
   When I echo ($eventdate) I get nothing. Not even an error.
 
 
  The problem is that
 
  $eventdate = $row[eventdate];
 
  (which doesn't need the  around the whole of the RHS (some would put
  them around eventdate), BTW)
  doesn't tie up with:
 
  DATE_FORMAT(eventdate, %D %M %Y)
 
  Recommend you change them to:
 
  DATE_FORMAT(eventdate, %D %M %Y) AS evdt
  and
  $eventdate = $row[evdt];
 
  See how the SQL and PHP tie together?
  Now you need to reconsider the other $row[] assignments.
 
  =Keep it coming!
  =dn
 



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


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


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




[PHP-DB] odbc versions

2002-04-17 Thread Steve Cayford

Hi. I'm looking at compiling one of the odbc function sets into php on 
my Mac OSX machine (I eventually want to be able to talk to MAS90 on a 
Windows machine -- if that's feasible). I'm finding the ODBC situation a 
bit confusing though. Should I use iodbc or unixodbc? Any suggestions? 
And will a database driver for one work with the other or are they 
incompatible?

Thanks.

-Steve


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




Re: [PHP-DB] PHP and OCI NLS behaviour

2002-04-17 Thread Miguel Carvalho


 Or if that is not available for you to edit you could always try just
 executing a statement to alter the session once a database connection
 is established. This method is a little slower.

How slower? Very very slower? Can you give me an aproximation in seconds?

As you will have to
 execute the alter session statements every time you make the
 connection.

Ok.


 The SQL is something like:
 alter session set NLS_LANGUAGE = 'AMERICAN' NLS_TERRITORY = 'AMERICA'

Can i specify the characterset on the alter session?
Sorry for the question...but the Oracle docs that i have read, just say
what is the sintaxe.

Regards
Miguel Carvalho



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




Re: [PHP-DB] Dates in MYSQL

2002-04-17 Thread Alex Francis

Mike,

I have just tried it again (that was the first way I tried to do the query)
and get the error

Unknown column '$todaysdate' in 'where clause'


--
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.
Mike [EMAIL PROTECTED] wrote in message
001b01c1e658$6f483c00$[EMAIL PROTECTED]">news:001b01c1e658$6f483c00$[EMAIL PROTECTED]...
 Alex,

  enterdate text   NOT NULL
  eventdate text   NOT NULL

 First, I think I would change the above to a date or datetime or one of
the
 other date  time fields used by mysql instead of text fields.

 Second  I don't think you really need to use TO DAYS and now. This is what
I
 do.

 use php date function to get the current date,

 $todaysdate = date(Ymd);

 then do the query,

 $query = SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M %Y) as
 evdt FROM notices WHERE eventdate = $todaysdate ORDER BY
 eventdate;




 Mike
 - Original Message -
 From: Alex Francis [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, April 17, 2002 5:26 PM
 Subject: Re: [PHP-DB] Dates in MYSQL


  Tried the following as suggested - Still no dates showing
 
  $query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M
%Y)as
  evdt FROM notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by
  eventdate';
 
 
  $result=mysql_db_query($dbname, $query, $link);
 
  if (!$result) { echo( mysql_error()); }
  else
 
 
  while ($row = mysql_fetch_array($result))
 
 
  $entername = $row[entername];
  $eventdate = $row[evdt];
  $eventheading = $row[eventheading];
  $id = $row[id];
 
  Database table notices as follows
  id int  NULL autoincrement
  entername text   NOT NULL
  enterdate text   NOT NULL
  eventdate text   NOT NULL
  eventheading text   NOT NULL
  eventbody text   NOT NULL
 
 
 
 
  --
  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.
  Dl Neil [EMAIL PROTECTED] wrote in message
  0b8401c1e62e$03072ad0$0600a8c0@jrbrown">news:0b8401c1e62e$03072ad0$0600a8c0@jrbrown...
   Hi Alex,
  
Got my select statement to work as follows:
$query = ' SELECT * FROM notices WHERE TO_DAYS(eventdate) =
   TO_DAYS(now())
order by eventdate';
  
   =well done!
   However the TO-DAYS calls do seem a bit OTT.
   Please post the schema for tbl:notices - specifically the datatype for
   eventdate.
  
Now trying to get the date more user friendly and tried:
   
$query = ' SELECT id, eventheading, DATE_FORMAT(eventdate, %D %M
   %Y)FROM
notices WHERE TO_DAYS(eventdate) = TO_DAYS(now()) order by
   eventdate';
   ...
When I echo ($eventdate) I get nothing. Not even an error.
  
  
   The problem is that
  
   $eventdate = $row[eventdate];
  
   (which doesn't need the  around the whole of the RHS (some would put
   them around eventdate), BTW)
   doesn't tie up with:
  
   DATE_FORMAT(eventdate, %D %M %Y)
  
   Recommend you change them to:
  
   DATE_FORMAT(eventdate, %D %M %Y) AS evdt
   and
   $eventdate = $row[evdt];
  
   See how the SQL and PHP tie together?
   Now you need to reconsider the other $row[] assignments.
  
   =Keep it coming!
   =dn
  
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php


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




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




[PHP-DB] drop list inserts

2002-04-17 Thread Barry Rumsey

I have the following to pages( just testing them at the moment ):
? mysql_connect(host,,);
mysql_select_db(music);
echo form name='add_album' method='post' action='test-album-add.php';
$getlist = mysql_query(SELECT * FROM music_artist ORDER BY 
artist_name ASC);
echo  Artist Name : select name=\artist_name\\n;
while ($row = mysql_fetch_array($getlist)) {
echo 'option value='.$row[id].''.$row[artist_name]./option\n;
}
echo  /select\n;
echo brAlbum Name : input type='text' name='album' value='$album';
echo input type='submit' name='Submit' value='Submit';
echo /form;
?

and

?
include(../mainfile.php);
include(../header.php);
OpenTable();

  mysql_connect( host, ,  );
  mysql_select_db( xoops );

  $query_id = mysql_query(INSERT INTO music_album VALUES
(NULL, '$music_artist.id' ,'$album' ,NULL ,NULL));
  echo  $artist_name and $album has been added to the 
database.;
CloseTable();
include(../footer.php);
?

What I am trying to do is insert the id of the artist they selected in 
the first page into a second table. At the moment all I get is 0 
inserted instead of the artist id from page 1.

Could someone please point out what I'm doing wrong?

Thanks in advance.



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




RE: [PHP-DB] drop list inserts

2002-04-17 Thread Gurhan Ozen

Hi Barry,
First of all,
$query_id = mysql_query(INSERT INTO...);  is wrong. That line will just
assign the resultset of the whatever mysql_query() function returns to the
variable $query_id .. Get rid of $query_id and just have mysql_query(INSERt
INTO ); See: http://www.php.net/manual/en/function.mysql-query.php  for
this..
Second of all, in your INSERT INTO query you are trying to insert the value
of a variable called $music_artist.id which doesn't exist anywhere. I think
you meant to insert $artist_name instead???

Gurhan


-Original Message-
From: Barry Rumsey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 6:23 PM
To: php-db list
Subject: [PHP-DB] drop list inserts


I have the following to pages( just testing them at the moment ):
? mysql_connect(host,,);
mysql_select_db(music);
echo form name='add_album' method='post' action='test-album-add.php';
$getlist = mysql_query(SELECT * FROM music_artist ORDER BY
artist_name ASC);
echo  Artist Name : select name=\artist_name\\n;
while ($row = mysql_fetch_array($getlist)) {
echo 'option value='.$row[id].''.$row[artist_name]./option\n;
}
echo  /select\n;
echo brAlbum Name : input type='text' name='album' value='$album';
echo input type='submit' name='Submit' value='Submit';
echo /form;
?

and

?
include(../mainfile.php);
include(../header.php);
OpenTable();

  mysql_connect( host, ,  );
  mysql_select_db( xoops );

  $query_id = mysql_query(INSERT INTO music_album VALUES
(NULL, '$music_artist.id' ,'$album' ,NULL ,NULL));
  echo  $artist_name and $album has been added to the
database.;
CloseTable();
include(../footer.php);
?

What I am trying to do is insert the id of the artist they selected in
the first page into a second table. At the moment all I get is 0
inserted instead of the artist id from page 1.

Could someone please point out what I'm doing wrong?

Thanks in advance.



--
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] drop list inserts

2002-04-17 Thread Barry Rumsey

The $music_artist.id is the id from the first page. ( database = music , 
table = music_artist  id ). This is what I need, a drop down list of the 
artists in table 'music_artist'( I've got this), I want the id of the 
artist they selected in the drop list to be inserted into the 
table 'music_album' as $artist_id.

-Original Message-
From: Gurhan Ozen [EMAIL PROTECTED]
To: Barry Rumsey [EMAIL PROTECTED], php-db list php-
[EMAIL PROTECTED]
Date: Wed, 17 Apr 2002 19:02:52 -0400
Subject: RE: [PHP-DB] drop list inserts

 Hi Barry,
 First of all,
 $query_id = mysql_query(INSERT INTO...);  is wrong. That line will
 just
 assign the resultset of the whatever mysql_query() function returns to
 the
 variable $query_id .. Get rid of $query_id and just have
 mysql_query(INSERt
 INTO ); See: http://www.php.net/manual/en/function.mysql-query.php 
 for
 this..
 Second of all, in your INSERT INTO query you are trying to insert the
 value
 of a variable called $music_artist.id which doesn't exist anywhere. I
 think
 you meant to insert $artist_name instead???
 
 Gurhan
 
 
 -Original Message-
 From: Barry Rumsey [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, April 17, 2002 6:23 PM
 To: php-db list
 Subject: [PHP-DB] drop list inserts
 
 
 I have the following to pages( just testing them at the moment ):
 ? mysql_connect(host,,);
 mysql_select_db(music);
 echo form name='add_album' method='post'
 action='test-album-add.php';
 $getlist = mysql_query(SELECT * FROM music_artist ORDER BY
 artist_name ASC);
 echo  Artist Name : select name=\artist_name\\n;
 while ($row = mysql_fetch_array($getlist)) {
 echo 'option
 value='.$row[id].''.$row[artist_name]./option\n;
 }
 echo  /select\n;
 echo brAlbum Name : input type='text' name='album'
 value='$album';
 echo input type='submit' name='Submit' value='Submit';
 echo /form;
 ?
 
 and
 
 ?
 include(../mainfile.php);
 include(../header.php);
 OpenTable();
 
   mysql_connect( host, ,  );
   mysql_select_db( xoops );
 
   $query_id = mysql_query(INSERT INTO music_album VALUES
 (NULL, '$music_artist.id' ,'$album' ,NULL ,NULL));
 echo  $artist_name and $album has been added to the
 database.;
 CloseTable();
 include(../footer.php);
 ?
 
 What I am trying to do is insert the id of the artist they selected in
 the first page into a second table. At the moment all I get is 0
 inserted instead of the artist id from page 1.
 
 Could someone please point out what I'm doing wrong?
 
 Thanks in advance.
 
 
 
 --
 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