[PHP-DB] mysql select last year

2002-12-05 Thread Martin Allan Jensen
Hi all,

I have a little problem i know that you can help me with...

I have a mysql table
+--+
|  year  |   id  |
+
| 2002 |  11  |
| 2003 |  11  |
| 2004 |  11  |
| 2005 |  11  |
| 2001 |  12  |
| 2002 |  12  |
+-+-+

And then i have a loop that takes the year and value for each of them. But how can i 
check if there is for example a year for id 11 that is  than 2002

Thanks a LOT!

Regards,
Martin Allan Jensen



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




Re: [PHP-DB] Index on email or ID?

2002-12-05 Thread Peter Beckman
Something I used was this:

id | username | password | cookie_string

$foo = the id was rot13'ed then base64-encoded

$str = the cookie_string was an md5 hash generated at the time of registration

then a cookie was set:

setcookie(cookie_string,$foo.|.$str);

When the user returns, we checked for the cookie, and if it existed, split
on the |, de-crypted (haha) the ID, looked up the cookie_string in the
DB and saw if it matched.  If it did, it was pretty unlikely that it was
hacked so we logged them in.

Peter

On Wed, 4 Dec 2002, Jim wrote:

  Always, always, always use a value that has no other significance other
  than being a unique ID. Email addresses change and so do passwords, so
  those are poor choices for linking data. They are fine and good choices
  for login, but that's about the only thing they should be used for.

 I understand what your saying, but if I just use the ID, then it makes it
 extremely easy to login as another user, simply change the ID in your
 cookie. Atleast if I have email/password aswell it takes someone with access
 to the network and a sniffer to get the values.

 If a user changes his email and/or password, then the cookie gets updated,
 simple. I can't see that its that much of an issue. If we were talking about
 a credit card number or something else critical then I'd agree.

 Jim.


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


---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




Re: [PHP-DB] calling function on submit instead of going to a newscript

2002-12-05 Thread Peter Beckman
form action = script.php?f=myfunction
OR
form action = script.php
AND add a input type='hidden' name='f' value='myfunction'

if (!empty($_GET['f']) and is_callable($_GET['f'])) {
  $_GET['f']();
} else {
  echo No function.;
}

On Thu, 5 Dec 2002, Gavin Amm wrote:

 Hi,

 I'm using some form fields on a page to pick up existing data from a MySQL
 database, make any changes, and update the database when i hit submit.
 I've picked up the data ok, now i want to process the update...

 How do i call a function(?) on the same page rather than use another page
 through action=somescript.php?
 what i'd like to do (in seudo-code) is:

 form action=myfunction()
   ...
   input type=submit
 /form
 myfunction(){
   process update  send user back to homepage
 }


 cheers,
 Gav


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

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

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

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



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


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

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


---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




[PHP-DB] Parserproblem by cascading outputscript

2002-12-05 Thread Ruprecht Helms
Hi,

I've a parserproblem in the attached script.
The script should produce dynamicly a diagramm of a familybuilding.
In the part for the second generation I get a parsererror and I do not
find what is the problem.

Regards,
Ruprecht


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


Re: [PHP-DB] I got this idea...

2002-12-05 Thread Mark
Another option might be to list out the web sites that have paintball
products, and then use google's site: functionality to search fo a
product on each site. Store the results in a table or array, and
diplay then for the user.

So it would work like this:

User says find me the MegaBlaster5000.
You have a list of 20 sites that carry paintball equipment.
Use Google to find MegaBlaster5000 on site1, site2, etc. and store
the results in an array.
Display the contents of the array to users.

Unless you're willing to use a spider to search the other sites on a
regular basis, I'd say do it in realtime.

Mark

--- Ignatius Reilly [EMAIL PROTECTED] wrote:
 Well, we can only offer very general guidelines at this stage.
 
 What you can do is write a script that:
 - call all the URLs showing paintball prices (btw what is a
 paintball?)
 - extract the product name and price. this will require a specific
 REGEX for
 each URL called, and regular testing vs change of page design. the
 only
 difficult part is just this: writing and testing custom REGEXes.
 
 In fact, why not actually create a DB and run the script every
 night (or
 more often) as a scheduled task to update the DB?
 
 HTH
 Ignatius
 
 - Original Message -
 From: Mike Delorme [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, December 05, 2002 3:02 AM
 Subject: [PHP-DB] I got this idea...
 
 
  Hi!
 
  I am knew around here, and a newcomer to PHP, but I know enough.
 I have =
  this idea, and I have gone through all the ways that I know off
 to work =
  it, but they dont work. I am a paintball player and I get
 fustrated =
  because there are too many web sites out there that sell
 paintball =
  marker, and gear and things. I would like to take them all, let a
 client =
  search for a spacific thing, and have the search results come up
 with =
  the url to that product, and list them by price. Now, the
 not-so-easy =
  way would be to make a DB and put all the prices in and just list
 the by =
  price. Except that would be a very hard, time consuming work.
 And, I =
  would have to update the db often. I am sure there is an esyer
 way, but =
  I dont know what it is. Thanks for your help!
 
 
  Michael Delorme
  www.hybridfusion.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
 


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

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

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




RE: [PHP-DB] Special URL Verification String... PS

2002-12-05 Thread NIPP, SCOTT V (SBCSI)
Thanks for the responses.  I chose to use this method as it appears
to be the most simple and effective.  For anyone else I am also using the
substr function to cut the random string down to something more manageable
for the database.  Thanks again for the feedback.

-Original Message-
From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 4:45 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Special URL Verification String... PS


Hi

PS

I would use

$verify_string = md5(uniqid(rand()));

to generate a random identifier of the sort you are looking for

Peter

---
Excellence in internet and open source software
---
Sunmaia
Birmingham
UK
www.sunmaia.net
tel. 0121-242-1473
International +44-121-242-1473
---

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: 04 December 2002 22:07
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Special URL Verification String...


I am trying to implement an approval system that sends an e-mail to
a user for approval linking them back to a special URL that matches database
entries for a verification string.  The verification string sent via the
e-mail does not match that in the database and I am looking for help in
figuring out why.  Here is what generates the verification string:

$verify_string = $sbcuid;
for ($i = 0 ; $i  14; $i++) {
  $verify_string .= chr(mt_rand(32,126));
}

Here is what this results in inside the database table:

sn4265e~zD|W(XTMxO+

Here is what is sent in the e-mail:

sn4265e%7EzD%7CW%28XTMxO%22%2B

I know that I am doing something wrong here, but what.  Thanks in
advance.


Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.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] Parserproblem by cascading outputscript

2002-12-05 Thread Jason Wong
On Thursday 05 December 2002 23:06, Ruprecht Helms wrote:
 Hi,

 I've a parserproblem in the attached script.
 The script should produce dynamicly a diagramm of a familybuilding.
 In the part for the second generation I get a parsererror and I do not
 find what is the problem.

Get yourself an editor that does syntax highlighting (Vim is very good for 
this and is available for most platforms). That way you can see at a glance 
whether you have unbalanced quotes (both '  ), and you can easily check for 
match brackets (, {, [. You would have to manually check for missing ; 
though.

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


/*
FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #15
A:  The Royal Canadian Mounted Police.
Q:  What was the greatest achievement in taxidermy?
*/


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




RE: [PHP-DB] MSSQL Problems

2002-12-05 Thread Griffiths, Daniel
mssql_close() doesnt do anything when you use mssql_pconnect as this is a persistant 
connection. If you want to close the connection after you've finnished with it you 
should use mssql_connect() instead.
Hope this helps

-Original Message-
From: Tim Evans [mailto:[EMAIL PROTECTED]]
Sent: 05 December 2002 13:33
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MSSQL Problems


I've written a script that works perfectly for almost ten times, and then
stops being able to connect to the MSSQL server.  I imagine this has
something to do with me not properly closing my connection, and the server
having a maximum # of connections.

I'm calling both mssql_free_result() and mssql_close() after every query.
I'm using mssql_pconnect.

I would include sample code, but it does this whether I use code ripped
right from examples and docs or I write it myself.  It doesn't seem to
matter what database, or the type or amount of information I'm requesting.

Thanks for any help I get on this problem, it's driving me nuts.



-- 
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] Newline help...

2002-12-05 Thread NIPP, SCOTT V (SBCSI)
I must be stupid, because I cannot for the life of me figure out why
I am not getting newlines from some very simply 'echo' statements.  Here is
the portion of the code below, and I am getting everything run together on a
single line:

?php do { 
  echo $list['id-sys'] . \n;
  $sys = split('-', $list['id-sys']);
  echo $sys[1]\n;
  } while ($list = mysql_fetch_assoc($result));


I am truly stumped by this.  It is quite frustrating that something
as simple as a newline can misbehave.  I have been searching for this on the
PHP site, newsgroups, and in a couple of books I have and yet I am still
stumped.  Help please.  Thanks.
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



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




Re: [PHP-DB] MSSQL Problems

2002-12-05 Thread John Krewson
mssql_pconnect cannot be closed as you mentioned:
http://www.php.he.net/manual/en/function.mssql-pconnect.php

I am using this as well, calling MSSQL on a Windows box from PHP/Apache 
on Linux, and I am also getting some of the results you mentioned, 
although it behaves differently at different times so I'm sticking with 
it to tinker.

My advice would be to simply drop using mssql_pconnect and use 
mssql_connect.  You don't gain much in the way of speed by using 
mssql_pconnect and I have seen several people come away with varied 
results.  Your sys admin (or you if you do double duty) should be able 
to see if this is actually the case through SQL Server Enterprise 
Manager.  It should show the calling server, the PHP version, and that 
the connections are sleeping.  


Tim Evans wrote:

I've written a script that works perfectly for almost ten times, and then
stops being able to connect to the MSSQL server.  I imagine this has
something to do with me not properly closing my connection, and the server
having a maximum # of connections.

I'm calling both mssql_free_result() and mssql_close() after every query.
I'm using mssql_pconnect.

I would include sample code, but it does this whether I use code ripped
right from examples and docs or I write it myself.  It doesn't seem to
matter what database, or the type or amount of information I'm requesting.

Thanks for any help I get on this problem, it's driving me nuts.



 



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




Re: [PHP-DB] Newline help...

2002-12-05 Thread 1LT John W. Holmes
HTML doesn't render newlines, only BR. Look at your HTML source code and
the newlines are there.

or,

if you're on windows, use \r\n for newlines.

---John Holmes...

- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 11:28 AM
Subject: [PHP-DB] Newline help...


 I must be stupid, because I cannot for the life of me figure out why
 I am not getting newlines from some very simply 'echo' statements.  Here
is
 the portion of the code below, and I am getting everything run together on
a
 single line:

 ?php do {
   echo $list['id-sys'] . \n;
   $sys = split('-', $list['id-sys']);
   echo $sys[1]\n;
   } while ($list = mysql_fetch_assoc($result));


 I am truly stumped by this.  It is quite frustrating that something
 as simple as a newline can misbehave.  I have been searching for this on
the
 PHP site, newsgroups, and in a couple of books I have and yet I am still
 stumped.  Help please.  Thanks.
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.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] Newline help...

2002-12-05 Thread NIPP, SCOTT V (SBCSI)
Why does the documentation everywhere seem to imply that you can use
the typical newline character?  This is most confusing.  I seem code
examples all over the place using newlines.  Oh well, now I know.  Thanks.

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 10:34 AM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Newline help...


HTML doesn't render newlines, only BR. Look at your HTML source code and
the newlines are there.

or,

if you're on windows, use \r\n for newlines.

---John Holmes...

- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 11:28 AM
Subject: [PHP-DB] Newline help...


 I must be stupid, because I cannot for the life of me figure out why
 I am not getting newlines from some very simply 'echo' statements.  Here
is
 the portion of the code below, and I am getting everything run together on
a
 single line:

 ?php do {
   echo $list['id-sys'] . \n;
   $sys = split('-', $list['id-sys']);
   echo $sys[1]\n;
   } while ($list = mysql_fetch_assoc($result));


 I am truly stumped by this.  It is quite frustrating that something
 as simple as a newline can misbehave.  I have been searching for this on
the
 PHP site, newsgroups, and in a couple of books I have and yet I am still
 stumped.  Help please.  Thanks.
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.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] Newline help...

2002-12-05 Thread Ignatius Reilly
If you're on a Window$ system, try \r\n instead of \n

Ignatius

- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 5:28 PM
Subject: [PHP-DB] Newline help...


 I must be stupid, because I cannot for the life of me figure out why
 I am not getting newlines from some very simply 'echo' statements.  Here
is
 the portion of the code below, and I am getting everything run together on
a
 single line:

 ?php do {
   echo $list['id-sys'] . \n;
   $sys = split('-', $list['id-sys']);
   echo $sys[1]\n;
   } while ($list = mysql_fetch_assoc($result));


 I am truly stumped by this.  It is quite frustrating that something
 as simple as a newline can misbehave.  I have been searching for this on
the
 PHP site, newsgroups, and in a couple of books I have and yet I am still
 stumped.  Help please.  Thanks.
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.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] MSSQL Problems

2002-12-05 Thread Frank M. Kromann
Take a look at the documentation at
http://www.php.net/manual/en/function.mssql-close.php whhere it says
mssql_close() will not close persistent links generated by
mssql_pconnect().

connections created by mssql_pconnect() will only be closed when the PHP
process terminates.

- Frank

 I've written a script that works perfectly for almost ten times, and
then
 stops being able to connect to the MSSQL server.  I imagine this has
 something to do with me not properly closing my connection, and the
server
 having a maximum # of connections.
 
 I'm calling both mssql_free_result() and mssql_close() after every
query.
 I'm using mssql_pconnect.
 
 I would include sample code, but it does this whether I use code ripped
 right from examples and docs or I write it myself.  It doesn't seem to
 matter what database, or the type or amount of information I'm
requesting.
 
 Thanks for any help I get on this problem, it's driving me nuts.
 
 
 
 -- 
 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] reversing a date stamp

2002-12-05 Thread mike karthauser
I'm using the below code as the basis for a client updateable news section..
I have variable called date which is set in the db as TIMESTAMP(6). When I
print it i get the date in the reverse order YYMMDD. What would be the best
way to display it in reverse based on my code below?

Thanks..

snip

$result = mysql_query(SELECT * FROM news,$db);
if ($myrow = mysql_fetch_array($result)) {
// display list if there are records to display
do { 
printf(strong%s/strongbr\n, $myrow[title]);
printf(%s a href=\%s?id=%s\ class=\mailto\more /a [%s]p\n,
$myrow[summary], $_SERVER['PHP_SELF'], $myrow[id], $myrow[date]);
} while ($myrow = mysql_fetch_array($result));
} else { 
// no records to display
echo pSorry, no records were found!;
} 

/snip
-- 
Mike Karthauser 
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ


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




RE: [PHP-DB] reversing a date stamp

2002-12-05 Thread John W. Holmes
 I'm using the below code as the basis for a client updateable news
 section..
 I have variable called date which is set in the db as TIMESTAMP(6).
When I
 print it i get the date in the reverse order YYMMDD. What would be the
 best
 way to display it in reverse based on my code below?

Just use strrev() to reverse the string.

---John Holmes...
---Sometimes you get what you ask for. 



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




Re: [PHP-DB] test

2002-12-05 Thread Ignatius Reilly
Test successful. Congratulations.

Ignatius

You can't trust the Russians. They have no word for 'détente'.

- Original Message -
From: Art Chevalier [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 8:38 PM
Subject: [PHP-DB] test


 test



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

2002-12-05 Thread Art Chevalier
Hello,

I am pulling one column out of a MySQL table in an array.  I want to place
each element into a HTML table 4 rows across.  I am currently doing this
with the mysql_fetch_array() function. How can I pull out 4 array elements
in one pass through a while loop?

Thanks

Art Chevalier



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




[PHP-DB] NewB: Return New Record ID...

2002-12-05 Thread Doug Coning
Hi all,

How do I do this:

I need a PHP page that simply creates a blank record so that I have the
record's ID (which is automatically generated).  That same page then needs
to return the record ID back so that I know what the ID is.  I will later
allow that record's information to be populated based on the ID it first
returned.

How would I do this?

Thank you, thank you!

Doug Coning




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




RE: [PHP-DB] MySQL Array

2002-12-05 Thread Ryan Jameson (USA)
while ($ar = mysql_fetch_array($rs))
  echo trtd. $ar['field1']./tdtd.$ar['field2']./td/tr;


Make sense?

-Original Message-
From: Art Chevalier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Array


Hello,

I am pulling one column out of a MySQL table in an array.  I want to place
each element into a HTML table 4 rows across.  I am currently doing this
with the mysql_fetch_array() function. How can I pull out 4 array elements
in one pass through a while loop?

Thanks

Art Chevalier



-- 
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] NewB: Return New Record ID...

2002-12-05 Thread Ryan Jameson (USA)
mysql_insert_id if your using mysql

... most other ones you'll have to select max(id) from table after your insert.

 Ryan

-Original Message-
From: Doug Coning [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 2:04 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] NewB: Return New Record ID...


Hi all,

How do I do this:

I need a PHP page that simply creates a blank record so that I have the
record's ID (which is automatically generated).  That same page then needs
to return the record ID back so that I know what the ID is.  I will later
allow that record's information to be populated based on the ID it first
returned.

How would I do this?

Thank you, thank you!

Doug Coning




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

2002-12-05 Thread Art Chevalier
Yes that makes sense, but it is pretty much the same thing I was doing and
it's producing the same results.  Its basically putting the first element in
all 4 table cells.  The thing is...I am only selecting from one field.  Im
trying to get the 4 elements of the column with each pass.  So in essence I
am trying to get the pointer to move down the array 4 positions within one
pass through the loop.  If I had any kind of logicl skills I probably could
get it:)

Art

Ryan Jameson [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
while ($ar = mysql_fetch_array($rs))
  echo trtd. $ar['field1']./tdtd.$ar['field2']./td/tr;


Make sense?

-Original Message-
From: Art Chevalier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Array


Hello,

I am pulling one column out of a MySQL table in an array.  I want to place
each element into a HTML table 4 rows across.  I am currently doing this
with the mysql_fetch_array() function. How can I pull out 4 array elements
in one pass through a while loop?

Thanks

Art Chevalier



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

2002-12-05 Thread Aaron Wolski
Why don't you post the actual data you are pulling FROM the Db.. then
show HOW you want it formatted.

Might be better for us to give you a solution or something.

Aaron

-Original Message-
From: Art Chevalier [mailto:[EMAIL PROTECTED]] 
Sent: December 5, 2002 3:21 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Array

Yes that makes sense, but it is pretty much the same thing I was doing
and
it's producing the same results.  Its basically putting the first
element in
all 4 table cells.  The thing is...I am only selecting from one field.
Im
trying to get the 4 elements of the column with each pass.  So in
essence I
am trying to get the pointer to move down the array 4 positions within
one
pass through the loop.  If I had any kind of logicl skills I probably
could
get it:)

Art

Ryan Jameson [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
while ($ar = mysql_fetch_array($rs))
  echo trtd. $ar['field1']./tdtd.$ar['field2']./td/tr;


Make sense?

-Original Message-
From: Art Chevalier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Array


Hello,

I am pulling one column out of a MySQL table in an array.  I want to
place
each element into a HTML table 4 rows across.  I am currently doing this
with the mysql_fetch_array() function. How can I pull out 4 array
elements
in one pass through a while loop?

Thanks

Art Chevalier



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

2002-12-05 Thread 1LT John W. Holmes
I think he meant that he is only pulling one column, i.e. field1 with each
mysql_fetch_array and he wants that in four columns.

$c = 1;
echo tr;
while($ar = mysql_fetch_array($result))
{
  echo td{$ar['field1']}/td;
  if(($c % 4) == 0) { echo /trtr; }
}

You'll have to account for incomplete rows and clean up the output, but
hopefully that gives you an idea.

---John Holmes...

- Original Message -
From: Ryan Jameson (USA) [EMAIL PROTECTED]
To: Art Chevalier [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 3:05 PM
Subject: RE: [PHP-DB] MySQL Array


while ($ar = mysql_fetch_array($rs))
  echo trtd. $ar['field1']./tdtd.$ar['field2']./td/tr;


Make sense?

-Original Message-
From: Art Chevalier [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 12:44 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL Array


Hello,

I am pulling one column out of a MySQL table in an array.  I want to place
each element into a HTML table 4 rows across.  I am currently doing this
with the mysql_fetch_array() function. How can I pull out 4 array elements
in one pass through a while loop?

Thanks

Art Chevalier



--
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] ANNOUNCE: Metastorage object persistence API generator

2002-12-05 Thread Manuel Lemos
Hello,

Finally I made time to release a full blown application based on MetaL 
compiler persistence module.

Here is the release announcement that may also be found on the site:

http://www.meta-language.net/news-2002-12-05-metastorage.html

  _

Released Metastorage generator
Manuel Lemos, 2002-12-05 16:11:44 GMT

Metastorage is an application that is capable of generating
persistence layer APIs. It takes a component definition defined in the
Component Persistence Markup Language (CPML), a XML based format, and
generates classes and storage schemas in a given target programming
language.

Using CPML, developers can focus their efforts on the modeling of data
structures that hold the information and the relationships between the
entities that their applications deal with. Metastorage takes care of
generating all the necessary code to store and retrieve such data
structures from persistent storage containers like relational
databases.

The main goal of Metastorage is to drastically reduce the time to
develop applications that traditionally use on SQL based relational
databases.

The generated APIs consist of a sets of classes that provide an Object
Oriented interface to the objects of the classes modeled using CPML.

The generated APIs are also capable of installing the data schema in
the persistence container, which in the case of a relational database
is the set of tables that will hold the persistent objects. This
completely eliminates the need to write any SQL queries manually.
CPML is independent of the type of persistent container. This means
that while it can be used to model classes of persistent objects that
may be stored in relational databases, such objects may as well be
stored in other types of persistence containers.

For instance, if an application needs to move a directory of objects
with user information from a relational database to a LDAP server to
increase the application scalability, the same CPML component
definition would be used. Metastorage would then generate classes
objects that implement the same API for interfacing with a LDAP server
that is compatible with the API generated to interface with relational
databases. This make the migration process easier and with reduced
risks.

Another possible benefit of the persistence container independence of
the APIs generated by Metastorage, is the case where an application
may need to run in environments where a SQL based database server is
not available. In that case the same API could be generated to store
persistent objects in flat file databases or plain XML files.

For now, the current version of Metastorage only supports the
generation of PHP code based on the database independent Metabase API.
This means that it may also interface with PEAR::MDB database
abstraction layer using its built-in Metabase API wrapper. In
consequence, many types of relational databases are already supported.

Since this is the first release of Metastorage, there is plenty of
room for improvement in the possibilities of the generated persistence
APIs and the level of optimization of the generated code. In the
future it will be supported other languages besides PHP, other
database APIs besides Metabase and other persistence containers
besides relational databases.

Metastorage is based on MetaL compiler persistence module. Like MetaL,
Metastorage is Open Source and is distributed with BSD like software
license. Downloadable archives and documentation with an example of
component definition are available from the MetaL site.


--

Regards,
Manuel Lemos


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



[PHP-DB] ANNOUNCE: Metastorage object persistence API generator

2002-12-05 Thread Manuel Lemos
Hello,

Finally I made time to release a full blown application based on MetaL
compiler persistence module.

Here is the release announcement that may also be found on the site:

http://www.meta-language.net/news-2002-12-05-metastorage.html

   _

Released Metastorage generator
Manuel Lemos, 2002-12-05 16:11:44 GMT

Metastorage is an application that is capable of generating
persistence layer APIs. It takes a component definition defined in the
Component Persistence Markup Language (CPML), a XML based format, and
generates classes and storage schemas in a given target programming
language.

Using CPML, developers can focus their efforts on the modeling of data
structures that hold the information and the relationships between the
entities that their applications deal with. Metastorage takes care of
generating all the necessary code to store and retrieve such data
structures from persistent storage containers like relational
databases.

The main goal of Metastorage is to drastically reduce the time to
develop applications that traditionally use on SQL based relational
databases.

The generated APIs consist of a sets of classes that provide an Object
Oriented interface to the objects of the classes modeled using CPML.

The generated APIs are also capable of installing the data schema in
the persistence container, which in the case of a relational database
is the set of tables that will hold the persistent objects. This
completely eliminates the need to write any SQL queries manually.
CPML is independent of the type of persistent container. This means
that while it can be used to model classes of persistent objects that
may be stored in relational databases, such objects may as well be
stored in other types of persistence containers.

For instance, if an application needs to move a directory of objects
with user information from a relational database to a LDAP server to
increase the application scalability, the same CPML component
definition would be used. Metastorage would then generate classes
objects that implement the same API for interfacing with a LDAP server
that is compatible with the API generated to interface with relational
databases. This make the migration process easier and with reduced
risks.

Another possible benefit of the persistence container independence of
the APIs generated by Metastorage, is the case where an application
may need to run in environments where a SQL based database server is
not available. In that case the same API could be generated to store
persistent objects in flat file databases or plain XML files.

For now, the current version of Metastorage only supports the
generation of PHP code based on the database independent Metabase API.
This means that it may also interface with PEAR::MDB database
abstraction layer using its built-in Metabase API wrapper. In
consequence, many types of relational databases are already supported.

Since this is the first release of Metastorage, there is plenty of
room for improvement in the possibilities of the generated persistence
APIs and the level of optimization of the generated code. In the
future it will be supported other languages besides PHP, other
database APIs besides Metabase and other persistence containers
besides relational databases.

Metastorage is based on MetaL compiler persistence module. Like MetaL,
Metastorage is Open Source and is distributed with BSD like software
license. Downloadable archives and documentation with an example of
component definition are available from the MetaL site.


--

Regards,
Manuel Lemos


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




[PHP-DB] Re: [PEAR-DEV] ANNOUNCE: Metastorage object persistence API generator

2002-12-05 Thread Björn Schotte
* Manuel Lemos wrote:
 Here is the release announcement that may also be found on the site:

Where's the PEAR context within the marketing text?

-- 
35 Kundenportale mit 24.000 Nutzern erstellen.
Bei geringen Kosten und einer großen Anzahl an
Modulen (DMS, CMS, CRM, Community-Funktionen).
  Wie das geht? = mailto:[EMAIL PROTECTED]

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




[PHP-DB] mysql_use_result()

2002-12-05 Thread Qunfeng Dong
Hi, I was trying to do a simple equal join with two
tables (one has more than 2,500,000 records; the other
one has more than 34,000 records) on indexed
attributes. But it took a long time for MySQL to run
the join and eventually it returns a error msg Out of
memory... needed 8136 bytes). 

Then I used mysql --quick to run the same query and it
returns the results very fast. My question is: which
PHP function can I use to query the MySQL database in
the mysql --quick mode? That is which PHP functions
represents the mysql_use_result()? Thanks!

Qunfeng Dong 

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

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