Re: [PHP-DB] Database question

2002-08-20 Thread Ignatius Reilly

A really good starting-level textbook is Fabian Pascal's "Practical issues in database 
management". My warm recommendation.

It will give you a decent theoretical understanding as well as helping you designing 
your DB in order to avoid the most usual design mistakes. You will find there VERY 
important design stuff that you won't find in web tutorials.

Ignatius Reilly





  - Original Message - 
  From: Shiloh Madsen 
  To: [EMAIL PROTECTED] 
  Sent: Wednesday, August 21, 2002 1:34 AM
  Subject: [PHP-DB] Database question


  I was wondering if there were any good documents out there about good database 
design...I know the basics of creating tables, setting data types and such, and now i 
want to know how to use it to the best effect...generating logical, streamlined 
tables, etc. 

  As a side-related note, i have a few tables now that call for some data which could 
be quite lengthly, say 3-6 paragraphs worth of text. what would be the best data style 
and length for this kind of field?




Re: [PHP-DB] Charts...

2002-08-21 Thread Ignatius Reilly

AFAI, to make really nice, Excel-style, dynamical charts, the best way is to export 
your MySQL data into a SVG string (a XML document), which can be viewed directly by 
the client browser (at least with IE5+)
Someday MySQL will have a SELECT ... OUTPUT XML capability...

I am currently looking for SVG templates for making dynamical plot and line charts; I 
haven't found much on the web. Can anyone help?

Thanks

Ignatius Reilly




  - Original Message - 
  From: James Hatridge 
  To: PHP_DB 
  Sent: Wednesday, August 21, 2002 8:01 PM
  Subject: [PHP-DB] Charts...


  Hi all..

  I'm using SuSE 8.0, mysql, and PHP4. Is it possible to make charts with a 
  database? If so, how about a hint on it?

  Thanks

  JIM
  -- 
  Jim Hatridge
  Linux User #88484
  --
   BayerWulf
 Linux System # 129656
   The Recycled Beowulf Project
Looking for throw-away or obsolete computers and parts
 to recycle into a Linux super computer


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





Re: [PHP-DB] form validation question - regex not working

2002-08-21 Thread Ignatius Reilly

There is this cute suggestion in the Wrox PHP book:

/^.+@.+\\..+$/

Looks like a puzzle, but it works (almost) always.

Enjoy

Ignatius Reilly




  - Original Message - 
  From: DL Neil 
  To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
  Sent: Wednesday, August 21, 2002 10:04 PM
  Subject: Re: [PHP-DB] form validation question - regex not working


  Regarding the problem you are actually asking about:

  > > > if (empty($useremail) || !eregi("^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])
  > +\.
  > > > ([A-Za-z]{2,3})+$", $useremail))
  > > Notice the {2,3} which is supposed to limit the last part to 2 or 3
  > > letters, but I have been testing this and
  > > it allows as many letters as I put in there, but not 1 only.
  > > What's wrong?

  Please be aware that I use PCRE not POSIX, but IIRC the last phrase says:

  ([A-Za-z]{2,3})+$

  any upper or lower case letter,
  repeated twice or three times,
  and that appearing zero or more times, !!!???
  appearing at the end of the string.

  Remove the + immediately before the terminating $.

  Regards,
  =dn



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





Re: [PHP-DB] Indepth Tutorial... need help.

2002-09-03 Thread Ignatius Reilly

For a SQL tutorial, I would recommend that you get yourself a copy of Joe
Celko's "SQL for smarties".
Best investment I ever made. Everything you need to know is there.

Bon courage!


- Original Message -
From: "Matt Zur" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 03, 2002 3:08 PM
Subject: Re: [PHP-DB] Indepth Tutorial... need help.


> Right well that's what I'm asking I need a tutorial and haven't found a
> good one.
>
> -Matt
>
> Rasmus Lerdorf wrote:
> > Most of this stuff is actually just SQL and has little to do with PHP.
So
> > look for an SQL tutorial.  From the PHP side all you need to know is
> > mysql_connect(), mysql_select_db(), mysql_query() and
mysql_fetch_row().''
> >
> > All queries are sent to the database via mysql_query().  It doesn't
matter
> > to PHP if you are adding, deleting, modifying, searching, sorting,
> > filtering, or whatever.  You just put the SQL code in the mysql_query()
> > call.
> >
> > -Rasmus
> >
> > On Tue, 3 Sep 2002, Matt Zur wrote:
> >
> >
> >>Can someone point me in the direction of an online tutorial for php
> >>mysql that covers the following:
> >>
> >>- Teaches me how to use php to access mysql
> >>- Creating a db that is structured to be efficient
> >>- How to add, modify, and delete records in a database
> >>- How to search for records
> >>- How to filter records
> >>- How to sort records, by a certain field, alphabetical, descending etc.
> >>- Indexes - how to create them, how to keep the updated with changes in
> >>the db a beginners look to in-depth approach.
> >>
> >>Yes I've visited PHP.net, and mysql.com.  I need a dumbed down version
> >>that pretty much holds my hand and is very detailed.  I've searched the
> >>net for a while now, and all the tutorials I have found... although
> >>simple... they don't go in-depth and move on to more advanced features.
> >>
> >>Any help at all will be greatly appreciated.
> >>
> >>-Matt
> >>
> >>
> >>--
> >>Matt Zur
> >>[EMAIL PROTECTED]
> >>http://www.zurnet.com
> >>
> >>Need a Web Site??? - Visit... www.zurnet.com
> >>
> >>1997 - 2002 - 5th Anniversary!!!
> >>
> >>
> >>--
> >>PHP Database Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> >
>
>
> --
> Matt Zur
> [EMAIL PROTECTED]
> http://www.zurnet.com
>
> Need a Web Site??? - Visit... www.zurnet.com
>
> 1997 - 2002 - 5th Anniversary!!!
>
>
> --
> 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] One last step

2002-09-03 Thread Ignatius Reilly

Try

SELECT name, COUNT(*) AS nb
FROM mytable
GROUP BY name
ORDER BY nb DESC

Ignatius


"RClark" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello all,
>
>   I have a MySQL database with some 2 million rows in it. I am counting
all
> of the different names in one column. How to I get these to come out in
> descending order, with the most numbers of one event at the top and going
> down from there?
>
> Thanks in advance,
> Ron Clark
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
- Original Message -
From: "RClark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 03, 2002 4:27 PM
Subject: [PHP-DB] One last step


> Hello all,
>
>   I have a MySQL database with some 2 million rows in it. I am counting
all
> of the different names in one column. How to I get these to come out in
> descending order, with the most numbers of one event at the top and going
> down from there?
>
> Thanks in advance,
> Ron Clark
>
>
>
> --
> 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] Upload csv file into mysql

2002-09-04 Thread Ignatius Reilly

Hi Dr,

try:

LOAD DATA INFILE "myfile.csv" INTO TABLE mytable
FIELDS TERMINATED BY ","
LINES TERMINATED BY "\r\n" ;

of course, the structure of your CSV file must match exactly that of your
table.

hth

- Original Message -
From: "Dr. Indera" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 04, 2002 6:20 AM
Subject: [PHP-DB] Upload csv file into mysql


> Hello,
>
> Is there a way to upload data in a csv file into a mysql table?
>
> Thanks
> Indera
>
>
>
> --
> 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] Upload csv file into mysql

2002-09-04 Thread Ignatius Reilly

You have to create your CSV by escaping the real data commas (eg
"1\,250\,260") when creating your CSV file - \ usually works, but you can
choose sth else if you have "\" actual data characters (usually not
recommended!).

and add
ESCAPED BY "\" to your LOAD statement

HTH

Ignatius

- Original Message -
From: "Karel Pøíbramský" <[EMAIL PROTECTED]>
To: "Ignatius Reilly" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
"Dr. Indera" <[EMAIL PROTECTED]>
Sent: Wednesday, September 04, 2002 10:33 AM
Subject: RE: [PHP-DB] Upload csv file into mysql


> Hi this is very helpful to me
>
> what if i have TABLE (id_item, rate1, rate2, rate3, rate4)
>
> and
>
> CSV file like foll
>
> id_item,rate1,rate2
> 1,250,260
> 2,270,280
> 5,290,290
>
> ?
>
> thx kaja
>
>
>
> S prátelským pozdravem
> Karel Príbramský
> AbiaNet, s.r.o.-www.abianet.cz---
>
>
> -Original Message-
> From: Ignatius Reilly [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 04, 2002 9:51 AM
> To: [EMAIL PROTECTED]; Dr. Indera
> Subject: Re: [PHP-DB] Upload csv file into mysql
>
>
> Hi Dr,
>
> try:
>
> LOAD DATA INFILE "myfile.csv" INTO TABLE mytable
> FIELDS TERMINATED BY ","
> LINES TERMINATED BY "\r\n" ;
>
> of course, the structure of your CSV file must match exactly that of your
> table.
>
> hth
>
> - Original Message -
> From: "Dr. Indera" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, September 04, 2002 6:20 AM
> Subject: [PHP-DB] Upload csv file into mysql
>
>
> > Hello,
> >
> > Is there a way to upload data in a csv file into a mysql table?
> >
> > Thanks
> > Indera
> >
> >
> >
> > --
> > 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] Form question.......

2002-09-05 Thread Ignatius Reilly

Another way is to refresh the page everytime the user has filled a field in
and moves to another:





 
  function submit_field( i ) {
   document.myform.field_to_check.value = "field" + i  ;
document.myform.submit() ;
 }
 

The idea is that the "onchange" event is triggered when the user has input
something and moves her mouse cursor somewhere else in the form.
The javascript passes to the server the name of the field that is to be
checked server-side. Supposes you have a consistent naming convention for
fields, but you can easily adapt the js function ...

Still, Rodrigo's idea of server-side checking every field one at a time does
not seem much user-friendly to me. Better normally validate all POST-ed
fields server-side upon form submit.


- Original Message -
From: "Cal Evans" <[EMAIL PROTECTED]>
To: "Rodrigo" <[EMAIL PROTECTED]>; "PHP" <[EMAIL PROTECTED]>
Sent: Thursday, September 05, 2002 2:58 PM
Subject: RE: [PHP-DB] Form question...


> That's a toughie.  I've done it once where I used a small popup window
> (opening it with JavaScript) to go to the server, perform the query to
> retrieve the information, stuff it into a JavaScript array and then return
> the array to the calling page and close the window.
>
> It works but the user will see a small window pop-up.
>
> Other than that, it is possible to use a Java Applet to do it as well.
>
> HTH,
> =C=
>
> *
> * Cal Evans
> * The Virtual CIO
> * http://www.calevans.com
> *
>
>
> -Original Message-
> From: Rodrigo [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 04, 2002 7:30 PM
> To: PHP
> Subject: [PHP-DB] Form question...
>
>
> Hi, i have a question, it may be dumb, but i´m very new with php and
mysql,
> i need help.
>
>  how can i check a form when i change from one field to another I want
> make a condition.if the number i typed is allready in the database,
not
> just when i finish filling out the hole form...clickin in submit and then
> make the conditionshelp  heheheh
>
>
>
> --
--
> 
>  Rodrigo Corrêa
>  [EMAIL PROTECTED]
>
>
>
>   Obs: Sorry about the english, i´m from Brazil...so my english isn´t
> good
>
>
>
> --
> 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] caching and CREATE TEMPORARY TABLE SELECT ?

2002-09-07 Thread Ignatius Reilly

Hello,

I am designing a web application wherein several queries are very long to
perform (like 5 or 10 minutes) ; therefore it is crucial that I be able to
cache them; I am planning to recompute these queries in a nighttime batch
process (meaning I may have to use version 4.0 in production...)

My question:

I make extensive use of CREATE TEMPORARY TABLE t SELECT ..., where the heavy
query is the "SELECT ...", which is cached

I would like to be sure that the query starting by "SELECT" is retrieved
from the cache, even though it occurs inside a CREATE TEMPORARY TABLE t
statement?

Thanks for your help.

Ignatius



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




Re: [PHP-DB] php -> checkboxes -> mysql

2002-09-10 Thread Ignatius Reilly

Try something like this:

 
 >

(value is a dummy value - HTML will POST the name=value pair only if
checked.)

HTH

Ignatius

- Original Message -
From: "Chris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 11:03 PM
Subject: [PHP-DB] php -> checkboxes -> mysql


> Greetings,
>
> I am just starting with php and need some help/code example for
> setting checkbox values from mysql. My setup is the following:
>
> The mysql database holds data and checkbox values in respective columes.
> For example
>
> name address phone homeno workno pagerno
> Chris  555-1212 1 0 0
>
> 1 = checkbox should be checked
> 0 = checkbox should not be checked
>
> On the webpage side I would have name, address and phone number textboxes,
> and then 3 checkboxes for the "homeno", "workno" and "pagerno".
>
> When the page loads I would like to have the checkboxes be automatically
> checked or left uncheck based on the mysql query to the db. I do not want
> to do any grouping or anything, just query mysql for the homeno value, set
> it, then check the workno value, set it, etc..
>
> Any help is GREATLY appreciated.
> Chris
>
>
>
> --
> 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] Trying to speed up php output from mysql

2002-09-17 Thread Ignatius Reilly

Does your process hang or simply is too long? Perhaps the limiting factor is
not the writing speed, but a memory requirement problem.

Try to compute how long it should take:
- do your row processing after a SELECT ... LIMIT 1000 clause
- time how long it takes, and extrapolate

Then you will know.

Ignatius

- Original Message -
From: "Phin Pope" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 17, 2002 1:04 PM
Subject: [PHP-DB] Trying to speed up php output from mysql


> Hi,
>
> I've got a script that I've written that writes out a xml file from
> mysql via php.
>
> The file should contain 250,000 xml style records, but it takes so long
> to generate the file the process has to be stopped before complete.
>
> I can't use mysqldump because of some of the processing that is required
> on the fields after they are extracted.
>
> Is there a faster way to write to a file than fwrite() or any other
> bright ideas?
>
> Phin
>
>
> \\\___///
>\\  - -  //
> (  @ @  )
>  +oOOo-(_)-oOOo-+
>  | phin pope - [EMAIL PROTECTED]   |
>  |  Created for the benefit of all life |
>  | Web Development and Creative Insight |
>  | Webnetism   Tel: +44 1452 855222 |
>  +-Oooo-+
> oooO   (   )
>(   )) /
> \ ((_/
>  \_)
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.389 / Virus Database: 220 - Release Date: 16/09/2002
>
>
>
> --
> 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] joining 2 tables - help please..

2002-09-18 Thread Ignatius Reilly

Try:

SELECT C.category_name, SUM( IF( ISNULL( P.product_ID ),0, 1) ) AS total
FROM category AS C LEFT JOIN product AS P
ON C.category_ID = P.category_ID
GROUP BY C.category_ID

Ignatius

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 18, 2002 10:09 AM
Subject: [PHP-DB] joining 2 tables - help please..


> I have 2 tables as follows:
>
> product table
> | product_id  | name | category_id
> | 1| coffee| 2
> | 3| orange|1
> | 5| mango|1
> | 2| tea |2
>
> and
> category table
> |category_id | category_name |
> |2| drinks|
> |1| fruit   |
> |4| desert|
> |5| main  |
>
> I want to get how many product in each category using sql statement, but I
> keep getting NULL for the one that doesn;t have product link. I want to
get
> result from all category like this: drinks (2), fruit(2), desert(0),
> main(0).
> Help please...
>
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP-DB] SQL update help

2002-09-21 Thread Ignatius Reilly

When in doubt, bracket :

$sql = "UPDATE $table SET pages = '{$PHP_SELF}' WHERE session =
'{$holy_cow}'";

Less cute, but more readable.

Ignatius

- Original Message -
From: "Dave Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 21, 2002 2:07 AM
Subject: Re: [PHP-DB] SQL update help


> Jeffrey is right, but here's an easier way:
>
> $sql = "UPDATE $table SET pages = '$PHP_SELF' WHERE session =
'$holy_cow'";
>
> Be sure you use double-quotes to build the string (so that all variables
get interpolated) and single-quotes within. Any non-numeric value has to be
quoted for an SQL statement to work properly.
>
> Good luck!
>
> --Dave
>
> [EMAIL PROTECTED] wrote:
>
> >if you put quotes around the variable $PHP_SELF it should work...try
this.
> >
> >UPDATE $table SET pages = '".$PHP_SELF."' WHERE session = $holy_cow
> >
> >hth
> >
>
>
> --
> 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] Flush database

2002-09-27 Thread Ignatius Reilly

why not simply store the server time at log in in the DB after a successful
log in together with the IP address; and at the next log in request perform
a SQL time difference comparison?

Ignatius

- Original Message -
From: "wade" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 27, 2002 10:53 PM
Subject: [PHP-DB] Flush database


> I am storing IP addresses in a database, but after an hour has passed I
> want to delete all the IP addresses from that database. I want to do
> this based on the server time. Example.. Someone comes to my web page, I
> store their IP address in my database. So now I write a PHP script that
> says if that IP returns to my page within an hour, they can't view my
> page. If they come back after an hour has passed they can view the
> contents of that page. but only after an hour has passed.
>
> Can anyone help me with the syntax or functions that will clear the
> database after an hour of waiting has passed?
> Is this possible? Any suggestions, logic or any help on this matter will
> be greatly appreciated.
>
> Thank you
>
> --
> Should you have any questions, comments or concerns, feel free to call
> me at 318-338-2033.
>
> Thank you for your time,
>
> Wade Kelley, Design Engineer
> 
> Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
> Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
> Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.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] results of query

2002-10-07 Thread Ignatius Reilly

It depends what you want to do with it.

To display it in HTML, you can write them in a 2-D array: myarray[$i][$j],
where $i is the row nb and $j the column nb, and write two nested loops.

To export them to Access, CSV, ... you can issue your query through Access
ODBC. You can then save as a CSV. Very simple and effective.

Ignatius

- Original Message -
From: "Edward Peloke" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 07, 2002 10:07 PM
Subject: [PHP-DB] results of query


> What does everyone typically use to display the results of a query.  For
> example, I have a database that has a series of subjects and grades.  If I
> select * from the table, I want a nice way for the data to be displayed.
In
> cold fusion, I can simply use a grid that dynamically fills in.  Can I do
> this with php?
>
> Thanks,
> Eddie
>
>
> --
> 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] Javascript

2002-10-11 Thread Ignatius Reilly

I have met this problem before.

The only solution I have found is to assign "0" values to the INPUT tags:


HTH
Ignatius

- Original Message - 
From: "Shahmat Dahlan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 11, 2002 11:34 AM
Subject: [PHP-DB] Javascript


> My question might have anything to do with PHP but I have the following 
> scenario:
> 
> Say I have four fields
> field1 : 
> field2 : 
> field3 : 
> field4 : 
> 
> And a total sum field, which is a total sum of the value of the 
> expression, totalsum = field1 + field2 + field3 + field4
> Total sum : XXX
> 
> You would need to use Javascript to extract the value of field1, field2, 
> field3, field4, initiated by the Javascript onChange event.
> 
> The HTML codes should look like this:
> 
> 
> 
> 
> 
> 
> So the add function snippet that I have:
> 
> function add()
> {
> var thisform=document.forms[0];
> var field1=thisform.field1.value;
> var field2=thisform.field2.value;
> var field3=thisform.field3.value;
> var field4=thisform.field4.value;
> var totalqty=field1+field2+field3+field4;
> thisform.totalsum.value=totalqty;
> }
> 
> But all I got is a NaN which means Not A Number. I understand that you 
> solve this by using the parseInt Javascript function.
> But still all i get is a NaN value.
> 
> Would appreciate if someone could help me out on this.
> 
> Regards
> 
> 
> -- 
> 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] Javascript

2002-10-11 Thread Ignatius Reilly

Thanks for the tip.

Well,
my problem came from that parseInt() did not do the expected job. Like in:
field1 = parseInt( thisform.field1.value ) + parseInt(
thisform.field2.value ) ;

If you happen to know the reason, I would love to know.

Ignatius

- Original Message -
From: "Simon Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 11, 2002 4:03 PM
Subject: RE: [PHP-DB] Javascript


> The reason for this is these fields are regarded as text and unless you
> specify number(variable) it may treat it as text.. When
> Field1='0'
> Field2='1'
> Field3='2'
>
> Field1+Field2+Field3 = '012'
>
> If you use
> Field1=Number('0')
> Field2=Number('1')
> Field3=Number('2')
>
> Field1+field2+field3 = 3
>
> Cheers
> Simon
>
> -Original Message-
> From: Ignatius Reilly [mailto:[EMAIL PROTECTED]]
> Sent: 11 October 2002 15:48
> To: Shahmat Dahlan; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Javascript
>
>
> I have met this problem before.
>
> The only solution I have found is to assign "0" values to the INPUT tags:
> 
>
> HTH
> Ignatius
> 
> - Original Message -
> From: "Shahmat Dahlan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 11, 2002 11:34 AM
> Subject: [PHP-DB] Javascript
>
>
> > My question might have anything to do with PHP but I have the
> > following
> > scenario:
> >
> > Say I have four fields
> > field1 : 
> > field2 : 
> > field3 : 
> > field4 : 
> >
> > And a total sum field, which is a total sum of the value of the
> > expression, totalsum = field1 + field2 + field3 + field4
> > Total sum : XXX
> >
> > You would need to use Javascript to extract the value of field1,
> > field2,
> > field3, field4, initiated by the Javascript onChange event.
> >
> > The HTML codes should look like this:
> > 
> > 
> > 
> > 
> > 
> >
> > So the add function snippet that I have:
> >
> > function add()
> > {
> > var thisform=document.forms[0];
> > var field1=thisform.field1.value;
> > var field2=thisform.field2.value;
> > var field3=thisform.field3.value;
> > var field4=thisform.field4.value;
> > var totalqty=field1+field2+field3+field4;
> > thisform.totalsum.value=totalqty;
> > }
> >
> > But all I got is a NaN which means Not A Number. I understand that you
> > solve this by using the parseInt Javascript function.
> > But still all i get is a NaN value.
> >
> > Would appreciate if someone could help me out on this.
> >
> > Regards
> >
> >
> > --
> > 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




Re: [PHP-DB] MySQL REGEXP functionality... any way to make this easier?

2002-10-13 Thread Ignatius Reilly

If you want to generalize the process to a n-set, a recursion method is
clearly required.

XSLT looks the best candidate to me to do this. I will tackle it when I find
some time.

Cheers
Ignatius

- Original Message -
From: "Xepherys" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 10, 2002 8:26 AM
Subject: [PHP-DB] MySQL REGEXP functionality... any way to make this easier?


> Right now, a sample query I might have would be...
>
> SELECT * FROM ospd WHERE word REGEXP '^([a]?[p]?[e]?)$|^[p]?[a]?[e]?$|^[a
> ]?[e]?[p]?$|^[p]?[e]?[a]?$|^[e]?[p]?[a]?$|^[e]?[a]?[p]?$';
>
>
> where basically I need to query every combination of a, p and e.  This is
a
> pain, but for only three letter is not so bad.  As you can see, this could
> become unruly with larger numbers of letters.  Each instance of a letter
can
> only occur once.  However, a letter may be duplicated and used once for
each
> instance.  Hence the statement steps through... it could also be something
> like...
>
> SELECT * FROM ospd WHERE word REGEXP
> '^[a]?[a]?[e]?$|^[a]?[e]?[a]?$||^[e]?[a]?[a]?$';
>
> more easily written because one letter is used twice and can occure once
for
> each instance.  Please let me know if you have any ideas.
>
>
> Jesse
> [EMAIL PROTECTED]
>
>
> --
> 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] desperate need for MySQL host

2002-10-15 Thread Ignatius Reilly

I know and use a very good one, if you can understand French: www.ovh.net

Free PHP, MySQL, XSLT support.

Ignatius

- Original Message -
From: "Seabird" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 15, 2002 9:46 PM
Subject: [PHP-DB] desperate need for MySQL host


> Hi everyone,
>
> as a pilot in difficult times, I'm not in the position to pay for my
> webhosting. My solution that I have right now is less then desirable, as I
> have either PHP support and no ads, or PHP and MySQL (limit one DB) with
> pop-up ads.
>
> I'm looking for a place that is willing to provide me with minimum space
to
> host 2 DB's with outside acces so that I can use it via my PHP provider.
No
> Warez, No Porn, No Illegal things. Just some airline and airport Db's.
>
> Pls, due to my situation, don't refer me to paid hosting (no matter how
> cheap).
>
> I appreciate the thought you put in.
>
> Jacco
>
> Attitude is Everything!
> But Remember, Attitudes are Contagious!
> Is Yours worth Catching
>
>
>
>
>
> --
> 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] Variable won't be passed from HTTP address bar

2002-10-18 Thread Ignatius Reilly
Try instead:

if( $_POST['action'] =="test" ){ echo "Test";}

HTH
Ignatius

- Original Message - 
From: "Michel Bakkenes - bakkenes.net" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 18, 2002 1:26 PM
Subject: [PHP-DB] Variable won't be passed from HTTP address bar


> Ok.. I'm not a newbie I thought.. I do have experience with PHP, but I
> never suffered from this error.
>  
> I used on my own redhat 8.0 server the following test-script:
>  
> if($action=="test"){ echo "Test";}
>  
> I tried it to run with: 127.0.0.1/index.php?action=test
>  
> It doesn't print anything. (which means I even can't print hello world
> :P)
>  
> Oh, other variable constructions like $bla = "blah" . echo $bla etc. do
> work.. 
>  
> With regards,
>  
> Michel Bakkenes
> J2ee developer
>  
> Infolook BV
> Zevenbergen, The Netherlands
> 


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




Re: [PHP-DB] Custom Sort Order in MySQL

2002-10-19 Thread Ignatius Reilly
You can use an auxiliary lookup table:

FK_mygraderank
-
Secret1
A+   2
...

Now join this table to your SELECT query on FK_mygrade, add 'rank' to the
SELECT items,
and ORDER BY rank

HTH
Ignatius

- Original Message -
From: "Steve Vernon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, October 19, 2002 9:46 PM
Subject: [PHP-DB] Custom Sort Order in MySQL


Hiya,
Just wondering what is the best way to get some data out of a database
in cutom order.

They all have grades like A*, A, B, C and some are grade Secret.

If I sort them by grade secret is at the bottom, I would like this at
the top. I realise I could get all the Secret's, then A*, then A as seperate
calls, but id prefer to get them all in the correct order as I belive this
will be faster.

Any help would be very much appreciated.

Thanks!

Steve


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




Re: [PHP-DB] Create Table with AutoIncrement-field in M$ AccessDB

2002-10-22 Thread Ignatius Reilly
What is your problem exactly?

Ignatius

- Original Message - 
From: "Jaap Aikema" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 22, 2002 11:58 AM
Subject: [PHP-DB] Create Table with AutoIncrement-field in M$ AccessDB


> I try to make a new table using PHP4 & M$ Access (via ADODB).
> This is the code I use:
> 
> //begin DB-connection to create table
> $db_connection = new COM("ADODB.Connection");
> $db_connstr = "driver={Microsoft Access Driver (*.mdb)}; DBQ=". 
> realpath("database.mdb") ." ;DefaultDir=". realpath("");
> $db_connection->open($db_connstr);
> 
> $table = "CREATE TABLE $pad (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
>   name TEXT(30),
>   email TEXT(30),
>   http TEXT(30),
>   icq TEXT(15),
>   message MEMO,
>   adddate TEXT(15),
>   ip TEXT(15),
>   location TEXT(35),
>   browser TEXT(55),
>   comment TEXT(255),
>   rating INT NOT NULL
>   )";
> $result = $db_connection->execute($table);
> $db_connection->Close();
> //end DB-connection to create table
> 
> when I delete the "AUTO_INCREMENT"-part, the table is created properly, 
> exept for the fact that the 'id' is NOT autoincrement.
> 
> Does anyone have a solution (or workaround)
> 
> Tnanx Aikie
> 
> 
> -- 
> 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] printing an array

2002-10-24 Thread Ignatius Reilly
Hi,

usually, one issues an HTML row for each row of the query result.
BTW, don't forget  elements!

But your query results has only one row, and your table has 4 columns.

Can you explain in more detail what you want to do?

Ignatius

- Original Message -
From: "Chris Grigor" <[EMAIL PROTECTED]>
To: "PHP Gen" <[EMAIL PROTECTED]>
Cc: "PHP DB" <[EMAIL PROTECTED]>
Sent: Thursday, October 24, 2002 10:07 AM
Subject: [PHP-DB] printing an array


> Hey there all
>
>
> Im sure that someone out there can answer this question..
>
> I have a problem, how can I print each element in an array so that is
> returned into a table?
>
>
> eg
>  
> Test1
> 
> 
> Test3
> 
> 
> Test4
> 
>
>  include("common.inc");
> $link_id = mysql_connect($dbhost, $username, $password)
> or die ("Connection Failed");
>
> mysql_select_db($db);
> $query = "select Routine_Tests_Count from CDT_Routine_Tests where Ref_num
=
> '$ref_num'
> order by Routine_Tests_Link;
>
> $result = mysql_query($query, $link_id)
> or die ("Query on $dbhost failed);
>
> while ($row = mysql_fetch_object($result)) {
> print "$row->CDT_Routine_Count";<---
(This
> value holds the Results of test1 test 2 etc
> that I need to print into the table)
> }
> mysql_free_result($result);
>
> ?>
> 
>
> Any help with this or direction would be appreciated !
>
> Regards
> Chris
>
>
>
> --
> Chris Grigor
> --
>
>
>
> --
> 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] Re: [PHP] Enum table entry

2002-10-19 Thread Ignatius Reilly
Hi,

in some cases, you might prefer to use a multiple  element; this can
give you a much more compact user interface (though you probably won't use
it if you have 40 options ...)

It goes like this:

  
--all--
conjuration
abjuration
...
divination
  

will pass an associative array $_POST['action'] ( "1" => "conjuration", ...,
"n" => "divination" )

Here I use the value "0" to select all - this calls a simple script to
generate the sequence "1,2, ...,n" that will be written into the DB. (In
general it is nice to provide a "all" checkbow when you have a long list.)

I use a set( '1','2', ..., 'n') MySQL datatype to store the thing. The data
appears physically as "1,2,...,n". Quite convenient. Probably a bit more
economical than storing a varchar (says the MySQL documentation ...)

HTH
Ignatius

- Original Message -
From: "John Nichel" <[EMAIL PROTECTED]>
To: "Tom Rogers" <[EMAIL PROTECTED]>
Cc: "Shiloh Madsen" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Saturday, October 19, 2002 9:15 AM
Subject: [PHP-DB] Re: [PHP] Enum table entry


> You know, I didn't even think about serializing the array.  I have a
> table set up for spells, one for schools, and a linking table using the
> spell id and the school id(s).  I could have done without the linking
> table.  Some of you people are pretty freakin' smart. :)
>
> One note though, when you pull the serialized data out, you may have to
> stripslashes before unserialize...
>
> $school = unserialize ( stripslashes ( $row['school'] ) );
>
> Tom Rogers wrote:
> > Hi,
> >
> > Saturday, October 19, 2002, 2:48:14 PM, you wrote:
> > SM> Have a question that im trying to figure out how to resolve. I have
a field type in mysql that is of the enum type. Unless youre familiar with
Dungeons and Dragons, you wont get what the values
> > SM> mean, but hopefully youll get the gist anyway. I have a column
labelled school which holds an enum data type comprised of the values 1
through 40. From the website front end, where the data is
> > SM> being entered, i want to display, ideally a series of checkboxes,
otherwise a list which would allow a user to select multiple items in that
will translate into this enum field. For instance, a
> > SM> series of checkboxes with items such as abjuration, conjuration,
divination, and others, which will all have a numeric value which gets
plugged into the enum field. for instance, if a user
> > SM> selected abjuration, and divination, it would be plugged into sql as
1, 3 (or however enum data is input into its column). That being the case
how do i utilize php to get this to work? what kind
> > SM> of form elements etc... The problem im seeing with checkboxes are
that they are discreet and dont group together, so i cant get all the data
to go into one column in mysql. Hopefully i havent
> > SM> horribly confused the issue and some kind soul out there can tell me
how to send this data across. As a double nice thing...how would you write
it to pull the data back out...ie, convert 1, 3 to
> > SM> show abjuration, divination? Thanks for the help in advance.
> >
> >  I have never used enum type but I am sure it is not what you want as
> >  it will only store one item from a predefined list not a list of
> >  items. What you need to do is create an array of the selected items,
> >  serialize() it to store in the database in a varchar or mediumtext if
> >  it going to get big. Then when you read it back unserialize and loop
> >  through all the options setting "checked" if it is in the array.
> >  To keep the checkboxes grouped name them like this:
> >  
> >  
> >  
> >
> >  That will show up as an array under $_POST['school']
> >  so you can serialize it as is and store it.
> >
> >   >  if(isset($_POST['school'])) $school = serialize($_POST['school']);
> >  ?>
> >
> >  Playback is simple too
> >
> >>   $school = unserialize($row['school']);
> >   for($i = 1;$i < 41;$i++){
> >  echo ' >  if(isset($school[$i])) echo ' checked';
> >  echo '>';
> >   }
> >
> >   Un-checked boxes are not returned in the post and checked ones
> >   return Yes I think.
> >
> >
> >
>
>
>
> --
> 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] Getting rows where column has changed?

2002-10-27 Thread Ignatius Reilly
How often in a day must you do this? Every 5mn?

Ignatius

- Original Message -
From: "Leif K-Brooks" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, October 27, 2002 7:33 AM
Subject: [PHP-DB] Getting rows where column has changed?


> I'm trying to make a page to help in detecting people using automatic
> refresher programs.  In the table that stores user info, there is a
> column called "lastseen" which says when the user was last seen.  I'm
> trying to:
> 1. Select all lastseen colmns that are less than 5 minutes old
> 2. Wait 2 seconds
> 3. Select lastseen columns that have changed since step 1, and display
> that info
> Any ideas on how to do this?  Is it even possible?  Thanks...
>
> --
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>
> --
> 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] Date and time issues

2002-11-04 Thread Ignatius Reilly
If you are using MySQL, you may profitably investigate the function
DATE_ADD( date, INTERVAL )

Ignatius J. Reilly

- Original Message -
From: "Frederik Feys" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 04, 2002 10:32 PM
Subject: [PHP-DB] Date and time issues


> Hi all,
> I searched for 5 hours, trying to solve my (newbie?) problem. I want to
pick
> today's date and add XXX days to it. Its setup to validate membership
> period. Now my column is of date type. Aswell, I want to pick current time
> and add 1 hour to it. Here aswell, sessions expire after one hour.
> Can anybody help me?
> Thanks
> Fred
> My code:
> $time = getdate();
>
> $yr = $time[year];
> $mn = $time[mon];
> $dy = $time[mday];
>
> if (subscr_type==1) { //these users van only work 1 hour
> $exp_time=time()+3600;
> $new_exp_day = getdate();
> }
> else if (subscr_type==3) { //3 months subscription(here time doesn't
really
> matter)
> $offset = 90;
> }
> else if (subscr_type==12) { //1 year subscriptions
>
> $offset = 365;
> }
>
> $new_exp_day = strftime("%Y-%m-%d",mktime(0,0,0,$mn,$dy+$offset,$yr));
>
> --
> Frederik Feys
>
> [EMAIL PROTECTED]
>
>
> --
> 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] Idea as to why this query won't work as expected?

2002-11-05 Thread Ignatius Reilly
AND/ OR precedence mistake. Your query will return all the rows for which
order_status='Not Shipped' 

Probably what you want is:

select * FROM OrderTable WHERE submitted=1 AND
dateinserted>='1036386000' AND dateinserted<='1036502796' AND
( order_status='Shipped' OR order_status='Not Shipped' )

HTH
Ignatius J. Reilly

- Original Message - 
From: "Aaron Wolski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 05, 2002 2:59 PM
Subject: [PHP-DB] Idea as to why this query won't work as expected?


> Hi All,
>  
> I have a query like:
>  
> select * FROM OrderTable WHERE submitted=1 AND
> dateinserted>='1036386000' AND dateinserted<='1036502796' AND
> order_status='Shipped' OR order_status='Not Shipped'
>  
>  
> Now.. if I omit the  "AND order_status='Shipped' OR order_status='Not
> Shipped'" part the query works fine and only returns 2 results (as
> expected). However, with the inclusion of the previous I get all the
> results (currently 8) returned.
>  
> It seems to be ignoring everything before "AND order_status='Shipped' OR
> order_status='Not Shipped'".
>  
> Any clues?
>  
> Much thanks!
>  
> Aaron
> 


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




Re: [PHP-DB] sort by date

2002-11-06 Thread Ignatius Reilly
Good point.

"Tell me and I forget, show me and I remember, involve me and I understand"

Ignatius

- Original Message -
From: "Snijders, Mark" <[EMAIL PROTECTED]>
To: "'Marco Tabini'" <[EMAIL PROTECTED]>; "Terry Romine"
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 4:22 PM
Subject: RE: [PHP-DB] sort by date


> why does everybody always gives the answers?? why not a hint, or where to
> search that they can learn something about it???
>
>
>
>
>
> -Original Message-
> From: Marco Tabini [mailto:marcot@;inicode.com]
> Sent: woensdag 6 november 2002 16:08
> To: Terry Romine
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] sort by date
>
>
> Ok, going out on a limb here... have you tried something like
>
> select e.id, title, location, address, contact, category, event_time,
> urllink, descript, min(event_date) from eventTable e inner join
> dateTable d on e.id = d.id group by e.id
>
> ?
>
>
> Marco
>
> --
> 
> php|architect - The magazine for PHP Professionals
> The first monthly worldwide  magazine dedicated to PHP programmer
>
> Come visit us at http://www.phparch.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] mysql_fetch_array() question

2002-11-06 Thread Ignatius Reilly
John is right. In fact one routinely calls two different $result(s) when
coding nested loops:
while( $details = mysql_fetch_array( $result ) ) {
while ( $Email = mysql_fetch_array( $result2 ) )
..
}
}

when executing the next instance of your loop:
while( $details = mysql_fetch_array( $result ) and $Email =
mysql_fetch_array( $result2 ) ),

each mysql_fetch_array will push both pointers (on your two result
resources) by one position.
if your result sets do not have the same number of rows, the shorter one
will choke before the longer one is finished. therefore you will finish the
loop not having called all results from the "long" resource.

My 0.02 Belgian francs
Ignatius

- Original Message -
From: "Josh Johnson" <[EMAIL PROTECTED]>
To: "'1LT John W. Holmes'" <[EMAIL PROTECTED]>; "'Graeme McLaren'"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 7:24 PM
Subject: RE: [PHP-DB] mysql_fetch_array() question


> :) see why I love mailing lists! :)
>
> It must have been their logic then, I respectfully retract everything I
> said, sorry Graeme! Why do I have to work, I could spend my days
> researching this stuff before I post!
>
> Thanks John!
> -- Josh
>
> -Original Message-
> From: 1LT John W. Holmes [mailto:holmes072000@;charter.net]
> Sent: Wednesday, November 06, 2002 1:21 PM
> To: Josh Johnson; 'Graeme McLaren'; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mysql_fetch_array() question
>
> That's not true. You can assign them to different variables and it works
> fine.
>
> $r1 = mysql_query("select * from main limit 1") or die(mysql_error());
> $r2 = mysql_query("select * from apft limit 1") or die(mysql_error());
>
> $row1 = mysql_fetch_array($r1);
> $row2 = mysql_fetch_array($r2);
>
> print_r($row1);
> echo "";
> print_r($row2);
>
> ---John Holmes...
>
> - Original Message -
> From: "Josh Johnson" <[EMAIL PROTECTED]>
> To: "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, November 06, 2002 1:02 PM
> Subject: RE: [PHP-DB] mysql_fetch_array() question
>
>
> > In my experience, (I haven't checked the docs just yet to figure out
> > exactly why), you can only work with one result id at a time. Every
> time
> > you call mysql_query, it resets the result id (I think it frees the
> > result id automatically so you can send another query before getting
> the
> > new result id), so even if you store it in two separate variables, it
> > will only refrence the last id (which sounds just like what happened
> in
> > your initial post). I think this is limited to a given connection, but
> > I'm not sure.
> >
> > One of the, I guess you could say, "shortcomings" of the mysql
> interface
> > in php is that you can only execute one query at a time, and I think
> > this odd result id overwrighting that happens is due to that fact (I
> > might be wrong, but I think you can execute multiple queries at a time
> > with perl's DBI module).
> >
> > I hope that makes more sense :)
> >
> > -- Josh
> >
> > -Original Message-
> > From: Graeme McLaren [mailto:mickel@;ntlworld.com]
> > Sent: Wednesday, November 06, 2002 12:17 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] mysql_fetch_array() question
> >
> > Josh, Thank you for reply.  Thank you to everyone else who replied to
> my
> > email also.  I solved the problem shortly after posting my question,
> > I've
> > now got a massive SQL query which does the trick.
> >
> > I was interested when you replied and part of it read:  "Just
> > remember that you can only work with one mysql result per connection
> at
> > a time".  Can you explain a little more about that please?  I don't
> > think I
> > fully understand what you mean.
> >
> > Cheers,
> >
> > Graeme :)
> >
> > - Original Message -
> > From: "Josh Johnson" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, November 06, 2002 12:29 PM
> > Subject: RE: [PHP-DB] mysql_fetch_array() question
> >
> >
> > > I concur with Jason, but if restructuring is out of the question,
> just
> > > rearrange your queries like this:
> > >
> > > $query = "SELECT Name, Address FROM users";
> > > $result = mysql_query($query);
> > > while($details = mysql_fetch_array($result)){
> > > echo "Name: $details[Name]";
> > > echo "Address: $details[Address]";
> > > }
> > > $query2 = "SELECT EmailAddress From Members";
> > > $result2 = mysql_query($query2);
> > > while($details = mysql_fetch_array($result2)){
> > > echo "Email: $Email[EmailAddress]";
> > > }
> > >
> > > The results won't come out at the same time, but you could use some
> > > logic to combine the results into an array by a common factor. Just
> > > remember that you can only work with one mysql result per connection
> > at
> > > a time. You *may* (untested!) be able to accomplish what you want to
> > do
> > > with two separate connections, but again, this is seriously
> overkill.
> > :)
> > >
> > > I'd def

Re: [PHP-DB] Structure Question...

2002-11-07 Thread Ignatius Reilly
You have to create a table:
CREATE TABLE product_categ (
FK_productID ,
FK_categID 
)
and list all relationships "productID belongs to categID"

Ignatius

- Original Message -
From: "Doug Coning" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 07, 2002 7:51 PM
Subject: [PHP-DB] Structure Question...


> Hi everyone,
>
> I'd like to know how you would set up the following:
>
> I've set up a MySQL database with 600 products.  I set it up where each
> product belongs to a category.  However, now we want to take it further
> where different products can now belong to more than 1 category.
>
> How would you create this?
>
> 1. Would you duplicate the records for items that belong to more than 1
> category and change the categories in those duplicated records?
>
> 2. Would you enter multiple categories into 1 column?
>
> 3. Would you create a different database that tracks categories and creat
a
> many to many relationship?
>
> Thanks,
>
> 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] Polls?

2002-11-07 Thread Ignatius Reilly
One possibility:

table questions( questionID, question_text, ...) PRIMARY KEY( questionID)

table answers( FK_questionID, individualID, answer_code, ...) PRIMARY KEY(
FK_questionID, individualID)

For very simple online polls, there is a nice tutorial in Devshed:
http://www.devshed.com/Server_Side/PHP/PHPDemocracy

HTH
Ignatius

- Original Message -
From: "Leif K-Brooks" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 08, 2002 8:15 AM
Subject: [PHP-DB] Polls?


> I'm working on a polling system, and I'm having a bit of a problem.  I'm
> not sure how to store the questions.  Storing them in a seperate table
> would require a query for each poll displayed - not good.  I've also
> thought of storing them as a serialized array.  Any thoughts on this?
>
> --
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>
> --
> 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] Extracting column names from a db

2002-11-10 Thread Ignatius Reilly
A mix-up in your loop. Try:

while ( $row = mysql_fetch_array( $result ) ) {
echo $row['Field'] ;
}

(you may just as well use the field names provided by SHOW COLUMNS - more
readable than numerical indexes)

HTH
Ignatius

- Original Message -
From: "David Rice" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 10, 2002 4:18 PM
Subject: [PHP-DB] Extracting column names from a db


>
>
> I need to write a script that will extract the names of the columns in my
> database eg. "user_id, username" can anyone help as to how to do this!
>
> I have tried
>
> **
> ***
> mysql_select_db("filterseveuk") or die(mysql_error());
>
> $query = "SHOW COLUMNS FROM " .$table. "";
>
> $result = mysql_query ( $query ) or die( mysql_error () );
>
> $numrows = mysql_num_rows ($result);
>
> $row = mysql_fetch_array ($result);
>
> for($x=0; $x <= $numrows; $x++){
>
> echo $row[$x] ;
>
> }
> **
> ***
> this doesn't work the way i want it to and gives me the output
>
> **
> ***
> user_idint(11)PRIauto_increment
> Warning: Undefined offset: 6 in
> /home/filterseveuk/public_html/admin/index.php on line 30
>
> Warning: Undefined offset: 7 in
> /home/filterseveuk/public_html/admin/index.php on line 30
>
> Warning: Undefined offset: 8 in
> /home/filterseveuk/public_html/admin/index.php on line 30
>
> Warning: Undefined offset: 9 in
> /home/filterseveuk/public_html/admin/index.php on line 30
>
> Warning: Undefined offset: 10 in
> /home/filterseveuk/public_html/admin/index.php on line 30
>
> Warning: Undefined offset: 11 in
> /home/filterseveuk/public_html/admin/index.php on line 30
>
> Warning: Undefined offset: 12 in
> /home/filterseveuk/public_html/admin/index.php on line 30
>
> Warning: Undefined offset: 13 in
> /home/filterseveuk/public_html/admin/index.php on line 30
>
> Warning: Undefined offset: 14 in
> /home/filterseveuk/public_html/admin/index.php on line 30
>
>
>
>
>
>
>
>
> _
> Tired of spam? Get advanced junk mail protection with MSN 8.
> http://join.msn.com/?page=features/junkmail
>
>
> --
> 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] php array max value pr. year

2002-11-11 Thread Ignatius Reilly
Hi Martin,

I am sure that many would love to help you, but really you must explain your
problem more clearly! Can you give more details?

Ignatius

- Original Message -
From: "Martin Allan Jensen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 10:24 AM
Subject: [PHP-DB] php array max value pr. year


Hi evryonei have a problem that i hope you can help me with.

Here it goes!

I have two arrays one called "y" adn one called "v"
Togeather they hold a year(Y) and a value(V)

The array looks like this:

v:
10
20
40
60
320
780
890
920

y:
2002
2002
2002
2002
2002
2003
2003
2003

-

V represents a climping value
Y represents the year of the value


So  the values 10, 20, 40, 60, 320 etc. grows until a new year is reachet.
And then it schould start again in the new year.
So MAXIMUM ONE VALUE PER YEAR

How can i make it return this out of the earlier menchent array :

(Arrays)
Y:
2002
2003

V:
320
920

So much thanks peoplei tried now for two days and i just can't come up
with anything...

P.S. Sorry for my bad english!

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




Re: [PHP-DB] arrays & db

2002-11-11 Thread Ignatius Reilly
Why don't you want to do this with SQL?

Ignatius

- Original Message -
From: "Martin Allan Jensen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 2:48 PM
Subject: [PHP-DB] arrays & db


Okey people, i try again!!

I have a table in a mysql database that holds this:
+++++--+
| id | maaler | aflaest| vaerdi | pris |
+++++--+
| 21 | 11 | 2002-01-01 |  15160 | 0.00 |
| 22 | 11 | 2002-02-01 |  15180 | 0.00 |
| 23 | 11 | 2002-03-01 |  15200 | 0.00 |
| 24 | 11 | 2002-04-01 |  15240 | 0.00 |
| 25 | 11 | 2002-05-01 |  15250 | 0.00 |
| 27 | 10 | 2002-11-14 |210 | 0.00 |
| 30 | 10 | 2002-12-19 |230 | 0.00 |
+++++--+

Each "maaler" have it's own start registration witch is:
++--+---+
| id | nummer   | start |
++--+---+
| 10 | 56456|   200 |
| 11 | 02   | 15150 |
++--+---+

I then made a script that takes "start" for each "maaler" if it have any
registrations. Then it does this:
if its first field then it takes the "vaerdi"(THE VALUE) and - it with the
"start" (THE STARTREGISTRATION) For the next fields it takes the "vaerdi" -
the last "vaerdi". My problem is that after the script has ran it have lets
say 20 yeas 2002 (the registration year called "aflaest" in the table) and
lets say two 2003. I only need ONE value "vaerdi" per year, witch is the one
it just calculated in a loop. But it have all the values and years in the
array. How do i only take ONE value per year in PHP NOT SQL??

I really hope this is discriping enough!!

THANKS ALL!


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: [PHP-WIN] update tablename

2002-11-12 Thread Ignatius Reilly
You can not do it directly.

You have to create a new table as a copy of the old one:

CREATE TABLE new_table
SELECT * FROM old_table

Your problem will be that the MySQL "PHP" user will probably not have the
CREATE rights.

Ignatius

"Rodrigo San Martin" <[EMAIL PROTECTED]> wrote in message
news:20021112113152.9310.qmail@;pb1.pair.com...
> Hi.
> I want to change a tablename in my database. How do i do that? I want to
do
> it from a webpage so i need to use php.
>
>
>
>
>
> --
> Rodrigo San Martin
> Institutt for datateknologi og informatikk
>
> http://www.idi.ntnu.no/~rodrigo
>
>
>
>
> --
> PHP Windows 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] array sorting

2002-11-12 Thread Ignatius Reilly
Just loop through the first index, then search on the second index:

while ( list( $key, $value ) = each( $my_arr ) ) {

// now $value is your ( [0] => 10 [1] => 40 [2] => 50 [3] => 80 [4] =>
130 [5] => 220 [6] => 320 ) array
// sort your array by values
sort( $value ) ;
// get the last value
$last_value = array_pop( $value ) ;
// do something with this value...

}

But it seems to me there still misses a link between your two series of data
(years, values)

So try to get an array where keys are years, not numerical indexes?

HTH
Ignatius

- Original Message -
From: "Martin Allan Jensen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 12, 2002 1:37 PM
Subject: [PHP-DB] array sorting


Hi everyone...


I got a bit longer now..

But i have some trouble sorting my arrays

I get this array returned.

Array ( [0] => Array ( [0] => 10 [1] => 40 [2] => 50 [3] => 80 [4] => 130
[5] => 220 [6] => 320 ) [1] => Array ( [0] => 10 [1] => 40 [2] => 50 [3] =>
80 [4] => 130 [5] => 220 [6] => 320 [7] => 440 [8] => 570 ) [2] => )

I ain't good at it, but i guess this is a two dimesioned array...

The question is now,  i need to get the highest values of each "sub" array
witch would be 320 & 570 in THIS CASE ??

Thanks so much!!

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




Re: [PHP-DB] HTML Forms question...

2002-11-19 Thread Ignatius Reilly
Great piece of advice Mike. Thanks. Far from obvious. I was stuck with this
problem since a few days.

Will that also apply to n-dimensional array, like:
document.form["system[]"][0][1] ?

Ignatius

- Original Message -
From: "Ford, Mike [LSS]" <[EMAIL PROTECTED]>
To: "'Rich Gray'" <[EMAIL PROTECTED]>; "NIPP, SCOTT V (SBCSI)"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, November 19, 2002 7:35 PM
Subject: RE: [PHP-DB] HTML Forms question...


> > -Original Message-
> > From: Rich Gray [mailto:[EMAIL PROTECTED]]
> > Sent: 20 November 2002 01:13
> >
> > If you name the checkbox as name="system[]" then PHP will
> > automatically
> > create an array of the checkbox values which can be
> > subsequently accessed
> > via $_POST['system'][n] - be warned however that the '[]' can
> > screw up any
> > JavaScript code that refers to the checkbox object...
>
> G' -- not this old chestnut again!
>
> It only "screws up" your JavaScript if you don't write your JavaScript to
> allow for it.
>
> It's really very simple: *by* *definition* in JavaScript, the notation
>
> a.b
>
> is *identical* to
>
> a["b"]
>
> Thus, if you have a single checkbox named with name="system", then you can
> access it in either of these ways:
>
> document.form.system
> document.form["system"]
>
> By extension, if you have multiple checkboxes all named with
> name="system[]", you can refer to them as:
>
> document.form["system[]"][0]
> document.form["system[]"][1]
> document.form["system[]"][2]
>
> etc...
>
> I know this works because I've been using it for years (even before I
> started programming with PHP!).
>
> Cheers!
>
> Mike
>
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP-DB] $_get 2 variables

2002-11-19 Thread Ignatius Reilly
http://localhost/myscript.php?var1=blah&var2=blah2

Ignatius

- Original Message -
From: "Gavin Amm" <[EMAIL PROTECTED]>
To: "Php-Db (E-mail)" <[EMAIL PROTECTED]>
Sent: Wednesday, November 20, 2002 7:30 AM
Subject: [PHP-DB] $_get 2 variables


> Hi,
>
> I'm wanting to retrieve data from my database using 2 conditions in the
> WHERE clause.
> How do i pick up 2 different variables from the URL?
>
> i can get just 1 variable easily (eg:
> http://localhost/myscript.php?var1=blah)
> My question essentially is: what string do do i need to type into the URL
to
> pick up the 2 variables like this:
>   $var1 = $_GET['var1'];
>   $var2 = $_get['var2'];
>
> Do I need to start messing around with strings? or is there an easy way?
>
> Thanks,
> 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
>
>


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




Re: [PHP-DB] standart variabels melfunction

2002-11-19 Thread Ignatius Reilly
Martin,

what you are experiencing is the normal way to call form variables. There is
no problem.

You should use
register_globals=Off

whenever possible. better security.

Ignatius

- Original Message -
From: "Beau Lebens" <[EMAIL PROTECTED]>
To: "'Martin Allan Jensen'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 20, 2002 5:46 AM
Subject: RE: [PHP-DB] standart variabels melfunction


> [php.ini]
> register_globals=On
>
> Beau
>
> // -Original Message-
> // From: Martin Allan Jensen [mailto:[EMAIL PROTECTED]]
> // Sent: Wednesday, 20 November 2002 12:41 PM
> // To: [EMAIL PROTECTED]
> // Subject: [PHP-DB] standart variabels melfunction
> //
> //
> // Hi all,
> //
> // I have a problem with my settings of Apache and PHP i think..
> //
> // When i call for example ($PHP_SELF) instead of
> // ($_SERVER[PHP_SELF]) i get no output, just like when i call the url
> // www.servername.tld/test.php?mode=test
> // And i want to call the mode like this:
> // print($mode);
> // I just get a empty string.
> // But when i call:
> // print($_GET[mode]);
> // I get the real output...
> //
> // I tried to walk troug the hole php.ini & the httpd.conf
> // file, but nothing came up, so i relly hope that you can help
> // me out here...!
> //
> // Sorry if it's a little off topic..
> //
> // And THANKS A LOT!!
> //
> // 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




Re: [PHP-DB] FW: Selecting not on DB

2002-11-20 Thread Ignatius Reilly
You could create an auxiliary table nb_1_10 containing a field nb with all
integers from 1 to 10

Then perform a SELECT join:

SELECT nb_1_10.*
FROM ABC, nb_1_10
WHERE nb_1_10.nb NOT IN ABC.number
AND < some condition that returns only one row from ABC - like here
(1,4,6,10) >

Ignatius

- Original Message -
From: "milisphp" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 21, 2002 5:29 AM
Subject: [PHP-DB] FW: Selecting not on DB


> Hi there,
>
> I have a problem that I cannot seem to solve. I'm using MySql and query
> it using PHP.
>
> I have create table ABC with field called "number" containing (1,4,6,10)
>
> How is to select all number form 1 to 10 which are not
> in that field so the output somehow like this :
>
> ++
> | Number |
> ++
> |  2 |
> |  3 |
> |  5 |
> |  7 |
> |  8 |
> |  9 |
> ++
>
> Thanks, Hansen
>


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




Re: [PHP-DB] Undefined Constant

2002-11-26 Thread Ignatius Reilly
Well, is there an input field in your form whose name corresponds to . ?

It is more likely that if you have a dynamic form your fields will be called
by a ID identifier, like
price is 12 EUR
Where 12 is the price of grommet with ID 1012 in your DB

So perhaps your javascript generator echoes the wrong field names...

HTH
Ignatius

- Original Message -
From: "Tyler Whitesides" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 27, 2002 8:24 AM
Subject: [PHP-DB] Undefined Constant


Hi,

Although I have been working with PHP for a while, working with
Databases is something that I am only so so at.  This code is supposed to
grab the price from the database given the auto_increment id is inside of
$casing.  I am trying to get the $row[price] to echo so that Javascript
recieves a string, converts it to an integer, and later on in the code,
gives the user a total.  Any ideas?

Thanks,
Tyler


var casing = parseInt(form1..value);





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




Re: [PHP-DB] Help with date

2002-11-28 Thread Ignatius Reilly
If you use MySQL:

SELECT DATE_ADD( $my_date, INTERVAL n DAY ) AS new_date ;

Ignatius

- Original Message -
From: "Dankshit" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>; "PHP1" <[EMAIL PROTECTED]>
Sent: Thursday, November 28, 2002 6:06 PM
Subject: [PHP-DB] Help with date



How can i add days to a date??




Equipe Pratic Sistemas
Rodrigo Corrêa
Fone: (14) 441-1700
[EMAIL PROTECTED]
[EMAIL PROTECTED]





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




Re: [PHP-DB] some data output formatting and grouping question...

2002-12-02 Thread Ignatius Reilly
Very simple procedurally (though not in SQL).

Here's the pseudo-code:

Execute:
SELECT * FROM Y WHERE U = 'me'
ORDER BY Y, X

$flag  = "last_y" ; // flag indicating whether or not your
mysql_fetch_array() brings a new value of Y
Loop your query result {
if Y <> $flag['last_y'] {
// this is a new value of Y: trigger a HTML header row
// update $flag['last_y'] = Y
}
// generate the normal HTML row
}

HTH
Ignatius

- Original Message -
From: "Victor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, December 02, 2002 8:53 AM
Subject: [PHP-DB] some data output formatting and grouping question...


> I just have a fucking mental block; I cannot at all conceive the
> necessary syntax to or even the theoretical algorithm that I need, to do
> the following:
>
> Consider the following table:
>
> U | X | Y
> --|---|--
> me|001|0a
> me|002|0a
> me|003|0a
> me|002|0b
> me|003|0b
> me|004|0b
> ..|...|..
>
> then the code says:
>
> SELECT * FROM Y WHERE U = me
>
> So now what?
> - remember I do not know the value of Y, so it has to be an automatic
> thing; I can't just say ... WHERE U = me AND Y = a.
>
> I want this output:
>
> 0a
> 001
> 002
> 003
> ___ ()
>
> 0b
> 002
> 003
> 004
>
> How the hell do I do that? I can't think of the goddamn' syntax!
>
> __
> Post your free ad now! http://personals.yahoo.ca
>
> --
> 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 - enum

2002-12-02 Thread Ignatius Reilly
DESCRIBE tbl_name col_name 

Ignatius

- Original Message - 
From: "Bastian Vogt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 02, 2002 1:41 PM
Subject: [PHP-DB] mysql - enum


> Hi,
> 
> is it possible to get all possible values of an enum-field from a
> mysql-table in php?
> The values might be changed in the database. Now I've got an
> select-field in my php-app where the user can select each value of the
> enum-field for a new record befor saving...
> 
> Thanks for any reply,
> Bastian
> 
> 
> -- 
> 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] displaying duplicate records...

2002-12-04 Thread Ignatius Reilly
I do not understand your first question.
Your query in effect shows duplicates.

To prevent future duplicates, you can do it in two ways:

1. with MySQL:
create a unique index on what should be unique, most likely the email (it
looks like your business logic implies one entry per email)
in fact you would not have this problem if you had defined email as PRIMARY
KEY

But you will have to remove the duplicates first - an unpleasant job.
AFAIK, there is no easy way to do it with MySQL (or SQL in general). You
have to do it procedurally by calling the entire table row by row.

2. Procedurally:
validate user data before entry in the DB

HTH
Ignatius

- Original Message -
From: "Marco Alting" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 04, 2002 11:47 AM
Subject: [PHP-DB] displaying duplicate records...


> I have a database which allows people to upload info and foto's. There's a
> unique ID field, but some people tend to upload their info more than once
> (its a contest site). What I'm able to do is to see how may duplicates
there
> are using the following statement:
>
> $query="SELECT COUNT(*) as cnt, voornaam,achternaam,leeftijd,ID,email FROM
> modellen GROUP BY email HAVING cnt >1";
>
> But this only gives me numbers. Does anyone know how to display every
record
> that has multiple duplicate ?
>
> Or is there an elegant way to stop people from entering their info more
than
> once?
>
>
>
> --
> 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] displaying duplicate records...

2002-12-04 Thread Ignatius Reilly
Well, seeing n rows or only one does not make you any happier, because you
can not issue a DELETE statement that will delete only (n-1) entries.

If your table is small enough, you may try to delete duplicates manually
with a graphical interface such as Access or DBTools. But test first, as it
may very well delete all n rows (in fact it SHOULD if it implements SQL
properly...)

Your PHP script should test first whether the proposed entry exists, with a
query like:

SELECT *
FROM my_table
WHERE unique_field = '{$_POST['unique_field']}'

(As a rule, you must validate thoroughly ALL entries before inserting into
your DB.)

you can test over if ( mysql_num_rows( $result) ) if there is already an
entry. In such case, redirect to your script with an appropriate error
message.

If you are reluctant to validate data, you can send the INSERT query and
interpret an error as an attempt to create a duplicate (provided you had
first created the appropriate UNIQUE index). Very dirty and not recommended.

HTH
Ignatius

- Original Message -
From: "Marco Alting" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 04, 2002 12:57 PM
Subject: Re: [PHP-DB] displaying duplicate records...


> What I ment was that when using the GROUP by, you will see one of the
> duplicates, and if you output the 'cnt' value you would see how many times
> it has a duplicate. But I want to see all duplicate records in a table, so
I
> can add a delete button to the row.
>
> If I have the email address as a PRIMARY i would very much like to know
how
> I would handle the input by the user when it is send to the database. I
> assume it will generate an error upon submission. How do I go about
letting
> the user know they have entered an already existing address?
>
>
> "Ignatius Reilly" <[EMAIL PROTECTED]> wrote in message
> 030801c29b8b$8bd88ee0$015a@server">news:030801c29b8b$8bd88ee0$015a@server...
> > I do not understand your first question.
> > Your query in effect shows duplicates.
> >
> > To prevent future duplicates, you can do it in two ways:
> >
> > 1. with MySQL:
> > create a unique index on what should be unique, most likely the email
(it
> > looks like your business logic implies one entry per email)
> > in fact you would not have this problem if you had defined email as
> PRIMARY
> > KEY
> >
> > But you will have to remove the duplicates first - an unpleasant job.
> > AFAIK, there is no easy way to do it with MySQL (or SQL in general). You
> > have to do it procedurally by calling the entire table row by row.
> >
> > 2. Procedurally:
> > validate user data before entry in the DB
> >
> > HTH
> > Ignatius
> > 
> > - Original Message -
> > From: "Marco Alting" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, December 04, 2002 11:47 AM
> > Subject: [PHP-DB] displaying duplicate records...
> >
> >
> > > I have a database which allows people to upload info and foto's.
There's
> a
> > > unique ID field, but some people tend to upload their info more than
> once
> > > (its a contest site). What I'm able to do is to see how may duplicates
> > there
> > > are using the following statement:
> > >
> > > $query="SELECT COUNT(*) as cnt, voornaam,achternaam,leeftijd,ID,email
> FROM
> > > modellen GROUP BY email HAVING cnt >1";
> > >
> > > But this only gives me numbers. Does anyone know how to display every
> > record
> > > that has multiple duplicate ?
> > >
> > > Or is there an elegant way to stop people from entering their info
more
> > than
> > > once?
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




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

2002-12-04 Thread Ignatius Reilly
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




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

2002-12-04 Thread Ignatius Reilly

Simply append a parameter to the URL:
action="same_page.php?selector=1"

your script will take various actions based on a switch:

switch $_POST['selector'] {

case 1 : etc.

Ignatius
___
- Original Message -
From: "Gavin Amm" <[EMAIL PROTECTED]>
To: "Php-Db (E-mail)" <[EMAIL PROTECTED]>
Sent: Thursday, December 05, 2002 6:31 AM
Subject: [PHP-DB] calling function on submit instead of going to a new
script


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


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




Re: [PHP-DB] Function questions...

2002-12-06 Thread Ignatius Reilly
I would replace
$query = "SELECT * FROM accounts WHERE verifyurl='$safe_verify_string'";

by
$query = "SELECT * FROM accounts WHERE verifyurl='{$safe_verify_string}'";
to force interpolation of variable $safe_verify_string

HTH
Ignatius

- Original Message -
From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 06, 2002 6:04 PM
Subject: [PHP-DB] Function questions...


> I am trying to convert something that I have working in a PHP script
> to be a function in a library type of file.  The code contained in the
> function works fine in another script, but I am currently getting no
output
> from the function.  I have a question about the nature of functions that
may
> help clear up my problems.
>
> Do 'echo' commands within functions actually work to directly
> display information?  I have only used functions up to this point that use
> the 'return' command to pass a variable back to the script that called the
> function.  I am pretty confused on how to actually use a function that
> formats data to be displayed.  This is my primary source of confusion.
>
> Below is the function that is giving me trouble:
>
> function CheckboxList($query) {
>   $result1 = mysql_query($query);
>   do {
> $sys = split('-', $list['id-sys']);
> if ($cnt == 1) {
>   $cnt = 2;
>   echo " value=\"$sys\">";
>   echo $sys."";
> } elseif ($cnt == 2) {
>   $cnt = 3;
>   echo " value=\"$sys\">";
>   echo $sys."";
> } elseif ($cnt == 3) {
>   $cnt = 4;
>   echo " value=\"$sys\">";
>   echo $sys."";
> } elseif ($cnt == 4) {
>   $cnt = 1;
>   echo " value=\"$sys\">";
>   echo $sys."";
> }
>   } while ($list = mysql_fetch_assoc($result1));
> }
>
> Here is also the way I am calling this function:
> 
> $query = "SELECT * FROM accounts WHERE verifyurl='$safe_verify_string'";
> 
> CheckboxList($query);
> 
>
> Is there something wrong with the way in which I am calling this
> function?  Thanks in advance for all the help.
>
>
> 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] MySQL Array

2002-12-06 Thread Ignatius Reilly
Try:

$query = "INSERT INTO anagrafe (codice,nome, cognome, codicefiscale)
VALUES ('"
.strtoupper($codicefiscale)
."','{$NOME}','"
.strtoupper($cognome)
."','"
.strtoupper($co
dicefiscale)
."', etc"

then
mysql_query ( $query ) ;

Ignatius

- Original Message -
From: "Antonio Bernabei" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 06, 2002 7:12 PM
Subject: Re: [PHP-DB] MySQL Array


> Hi,
>
> I want to insert the upper case of the strings written in the forn, so I
put
> on the php file called these lines
>
> $NOME=strtoupper($nome);
>
> mysql_query ("INSERT INTO anagrafe (codice,nome, cognome, codicefiscale)
>
> VALUES
>
('strtoupper($codicefiscale)','$NOME','strtoupper($cognome)','strtoupper($co
> dicefiscale)', ...
>
> but if $codice if for example abc in field codice I don't get ABC but
> uppercase(abc)
> while if $nome is mario in the filed nome I get MARIO
>
> Can I avoid to write extra lines for the conversion?
> Thanks
> Antonio
>
>
>
>
> --
> 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] CREATE TABLE QUERY PHP/MySQL

2002-12-06 Thread Ignatius Reilly
Very likely you have to GRANT the CREATE permission to your PHP user
account.

Also investigate the CREATE TEMPORARY TABLE grant status available since
version 4+. Very convenient.

Ignatius

- Original Message -
From: "Jonathan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 06, 2002 10:00 PM
Subject: [PHP-DB] CREATE TABLE QUERY PHP/MySQL


> This is the first time I am trying to create a table in MySQL based on
> user input.
>
> Here is the scenario,
>
> The user will enter in the name of a stage, e.g. Harley Davidson.
> I then look for the first space (to indicate the first word), make it
> into lower case and then do the following:
>
> $new_stage_name = "stage_".$var;
>
> This will give $new_stage_name the value of "stage_harley".
>
> That works fine.
>
> Now I want to run the following query:
>
> $SQL = "CREATE TABLE ".$new_stage_name." (set values and their
> properties)";
>
> If I run this query using PHPMyAdmin, minus the var of course, the table
> is created.
>
> When I run it in my code, nothing happens. I do a die($SQL) to see the
> final outcome of the query and it's correct and is what I am using to
> run the query in PHPMyAdmin.
>
> This is what my code is doing:
>
> I have class RecordSet which makes the db connection and its constructor
> takes the $SQL as an arg.
>
> So, $SQL = "what is listed above";
> $objRecordSet = new RecordSet($SQL);
> //I used this all the time with all kinds of other Select, Insert,
> Update, and Delete queries and it works perfect.
>
> For one, I don't know how to test whether the table has been created or
> not.  I know I could probably do some sort of mysql_list_tables and look
> for it or whatever but I was looking for something similar to
>
> If (mysql_affected_rows() == -1)
> Because that is very easy.
>
> And ideas as to why the table is not being created.
>
> ===
> Jonathan Villa
> Application Developer
> IS Design & Development
> www.isdesigndev.com
> 414.429.0327
> ===
>
>
>
>
> --
> 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] CREATE TABLE QUERY PHP/MySQL

2002-12-07 Thread Ignatius Reilly

answers inline

Ignatius

- Original Message - 
From: "Jonathan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 06, 2002 10:39 PM
Subject: RE: [PHP-DB] CREATE TABLE QUERY PHP/MySQL


> 
> 
> Granting access makes sense.  
> 
> Now what is the difference between the user information I put into the
> mysql_connect function and "PHP user"?
> 
one and same thing.

> If there is a difference , how would I grant the access via a query and
> how would it affect the new users who will use the application when it
> is given to my client?
> 
> Also, a preview reply mentioned mysql_error().  How would I use function
> to verify that the table was created?  Do I simply write
> 
> If (mysql_error() != "")
> Return false
> 
> 
A typical way to use it is
mysql_***(  *** ) or die( mysql_error() ) ;

> -Original Message-
> From: Ignatius Reilly [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, December 06, 2002 3:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] CREATE TABLE QUERY PHP/MySQL
> 
> Very likely you have to GRANT the CREATE permission to your PHP user
> account.
> 
> Also investigate the CREATE TEMPORARY TABLE grant status available since
> version 4+. Very convenient.
> 
> Ignatius
> 
> - Original Message -
> From: "Jonathan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, December 06, 2002 10:00 PM
> Subject: [PHP-DB] CREATE TABLE QUERY PHP/MySQL
> 
> 
> > This is the first time I am trying to create a table in MySQL based on
> > user input.
> >
> > Here is the scenario,
> >
> > The user will enter in the name of a stage, e.g. Harley Davidson.
> > I then look for the first space (to indicate the first word), make it
> > into lower case and then do the following:
> >
> > $new_stage_name = "stage_".$var;
> >
> > This will give $new_stage_name the value of "stage_harley".
> >
> > That works fine.
> >
> > Now I want to run the following query:
> >
> > $SQL = "CREATE TABLE ".$new_stage_name." (set values and their
> > properties)";
> >
> > If I run this query using PHPMyAdmin, minus the var of course, the
> table
> > is created.
> >
> > When I run it in my code, nothing happens. I do a die($SQL) to see the
> > final outcome of the query and it's correct and is what I am using to
> > run the query in PHPMyAdmin.
> >
> > This is what my code is doing:
> >
> > I have class RecordSet which makes the db connection and its
> constructor
> > takes the $SQL as an arg.
> >
> > So, $SQL = "what is listed above";
> > $objRecordSet = new RecordSet($SQL);
> > //I used this all the time with all kinds of other Select, Insert,
> > Update, and Delete queries and it works perfect.
> >
> > For one, I don't know how to test whether the table has been created
> or
> > not.  I know I could probably do some sort of mysql_list_tables and
> look
> > for it or whatever but I was looking for something similar to
> >
> > If (mysql_affected_rows() == -1)
> > Because that is very easy.
> >
> > And ideas as to why the table is not being created.
> >
> > ===
> > Jonathan Villa
> > Application Developer
> > IS Design & Development
> > www.isdesigndev.com
> > 414.429.0327
> > ===
> >
> >
> >
> >
> > --
> > 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




Re: [PHP-DB] Form TextArea Formatting

2002-12-09 Thread Ignatius Reilly
What do you mean by formatted text?

All you can enter in a textarea is a sequence of characters belonging to
your encoding schema (including non-printing characters).

Ignatius

- Original Message -
From: "Keith Spiller" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 09, 2002 12:01 PM
Subject: [PHP-DB] Form TextArea Formatting


> Hello,
>
> I've created a web form that includes a textarea input box called
> MessageText.  The data from this form will be inserted into a mysql table.
> My problem is that the form users will be inserting formatted text into
this
> textarea and I need to be able to transfer the formatting as well as the
> content into the database.  Right now, all formatting is lost in the
> transfer.  Any ideas or suggestions?
>
> Thank you for your help.
>
> Larentium
> [EMAIL PROTECTED]
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




Re: [PHP-DB] Select Query Help...

2002-12-10 Thread Ignatius Reilly
Try:

SELECT DISTINCT F.question, F.answer
FROM Faqs AS F, FaqsRelatedToProducts Table AS FP
WHERE F.faqid = FP.faqid

DTH?
Ignatius

- Original Message -
From: "Michael Knauf/Niles" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 10, 2002 8:53 PM
Subject: [PHP-DB] Select Query Help...


>
> select query question
>
> OK, I have 3 tables
>
> Products Table
>   prodid
>   fgnumber
>   name
>   description
>
> Faqs Table
>   faqid
>   question
>   answer
>
> FaqsRelatedToProducts Table
>   fpid
>   fgnumber
>   faqid
>
> I want to select all the faq question and answer pairs that relate to an
> fgnumber so I need to use both the Faqs table and the
FaqsRelatedToProducts
> table, how do I make that work?
>
> Michael
>
>
>
> --
> 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] Catalog

2002-12-11 Thread Ignatius Reilly
lots of excellent resources on www.devshed.com, notably a PHPShop tutorial
and a catalogue implementation.

Ignatius

- Original Message -
From: "Hynek Semecký ME" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 11, 2002 11:54 AM
Subject: [PHP-DB] Catalog


> Hi list,
>
> I am trying to develop a product catalog using MySQL and PhP.
> A long time I was looking for some tips for the database
> structure.
> The idea is to have a powerfull and as much as possible
> universal DB application.
>
> Does anyone have an idea of a book, e-book, site, resource please ?
>
> Thanks
> Hynek
>
>
>
>
>
>
>
>
> --
> 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] plain-text file (.txt) to mysql database

2004-03-01 Thread Ignatius Reilly
G'day, mate,

With MySQL LOAD statement, you can specify which columns of your text file
goes to what DB column.

HTH
Ignatius
_
- Original Message -
From: "JeRRy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 01, 2004 10:08
Subject: [PHP-DB] plain-text file (.txt) to mysql database


> Hi,
>
> Quick question, does anyone know of a program/site
> that could do the following:
>
> I have a .txt file written in notepad.
>
> Bob Someone Mr
>
> Now I have a db with the fields:
>
> First Last Title
>
> Now the .txt file looks something like this:
>
> Bob Someone Mr
> Susan Taylor Miss
> Andrea Nothing Ms
> ...
>
> Now I want to use a Program/site to put the names in
> the right field.  So each field is seperated by a
> space as shown above.  I have about 1000 entries to
> put in and don't think doing each query per line is
> going to be a 5 min job, any suggestions?
>
> Thanks!
>
> Find local movie times and trailers on Yahoo! Movies.
> http://au.movies.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] plain-text file (.txt) to mysql database

2004-03-01 Thread Ignatius Reilly
In your case something like this will do:

LOAD DATA INFILE "data.txt"
INTO TABLE my_table
FIELDS TERMINATED BY ' '
LINES TERMINATED BY '\r\n'# or '\n' - depending on your system
IGNORE 1 LINES# if applicable
( First, Last, Title )   # actual order of your
columns in your txt file, mapping columns names

HTH
Ignatius
_
- Original Message -
From: "JeRRy" <[EMAIL PROTECTED]>
To: "Ignatius Reilly" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, March 01, 2004 10:44
Subject: Re: [PHP-DB] plain-text file (.txt) to mysql database


> Hi,
>
> So would I need to edit anything in my .txt file?
>
> Could you show me an example on what you mean by:
>
>  you can specify which
>  columns of your text file
>  goes to what DB column.
>
>
>
> Because my text file has first , last , title
> seperated by a space and a new entry is seperated by a
> enter. (new line)
>
> I took a look at www.mysql.com and had a read on 'LOAD
> DATA' but am not 100% sure on how it works with my
> sort of .txt file setup.
>
> If you could show me an example that worked with my
> .txt file that would be great, or would I need to edit
> my .txt file somewhat?
>
> Sorry about this, never used a .txt file for use of
> mysql before but since I need to do alot of entries at
> once it would be the easiest way to do it.
>
> Thanks!
>
>
>
>
>  --- Ignatius Reilly <[EMAIL PROTECTED]> wrote:
> > G'day, mate,
> >
> > With MySQL LOAD statement, you can specify which
> > columns of your text file
> > goes to what DB column.
> >
> > HTH
> > Ignatius
> > _
> > - Original Message -
> > From: "JeRRy" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, March 01, 2004 10:08
> > Subject: [PHP-DB] plain-text file (.txt) to mysql
> > database
> >
> >
> > > Hi,
> > >
> > > Quick question, does anyone know of a program/site
> > > that could do the following:
> > >
> > > I have a .txt file written in notepad.
> > >
> > > Bob Someone Mr
> > >
> > > Now I have a db with the fields:
> > >
> > > First Last Title
> > >
> > > Now the .txt file looks something like this:
> > >
> > > Bob Someone Mr
> > > Susan Taylor Miss
> > > Andrea Nothing Ms
> > > ...
> > >
> > > Now I want to use a Program/site to put the names
> > in
> > > the right field.  So each field is seperated by a
> > > space as shown above.  I have about 1000 entries
> > to
> > > put in and don't think doing each query per line
> > is
> > > going to be a 5 min job, any suggestions?
> > >
> > > Thanks!
> > >
> > > Find local movie times and trailers on Yahoo!
> > Movies.
> > > http://au.movies.yahoo.com
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit:
> > http://www.php.net/unsub.php
> > >
> > >
> >
>
> Find local movie times and trailers on Yahoo! Movies.
> http://au.movies.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] plain-text file (.txt) to mysql database

2004-03-01 Thread Ignatius Reilly
Two ways:
- full path (like "c:/temp/data.txt")
- simple file name: MySQL will assume the file is located in the current
database data directory (like d:/mysql/data/my_database)

_
- Original Message -
From: "JeRRy" <[EMAIL PROTECTED]>
To: "Ignatius Reilly" <[EMAIL PROTECTED]>
Sent: Monday, March 01, 2004 11:15
Subject: Re: [PHP-DB] plain-text file (.txt) to mysql database


> Hi,
>
> Right now I understnad.  Thanks for the example. :)
>
> As for data.txt ... Where should I pop this on my
> server?  In the root of my account? (e.g. ~/data.txt
> ?)
>
> J
>
>  --- Ignatius Reilly <[EMAIL PROTECTED]> wrote:
> > In your case something like this will do:
> >
> > LOAD DATA INFILE "data.txt"
> > INTO TABLE my_table
> > FIELDS TERMINATED BY ' '
> > LINES TERMINATED BY '\r\n'# or '\n' -
> > depending on your system
> > IGNORE 1 LINES# if
> > applicable
> > ( First, Last, Title )
> > # actual order of your
> > columns in your txt file, mapping columns names
> >
> > HTH
> > Ignatius
> > _
> > - Original Message -
> > From: "JeRRy" <[EMAIL PROTECTED]>
> > To: "Ignatius Reilly" <[EMAIL PROTECTED]>;
> > <[EMAIL PROTECTED]>
> > Sent: Monday, March 01, 2004 10:44
> > Subject: Re: [PHP-DB] plain-text file (.txt) to
> > mysql database
> >
> >
> > > Hi,
> > >
> > > So would I need to edit anything in my .txt file?
> > >
> > > Could you show me an example on what you mean by:
> > >
> > >  you can specify which
> > >  columns of your text file
> > >  goes to what DB column.
> > >
> > >
> > >
> > > Because my text file has first , last , title
> > > seperated by a space and a new entry is seperated
> > by a
> > > enter. (new line)
> > >
> > > I took a look at www.mysql.com and had a read on
> > 'LOAD
> > > DATA' but am not 100% sure on how it works with my
> > > sort of .txt file setup.
> > >
> > > If you could show me an example that worked with
> > my
> > > .txt file that would be great, or would I need to
> > edit
> > > my .txt file somewhat?
> > >
> > > Sorry about this, never used a .txt file for use
> > of
> > > mysql before but since I need to do alot of
> > entries at
> > > once it would be the easiest way to do it.
> > >
> > > Thanks!
> > >
> > >
> > >
> > >
> > >  --- Ignatius Reilly <[EMAIL PROTECTED]>
> > wrote:
> > > > G'day, mate,
> > > >
> > > > With MySQL LOAD statement, you can specify which
> > > > columns of your text file
> > > > goes to what DB column.
> > > >
> > > > HTH
> > > > Ignatius
> > > > _
> > > > - Original Message -
> > > > From: "JeRRy" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Monday, March 01, 2004 10:08
> > > > Subject: [PHP-DB] plain-text file (.txt) to
> > mysql
> > > > database
> > > >
> > > >
> > > > > Hi,
> > > > >
> > > > > Quick question, does anyone know of a
> > program/site
> > > > > that could do the following:
> > > > >
> > > > > I have a .txt file written in notepad.
> > > > >
> > > > > Bob Someone Mr
> > > > >
> > > > > Now I have a db with the fields:
> > > > >
> > > > > First Last Title
> > > > >
> > > > > Now the .txt file looks something like this:
> > > > >
> > > > > Bob Someone Mr
> > > > > Susan Taylor Miss
> > > > > Andrea Nothing Ms
> > > > > ...
> > > > >
> > > > > Now I want to use a Program/site to put the
> > names
> > > > in
> > > > > the right field.  So each field is seperated
> > by a
> > > > > space as shown above.  I have about 1000
> > entries
> > > > to
> > > > > put in and don't think doing each query per
> > line
> > > > is
> > > > > going to be a 5 min job, any suggestions?
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Find local movie times and trailers on Yahoo!
> > > > Movies.
> > > > > http://au.movies.yahoo.com
> > > > >
> > > > > --
> > > > > PHP Database Mailing List
> > (http://www.php.net/)
> > > > > To unsubscribe, visit:
> > > > http://www.php.net/unsub.php
> > > > >
> > > > >
> > > >
> > >
> > > Find local movie times and trailers on Yahoo!
> > Movies.
> > > http://au.movies.yahoo.com
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit:
> > http://www.php.net/unsub.php
> > >
> > >
> >
>
> Find local movie times and trailers on Yahoo! Movies.
> http://au.movies.yahoo.com
>

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



Re: [PHP-DB] Creating HTML objects from Oracle DB data @ runtime

2004-03-01 Thread Ignatius Reilly
Your question is rather vague. What kind of "help" are you seeking?

If of the kind "contracting out", we'll be glad to answer your RFQ.

Cheers

Ignatius
__

AUDERGHEM ANALYTICA
Web applications specialists
www.auderghem-analytica.com
Brussels, Belgium
__
_
- Original Message -
From: "mike calcagno" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 01, 2004 13:54
Subject: [PHP-DB] Creating HTML objects from Oracle DB data @ runtime


> I have a project where I am writing a web app version of out medical
> laboratory software. I will be connecting to an oracle db and ordering
tests
> on patients. I will need to create multiple checkboxes at runtime
depending
> on the data in the db. I will then need to submit all of the checked
> checkboxes and save them to the database.
>
> any help is appreciated.
>
> Thanks,
> Mike C.
> [EMAIL PROTECTED]
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP-DB] SELECT

2004-03-04 Thread Ignatius Reilly
SELECT
...
FROM users
WHERE FIND_IN_SET( 2, values ) > 0

Ignatius
_
- Original Message -
From: "peppe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 04, 2004 12:28
Subject: [PHP-DB] SELECT


> Hi I have a  table users with columns name email and access
> In email I have values [EMAIL PROTECTED] etc in access I have values
1,2,3,4,7,8
> How can I filter value 2 ?
> Beacause I need only users with value 2 to send email
> Greetings
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP-DB] SELECT

2004-03-04 Thread Ignatius Reilly
??
Didn't you say that $access[1] contains sets such as "1,2,3,4,7,8"?
Why compare it to "2"?

_
- Original Message - 
From: "peppe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 04, 2004 13:22
Subject: Re: [PHP-DB] SELECT 


> Hi
> I made this query
> $sql= "SELECT * FROM users WHERE FIND_IN_SET( 2, access ) > 0 ";
> $result   = mysql_query($sql);
> $numRows  = mysql_num_rows($result);
> 
> for ($row =1; $row <= $numRows; $row++) {
>   $rowArray = mysql_fetch_array($result);
> $access1   = $rowArray[1];
> 
> if ($access1 =='2'){
> echo "Access is 2 ";
>     } else {
> echo "acces is not 2";
> }
> }
> 
> I get always access not 2 how can I make this If works
> "Ignatius Reilly" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > SELECT
> > ...
> > FROM users
> > WHERE FIND_IN_SET( 2, values ) > 0
> >
> > Ignatius
> > _
> > - Original Message -
> > From: "peppe" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, March 04, 2004 12:28
> > Subject: [PHP-DB] SELECT
> >
> >
> > > Hi I have a  table users with columns name email and access
> > > In email I have values [EMAIL PROTECTED] etc in access I have values
> > 1,2,3,4,7,8
> > > How can I filter value 2 ?
> > > Beacause I need only users with value 2 to send email
> > > Greetings
> > >
> > > --
> > > 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] Php datetime

2004-03-04 Thread Ignatius Reilly
You can do it in SQL:

INSERT
...
SET  = NOW()

Ignatius
_
- Original Message -
From: "..: GamCo :.. Gawie Marais" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 04, 2004 14:35
Subject: [PHP-DB] Php datetime


> hi,
>
> i have created a mysql table where i would like to store the date and time
> whenever a user logs into a web site. the login is done through php/mysql
as
> well but i'm not sure what the php code is to add the current date/time
into
> a mysql database. the field in the db is created as a 'datetime' field.
>
>
>
>
>
>
>
>
>
> Regards,
>
>
> Gawie Marais
> ..: GamCo :..
>
> --
> Tel: +27 11 312 0481
> Fax: +27 11 312 0483 / +27 82 239 2986
> http://www.gam.co.za
> --
> if(empty($beer))
> { getbeer() }
> else
> { consume($beer) }
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP-DB] I'm new on the list and have a question.

2004-03-06 Thread Ignatius Reilly
Check the excellent JPgraph library.
http://www.aditus.nu/jpgraph/

_
- Original Message - 
From: "Carlos D. Carrasco" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 06, 2004 17:32
Subject: [PHP-DB] I'm new on the list and have a question.


> Hi,
> 
> My name is Carlos, and I' trying to make a 
> graphic X, Y of some data that I have, and 
> I know that it is posible to do this in PHP, 
> can you help me???
> 
> Cheers!
> 
> Carlos.
> 
> -- 
> 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] javascript question

2004-03-08 Thread Ignatius Reilly
Maybe you forgot a "?":
Alert(); or
 ^^^
Ignatius
_
- Original Message -
From: "Gamze Başaran" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 08, 2004 2:49 PM
Subject: [PHP-DB] javascript question


> Hi everyone;
>
> First of all I'm sorry maybe I musn't send this mail to this list but I
> think that someone can help me. Here is my problem:
>
> I use pear templates. In my html template file there is an javascript like
> this:
>
> function validateAll (objForm){
> if (objForm.comp_prg.selectedIndex == 0) {
> alert ("You must choose something");
> return false;
> }
>   Return true;
> }
>
> This code is true. But I want to use php variable in this code. Alert
> sentence must be a php_variable. I try
>
> Alert(); or
> Alert();
>
> But I it isn't work. Can anybody help me??
>
> --
> 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] Tree structure - how to show only current branch ??

2004-03-30 Thread Ignatius Reilly
The same can be achieved by using the excellent PEAR HTML_TreeMenu class.
Key advantage, of course, is that the API is in PHP.

HTH
Ignatius
_
- Original Message - 
From: "Paul Miller" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 30, 2004 4:22 PM
Subject: RE: [PHP-DB] Tree structure - how to show only current branch ??


> Ya it has - that is a great script!
> 
> -Original Message-
> From: Galbreath, Mark A [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 30, 2004 7:15 AM
> To: '-{ Rene Brehmer }-'; '[EMAIL PROTECTED]'
> Subject: RE: [PHP-DB] Tree structure - how to show only current branch
> ??
> 
> 
> Already been done:
> 
> http://www.destroydrop.com/javascripts/tree/
> 
> Mark
> 
> -Original Message-
> From: -{ Rene Brehmer }- [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 30, 2004 7:50 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Tree structure - how to show only current branch ??
> 
> 
> Ok, Tom Reed got my thinker running big time ... and I've been trying to
> 
> build an expandable and modifiable tree structure where it only displays
> 
> the branch leading to the current folder... Showing the entire tree is 
> easy, but how do I change the code to only display the branch we need???
> 
> ... I've never coded visual trees before, so this is new for me ...
> 
> Found several samples with google where the code relies on the structure
> 
> being fixed in the DB. What I want to create is the possibility to mode 
> folders around within the tree ... literally moving branches from one
> place 
> to another, while retaining their content.
> 
> DB structure is simply this (I want to get rid of the level field if
> it's 
> at all possible to count the levels with recursive functions, but for
> now 
> it stays).
> 
>   folderID int(10) UNSIGNED auto-increment
>   parentID  int(10) UNSIGNED
>   level  tinyint(3) UNSIGNED
>   name  varchar(255)
> 
> (I'm fully aware that int may be overkill, but this is for testing
> purposes...)
> 
> test data:
>  +tes
> t&table=folders&pos=0&session_max_rows=30&disp_direction=horizontal&repe
> at_c
> ells=100&dontlimitchars=0&sql_query=SELECT++%2A+%0AFROM++%60folders%60++
> ORDE
> R+BY+%60folderID%60+ASC>folderID
>  +tes
> t&table=folders&pos=0&session_max_rows=30&disp_direction=horizontal&repe
> at_c
> ells=100&dontlimitchars=0&sql_query=SELECT++%2A+%0AFROM++%60folders%60++
> ORDE
> R+BY+%60parentID%60+ASC>parentID
>  +tes
> t&table=folders&pos=0&session_max_rows=30&disp_direction=horizontal&repe
> at_c
> ells=100&dontlimitchars=0&sql_query=SELECT++%2A+%0AFROM++%60folders%60++
> ORDE
> R+BY+%60level%60+ASC>level
>  +tes
> t&table=folders&pos=0&session_max_rows=30&disp_direction=horizontal&repe
> at_c
> ells=100&dontlimitchars=0&sql_query=SELECT++%2A+%0AFROM++%60folders%60++
> ORDE
> R+BY+%60name%60+ASC>name
> 
> 1 0 0 parent 1
> 2 0 0 parent 2
> 3 0 0 parent 3
> 4 0 0 parent 4
> 5 0 0 parent 5
> 6 1 1 child of 1
> 7 3 1 child of 3
> 8 1 1 child 2 of 1
> 9 6 2 sub-child 1
> 10 6 2 sub-child 2
> 11 10 4 sub-sub 1
> 12 10 4 sub-sub 2
> 13 11 5 sub-sub-sub 1
> 
> Current code looks like this, the 2 subfunctions prints the branches,
> the 
> main function below prints the root structure...:
> 
> function count_children($parentID) {
> // count number of children in folder
>$count = mysql_query("SELECT COUNT(*) AS num_children FROM folders
> WHERE 
> `parentID`='$parentID'");
>$numrows = mysql_fetch_array($count);
> 
>return $numrows['num_children'];
> }
> 
> function print_children($parentID) {
> // print the branch of sub-folders
>$children = mysql_query("SELECT folderID,level,name FROM folders
> WHERE 
> `parentID`='$parentID'");
> 
>while($child = mysql_fetch_array($children)) {
>  $folderID = $child['folderID'];
>  $name = $child['name'];
>  $level = $child['level'];
> 
>  for ($i = 0; $i < $level; $i++) {
>echo('·');
>  }
>  echo("·  href=\"test1.php?folderID=$folderID\">$name\n");
> 
>  // let's find children... recursive call !!
>  if (count_children($folderID) > 0) {
>print_children($folderID);
>  }
>}
> }
> 
> // get root parents -- main tree function
> $parents = mysql_query("SELECT folderID,name FROM folders WHERE 
> `parentID`='0'");
> 
> while($folder = mysql_fetch_array($parents)) {
>$folderID = $folder['folderID'];
>$name = $folder['name'];
> 
>echo("·  href=\"test1.php?folderID=$folderID\">$name\n");
> 
>// let's find children...
>if (count_children($folderID) > 0) {
>  print_children($folderID);
> 
>}
> }
> 
> 
> The output of all this looks like this:
> 
> . 

Re: [PHP-DB] Firebird

2004-03-31 Thread Ignatius Reilly
_
- Original Message - 
From: "Alireza Balouch" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 31, 2004 12:25 PM
Subject: [PHP-DB] Firebird


> It looks like firebird database is on its way to replace of mysql... 

E???!!!???
How would you back this up?

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



Re: [PHP-DB] Graphing - bar charts

2004-04-06 Thread Ignatius Reilly
jpgraph is great
http://www.aditus.nu/jpgraph/

open source, very reasonably priced

Ignatius
_
- Original Message - 
From: "Craig Hoffman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 06, 2004 4:55 PM
Subject: [PHP-DB] Graphing - bar charts


> Hi there:
> I am looking for an open source and simple PHP script that will graph 
> (bar) a few MySQL fields.  Does anyone have any recommendations?
> 
> __
> Craig Hoffman - eClimb Media
> 
> v: (847) 644 - 8914
> f: (847) 866 - 1946
> e: [EMAIL PROTECTED]
> w: www.eclimb.net
> _
> 
> -- 
> 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] links to maps

2004-04-14 Thread Ignatius Reilly
Use the cURL library.

_
- Original Message - 
From: "matthew perry" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 15, 2004 6:39 AM
Subject: [PHP-DB] links to maps


> Anyone know a quick and easy way to fill in the address on a yahoo maps 
> form?
> I want a link from my page to fill in all the details I already know so 
> my users don't have to enter it.
> - Matt
> 
> -- 
> 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] Date SELECT with IF

2004-04-15 Thread Ignatius Reilly
SELECT
IF( B.Booking_End_Date != "-00-00",
DATE_FORMAT( B.Booking_End_Date, "%Y-%m-%d" ),
"N/A"
) AS Booking_End_Date
FROM Bookings AS B, etc.

HTH
Ignatius
_
- Original Message -
From: "Shaun" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 15, 2004 7:44 PM
Subject: [PHP-DB] Date SELECT with IF


> Hi,
>
> Is it possible to have a clause in a mysql SELECT statement? I would the
> query to display the date except where it equals the default 000-00-00 to
> display n/a or something similar.
>
> For example SELECT DATE_FORMAT(B.Booking_End_Date, \"%Y-%m-%d\") AS
'Booking
> End Date' FROM Bookings (IF Booking_End_Date = '-00-00' DISPLAY
'n/a');
>
> I hope this illustrates what I am trying to achieve!
>
> Thanks for your help
>
> --
> 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] Looping through a result

2004-04-20 Thread Ignatius Reilly
Use only one query:

SELECT
category,
item,
...
ORDER BY category, item

Now fetch rows, and keep the latest categoryID in a flag variable:
- if fetched categoryID <> flag, close table, create a new table, add header
row
- otherwise add content row to the current table
- update flag with the latest category ID

BTW you may want to use the great PEAR HTML_Table package to generate your
tables.

HTH
_
- Original Message -
From: "Rene Schoenmakers" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 20, 2004 10:43 AM
Subject: [PHP-DB] Looping through a result


Hi,

I want to make the following page,

Category 1
Item 1 of category 1
Item 2 of category 1
Item 3 of category 1
Item 4 of category 1

Category 2
Item 1 of category 2
Item 2 of category 2
Item 3 of category 2

Category 3
Item 1 of category 3
Item 2 of category 3
Item 3 of category 3
Item 4 of category 3
Item 4 of category 3,

using PHP and MySQL. Looping through a result is not the problem. But
how do I use a second query while looping through a result and do I have
to use more then 1 table in the database?
Can somebody point me in the right direction?

Tia,

René

--
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 - counting number of instances of a word in a field

2004-04-28 Thread Ignatius Reilly
It is easy to get around this limitation:

for each column containing indexable content, create a shadow column
containing content prepared for FULLTEXT indexing.
I usually do the following:
- for each word:
- replace all non whitespace, non-blank characters by "_"
- right pad to 4 with "_"
for example "B.M.W." become "B_M_W_", "tax" will become "tax_"

now you prepare similarly the string to MATCH

actually doing so is good personal hygiene regardless of the value of
ft_max_len set by the host.
it is mandatory when you deal with languages which do not separate words by
whitespaces (in my case Japanese)

HTH
Ignatius
_
- Original Message -
From: "Gavin Amm" <[EMAIL PROTECTED]>
To: "Ignatius Reilly" <[EMAIL PROTECTED]>
Sent: Wednesday, April 28, 2004 10:03 AM
Subject: RE: [PHP-DB] MySQL - counting number of instances of a word in a
field


Yes,
They do.
Unfortunately the site is hosted by an ISP & has set the indexed words
to >3, the site requires essential words of 3 char length to be searched
through, such as "tax", "ato", "cgt", etc...

I will certainly still index the 2 main columns in the table...

Thanks for your help.

-Original Message-
From: Ignatius Reilly [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 28 April 2004 4:34 PM
To: Gavin Amm; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL - counting number of instances of a word in
a field


The functions do not exist.
However, FULLTEXT indexes will do much of this work for you. I encourage
you
to experiment with them.

_
- Original Message -
From: "Gavin Amm" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 28, 2004 7:18 AM
Subject: [PHP-DB] MySQL - counting number of instances of a word in a
field


Hi guys,

I'm trying to find a MySQL function(s) that will allow me to count the
number of words in a field.

For eg:

[table: pages]
id - title - keywords - body
1 - Home - home, page - This is my home page.  Enjoy your stay.
2 - Feedback - feedback, form, contact - Please enter any feedback or
comments in the form below.Your feedback will be used to improve our
service.

How do I, for example, count the number of instances of a word such as
"feedback" in say the BODY field?
I'm putting together a search engine & I'd like to 'rank' the results
based on the number of instances of each word found in a few fields.

In this example, if they search for the words "feedback" and "improve",
the count would result in the row id, word searched and the number of
instances of that word:
(formatting doesn't matter, it's just to give you an idea)
  id 2: "feedback" count = 2
  id 2: "improve" count = 1

I can play with the weightings later, just need to figure out the
counting...

Thanks guys,
Gav

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



Re: [PHP-DB] MySQL - counting number of instances of a word in a field

2004-04-28 Thread Ignatius Reilly
The functions do not exist.
However, FULLTEXT indexes will do much of this work for you. I encourage you
to experiment with them.

_
- Original Message -
From: "Gavin Amm" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 28, 2004 7:18 AM
Subject: [PHP-DB] MySQL - counting number of instances of a word in a field


Hi guys,

I'm trying to find a MySQL function(s) that will allow me to count the
number of words in a field.

For eg:

[table: pages]
id - title - keywords - body
1 - Home - home, page - This is my home page.  Enjoy your stay.
2 - Feedback - feedback, form, contact - Please enter any feedback or
comments in the form below.Your feedback will be used to improve our
service.

How do I, for example, count the number of instances of a word such as
"feedback" in say the BODY field?
I'm putting together a search engine & I'd like to 'rank' the results
based on the number of instances of each word found in a few fields.

In this example, if they search for the words "feedback" and "improve",
the count would result in the row id, word searched and the number of
instances of that word:
(formatting doesn't matter, it's just to give you an idea)
  id 2: "feedback" count = 2
  id 2: "improve" count = 1

I can play with the weightings later, just need to figure out the
counting...

Thanks guys,
Gav

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



Re: [PHP-DB] converting scripts for register_globals=Off

2004-04-29 Thread Ignatius Reilly
even better:
$_REQUEST['variable_name']

so that you don't have to bother checking both depending on whether your
form was GETted or POSTed.

_
- Original Message -
From: "Mikael Grön" <[EMAIL PROTECTED]>
To: "Kim Jacobs (Crooks) - Mweb" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, April 29, 2004 11:54 AM
Subject: Re: [PHP-DB] converting scripts for register_globals=Off


What register_globals does (Please correct me if I'm wrong) is convert
i.e. $_POST['variable_name'], $_GET['variable_name'] and so on to
$variable_name. which isn't very good from my point of view.

I suggest you make sure you use $_GET['your_variable'] when ever you're
fetching a GET variable, $_POST['var'] for all post variables and so
on, instead of what you're doing now.
This works just fine with register_globals = On as well, so I always
use it... to be safe..

Mike


On Apr 29, 2004, at 10:40, Kim Jacobs (Crooks) - Mweb wrote:

> if any of you could help me out, I would greatly appreciate it... I am
> an absolute beginner to php (2 weeks now) and dont know what I dont
> know...
>
> I have written some scripts to access my online SQL db and I've tested
> the scripts on my machine with PHP 4.3.6 and register_globals = On
> Now where I host my site, uses PHP 4.3.5 and has register_globals =
> Off which means of course, that my scripts arent working, but I dont
> know why
>
> My question is, how do I convert my scripts so that they will work
> please? I know that $id and $submit are two of the 'inputs' that it
> doesnt like, but I dont know the rest
>
> Tx
> K
>
>
> MWEB: S.A.'s most trusted and reliable Internet Service Provider. Just
> Like That.
>
> To join, go to: http://join.mweb.co.za or call 0860032000.
>
> --
> 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] converting scripts for register_globals=Off

2004-04-29 Thread Ignatius Reilly
If your form is well designed, there should NOT be another POST variable
named "ID" or "id" used for a different purpose.
Your form data validation routine will examine the 2-uple ( action, id), not
"id" alone. therefore no problem.
In many cases I find it convenient to design a page so that it can be called
indifferently by POST or GET.

Just my 2 Belgian francs.
Ignatius
_
- Original Message -
From: "Mikael Grön" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 29, 2004 12:42 PM
Subject: Re: [PHP-DB] converting scripts for register_globals=Off


Since I have a thing for using one file for all things in i.e. an admin
script, I use POST and GET variables at the same time. Getting them
mixed up is extremely hazardous.. I do stuff like:
Delete post
which leads to the section of the admin script;

Now, if there's a POST variable named ID containing an INT matching the
database, and I use $_REQUEST instead of $_GET, I'm in trouble!

Mike


On Apr 29, 2004, at 11:00, Ignatius Reilly wrote:

> even better:
> $_REQUEST['variable_name']
>
> so that you don't have to bother checking both depending on whether
> your
> form was GETted or POSTed.
>
> _
> - Original Message -
> From: "Mikael Grön" <[EMAIL PROTECTED]>
> To: "Kim Jacobs (Crooks) - Mweb" <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Thursday, April 29, 2004 11:54 AM
> Subject: Re: [PHP-DB] converting scripts for register_globals=Off
>
>
> What register_globals does (Please correct me if I'm wrong) is convert
> i.e. $_POST['variable_name'], $_GET['variable_name'] and so on to
> $variable_name. which isn't very good from my point of view.
>
> I suggest you make sure you use $_GET['your_variable'] when ever you're
> fetching a GET variable, $_POST['var'] for all post variables and so
> on, instead of what you're doing now.
> This works just fine with register_globals = On as well, so I always
> use it... to be safe..
>
> Mike
>
>
> On Apr 29, 2004, at 10:40, Kim Jacobs (Crooks) - Mweb wrote:
>
>> if any of you could help me out, I would greatly appreciate it... I am
>> an absolute beginner to php (2 weeks now) and dont know what I dont
>> know...
>>
>> I have written some scripts to access my online SQL db and I've tested
>> the scripts on my machine with PHP 4.3.6 and register_globals = On
>> Now where I host my site, uses PHP 4.3.5 and has register_globals =
>> Off which means of course, that my scripts arent working, but I dont
>> know why
>>
>> My question is, how do I convert my scripts so that they will work
>> please? I know that $id and $submit are two of the 'inputs' that it
>> doesnt like, but I dont know the rest
>>
>> Tx
>> K
>>
>>
>> MWEB: S.A.'s most trusted and reliable Internet Service Provider. Just
>> Like That.
>>
>> To join, go to: http://join.mweb.co.za or call 0860032000.
>>
>> --
>> 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



Re: [PHP-DB] inserting same data into multiple tables question (?)

2004-04-30 Thread Ignatius Reilly
You can't with standard SQL, nor with MySQL.
_
- Original Message - 
From: "JeRRy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 30, 2004 3:04 PM
Subject: [PHP-DB] inserting same data into multiple tables question (?) 


> 
> 
> 
> Hi,
> 
> I want to input the same data into multiple tables in
> one query if possible.
> 
> So what I want to do is input about 6 usernames I have
> into about 15 tables.
> 
> How would I do this?  In one query?  I really don't
> want to run multiple queries over 15 times to put in
> the data in each table.  Would this work?
> 
> INSERT into tbl1 , tbl2 , tbl3 ... ?
> 
> J
> 
> 
> Find local movie times and trailers on Yahoo! Movies.
> http://au.movies.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] Procedure for submitting an order via email

2004-05-01 Thread Ignatius Reilly
With the PHP IMAP functions you can process your mail box programmatically
as a data repository.

_
- Original Message -
From: "Ruprecht Helms" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 01, 2004 9:40 PM
Subject: [PHP-DB] Procedure for submitting an order via email


> Hi,
>
> I'm looking for an simple example how to send an order
> (content of the basket) via email.
>
> Does someone have such a good ans simple example.
>
> Regards,
> Ruprecht
>
> --
> 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] Wrong table name - can it be fixed?

2004-05-17 Thread Ignatius Reilly
Hav you tried enclosing the table name with backticks:

SELECT ...
FROM `16-05`
...

Ignatius
_
- Original Message - 
From: "Martin E. Koss" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 17, 2004 10:48 AM
Subject: [PHP-DB] Wrong table name - can it be fixed?


> I've made a big boo boo when exporting from MS Access to MySql database.
> The table name was '16-05' which obviously is not a good name to have in
> MySql.
> I'm using PhpMyAdmin as I'm not very experienced with sorting out the
> databases any other way. Problem is that I can't access the properties
> of the table in order to rename it, whatever I try to do I get an error
> (which is obviously due to the type of name the table has).
>  
> Is there any way I can fix this without getting too complicated?
>  
> Cheers.
>  
> Martin
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.684 / Virus Database: 446 - Release Date: 13/05/2004
>  
> 
> -- 
> 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] About retrieving auto increment value

2004-06-08 Thread Ignatius Reilly
LAST_INSERT_ID() is connection-based, not table-based.

Therefore instead of:
SELECT LAST_INSERT_ID() FROM foo_table

you should do:
SELECT LAST_INSERT_ID()

HTH
Ignatius
_
- Original Message -
From: "Marc Soler" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 07, 2004 7:42 PM
Subject: [PHP-DB] About retrieving auto increment value


> Hi
>
> I have the typical problem with retrieving auto increment value in
> php-mysql environment.
>
> I have search info in mysql page and I have found LAST_INSERT_ID()
> funtion but I don't know how to use correctly.
>
> I have one script that insert a row. And another script that must
> retrieve last auto_increment value for primary key on a table.
>
> I want something like this:
>
> SELECT LAST_INSERT_ID() FROM foo_table; (like curval(foo_sequence) in
postgres)
>
> This doesn't work.
>
> It's possible? Where I am wrong?
>
> Thanks in advance
> --
> Marc Soler
>
> --
> 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] Count unique visits in PHP/MySQL

2004-06-08 Thread Ignatius Reilly
Here is how I would do:

1. Group your visits by IP, order them in time and give each row a
sequential number starting with 1
(not completely trivial - exercise left to the reader)

Now you have a temporary table T ( ip, timestamp, rank )

2. Join the table to itself on two consecutive rows, and compute the
timestamp difference between the rows
(actually you must create a replica of the table because you can not
self-join a temporary table)

SELECT
ip,
SUM(
IF(
UNIX_TIMESTAMP( T.timestamp ) - UNIX_TIMESTAMP( U.timestamp ) <=
60*30
0,
1
)
) AS unik_visits
FROM T
LEFT JOIN U
ONU.ip = T.ip
AND  U.rank = T.rank + 1
GROUP BY ip

HTH
Ignatius
_
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 08, 2004 5:03 PM
Subject: [PHP-DB] Count unique visits in PHP/MySQL


> I am making a PHP/MySQL traffic report page from a table that records some
user activity using PHP referrer information.
>
> I have a table with three rows: IP, page_name, and timestamp. The IP row
records the user's IP address, page_name records the name of the page that
the user loaded, and the timestamp row records in Unix timestamp format the
time of day that the user requested the page.
>
> I want to be able to count unique visits per IP according to Internet
Advertising Bureau standards, which count a "Unique Visit" as a log in by
the same IP once every thirty minutes.
>
> IAB verbatim definition: "Visit - One or more text and/or graphics
downloads from a site qualifying as at least one page, without 30
consecutive minutes of inactivity, which can be reasonably attributed to a
single browser for a single session. A browser must "pull" text or graphics
content to be considered a visit."
>
> So I need to make a MySQL query that will count how many times an IP
logged a timestamp within a given time period.
>
> For example, the publisher checking traffic could request a date between
May 1 and May 31, and I'd like to be able to return a page that counted
unique users (count distinct IP), pages viewed (list distinct pages) and how
many times they visited in that period. I have the first two down, but not
the unique visits. Any ideas?
>
> --
> 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] HELP: best way to TEXT dump a MySQL table to a local file...

2004-06-10 Thread Ignatius Reilly
Hi the Third,

have you considered dumping the table into a text file?
SELECT *
FROM mytable
INTO OUTFILE "c:/..."

this (AFAI) does not cause memory issues

Ignatius
_
- Original Message -
From: "Leo G. Divinagracia III" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 10, 2004 11:39 AM
Subject: [PHP-DB] HELP: best way to TEXT dump a MySQL table to a local
file...


> project i'm working with, his host died or something.
>
> but, the phpMyadmin (on that host) can NOT do a backup of 200mb table
> without running out of memory or something weird.
>
> so what is the best way to text dump the table?
>
> i thought i would (pseudo-code):
>
>
> open DB
> do while not EOF
>  grab 1000 rows from DB
>  write to a file on host www path
>  filename = filename000 + 1
> until EOF
>
> user would then FTP down the files to his machine.
>
>
> but i figured i could use the HEADER to send it to the user.
>
> i grabbed this from the HEADER help section:
>
>
>  $output_file = 'something.txt';
> $content_len = 666;
>
> @ob_end_clean();
> @ini_set('zlib.output_compression', 'Off');
> header('Pragma: public');
> header('Content-Transfer-Encoding: none');
> header('Content-Type: application/octetstream; name="' . $output_file .
> '"');
> header('Content-Disposition: inline; filename="' . $output_file . '"');
> header("Content-length: $content_len");
>
>  >?
>
> is that the best way to send the txt file to the user?
>
> 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] Web host offering beta versions?

2004-07-08 Thread Ignatius Reilly
PHP5:
www.ovh.com

MySQL 4.1
probably nobody.
First beta (4.1.3) was released only a few days ago

_
- Original Message -
From: "Jensen, Kimberlee" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 08, 2004 11:28 PM
Subject: [PHP-DB] Web host offering beta versions?


Does anyone know of a free/low cost Web host that lets you play with PHP 5
and MySQL 4.1? Thanks

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



Re: [PHP-DB] PHP sitemap

2004-07-13 Thread Ignatius Reilly
For some of my sites I use a XML file to list all the pages in a structured
manner (sections, access rights, etc.)
I generate the site map by using a XSLT sheet.

_
- Original Message -
From: "Dermot Mc Laughlin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 13, 2004 12:35 AM
Subject: [PHP-DB] PHP sitemap


> Hi,
>
> Is it possible/easy to create a simple sitemap page using PHP which would
> automatically parse all files and directories from index.html and create a
> structured HTML document from the results?
>
> I'm just a newcomer to this field, but have some experience in programming
and
> web development. I know that I can parse a given directory, it would just
be
> cool to do a grown up version of this code.
>
> Regards,
> Dermot Mc Laughlin
>
> --
> 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] Wait Statement... ?

2004-07-20 Thread Ignatius Reilly
sleep( nb of seconds ) ;

_
- Original Message - 
From: "..: GamCo :.." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 20, 2004 9:44 AM
Subject: [PHP-DB] Wait Statement... ?


> Hi all,
> 
> I would like to add a line of code in PHP that will execute a wait before
> executing the next set of code. How do i do that ?
> 
> Regards,
> 
> GM
> 
> -- 
> 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] Wait Statement... ?

2004-07-20 Thread Ignatius Reilly
Why silly??
it just makes you wait one second on the login page BEFORE the validation
process, not on other  pages.
I use it everywhere.

Ignatius
_
- Original Message -
From: "Daevid Vincent" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "'..: GamCo :..'" <[EMAIL PROTECTED]>; "'John W. Holmes'"
<[EMAIL PROTECTED]>
Sent: Tuesday, July 20, 2004 9:47 PM
Subject: RE: [PHP-DB] Wait Statement... ?


> Similarly, I could adjust my brute force attack to sleep() a
pre-determined
> amount of time too ;-)
>
> The whole 'sleep()' idea just seems silly. I agree with Jason. Just
validate
> and be done. A better way to stop attacks is to have a tally of failed
> logins if you really are that worried someone is going to brute-force you.
> Then after 3 fails, just don't let that IP connect or add other
intelligent
> handling. Maybe add them to a 'ban list' after x amount of failed tries.
You
> can get the $_SERVER['REMOTE_ADDR'] or use the session id or whatever.
>
> > -Original Message-
> > From: John W. Holmes [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, July 20, 2004 7:10 AM
> > To: ..: GamCo :..
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] Wait Statement... ?
> >
> > ..: GamCo :.. wrote:
> > > ok, i added the sleep() function in my page. what i'm
> > basically doing is :-
> > >
> > > i have a .php page where people log-in from. from there i
> > send the form to
> > > another .php page that actually checks the login and
> > registers a session
> > > with the username and password as session variables. then
> > on the page that
> > > actually does the validation, i have something that says :
> > validating
> > > login... sleep 1 funtion. then, i have another line that
> > says validation
> > > successfull... sleep 1 function and then i have another
> > line that says
> > > redirecting... with sleep 1 function and then header
> > redirects to the actual
> > > logged-in.php file. the redirect and validation works
> > perfectly as well as
> > > the sleep functions, but it now doesn't display the
> > validating login... blah
> > > blah blah stuff which is done in normal html code...
> >
> > You are very confused. Read the manual page on header(). You
> > can't have
> > any output before you try to redirect with a header().
> >
> > If you're trying to implement some sort of brute force protection by
> > using sleep(), you're using it in the wrong method, anyhow.
> > Your login
> > processing script should sleep for a second or two whether
> > the login is
> > correct or not and it should be the first thing that it does (i.e.
> > before any output or redirection). If you only sleep() on
> > failures and
> > redirect on good logins, brute force methods can pick up on that and
> > adjust their methods to get around the wait time.
> >
> > --
> > ---John Holmes...
> >
> > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
> >
> > php|architect: The Magazine for PHP Professionals - www.phparch.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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] MySQL software question

2004-07-28 Thread Ignatius Reilly
Dezigner
www.datanamic.com

Excellent piece of software.
_
- Original Message - 
From: "Vincent Jordan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 28, 2004 1:27 PM
Subject: [PHP-DB] MySQL software question


> Is there a piece of software that will allow my to create MySQL
> databases and table relations in a graphical format without having to
> connect to the database?
>  
> I am looking for something where I can "point and click" the creation of
> tables and easily create several relationships between tables ( kinda
> like in access ) and when in done it will create the .sql file?
>  
> I prefer this to be a desktop application.
>  
>  
> Thanks
> 

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



Re: [PHP-DB] Web page paginator that doesn't rely on the LIMIT clause

2004-08-03 Thread Ignatius Reilly
1. What prevents you from implementing the conditions directly in SQL? You
can achieve a lot with CASE and IF.
2. For your paging needs, you may benefit from investigating the PEAR
HTML_Pager class.

Ignatius
_
- Original Message -
From: "Ross Honniball" <[EMAIL PROTECTED]>
To: "php DB" <[EMAIL PROTECTED]>
Sent: Tuesday, August 03, 2004 12:52 PM
Subject: [PHP-DB] Web page paginator that doesn't rely on the LIMIT clause


> Hi all,
>
> I use the LIMIT statement to control paging of data, which works really
well.
>
> I now have a situation where I need to use some logic in addition to the
> query that will result in NOT ALL records being spat out. ie.
>
> select * from x where y;
> foreach result
>  if (some condition)
>  output;
>  endif
> endfor
>
> So problem is I can't say LIMIT 20,20 on the query as logic may result in
> less than 20 records being spat out to screen.
>
> I was planning on coding up a solution so that i just keep a count myself
> of how many records I have output myself and break at appropriate paging
> points, but I am probably re-inventing the wheel.
>
> Anyone know of any good classes they are using that do this sort of thing
> already?
> .
> . Ross Honniball. JCU Bookshop Cairns, Qld, Australia.
> .
>
> --
> 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] Web page paginator that doesn't rely on the LIMIT clause

2004-08-03 Thread Ignatius Reilly
With MySQL 4.1:
try this (untested)

SELECT SM.key,
  SM.stock_on_hand
  COALESCE( SH.tally, 0 ) AS hist_sales
FROM stock_master AS SM
  LEFT JOIN (
   SELECT
 SH.key
 SUM( SH.jan )
 + ...
 + SUM( SH.`dec` )
 AS tally
   FROM stock_history AS SH
   WHERE SH.year = 2004
   GROUP BY key
  ) AS H
  ON H.key = SM.key
HAVING stock_on_hand > hist_sale

With earlier versions, you must create a temporary table with the table
appearing in the subquery.

Notes: 2 ugly things about your design:
- dashes in table and column names
- one column per month: you must have one column "month" that becomes part
of the primary key

HTH
Ignatius
_
- Original Message -
From: "Ross Honniball" <[EMAIL PROTECTED]>
To: "php DB" <[EMAIL PROTECTED]>
Sent: Tuesday, August 03, 2004 2:54 PM
Subject: Re: [PHP-DB] Web page paginator that doesn't rely on the LIMIT
clause


> At 10:22 PM 3/08/2004, you wrote:
> >1. please answer to the list, not to only me (you break the thread)
>
> whoops. sorry.
>
> >2. show us your data model if you need further help
>
> AS AN EXERCISE, I would be interested to know if you can do this in one
> query, but I've pretty much decided to either code up or find a paginator
> class that will resolve my present issues. I figure even if this
particular
> query can be done in SQL, I'm going to eventually run against a problem
> that can't.
>
> Roughly, data model looks like this:
>
> Table : Stock-Master
>Key (key)
>title etc.
>stock-on-hand
> |
> |
> /\
>/  \
> Table : Stock-History
>Key (key)
>Year(key)
>Sales-Jan
>Sales-Feb
>Sales-Mar
>...
>Sales-Dec
>
> And what I need to do is loop through master records, grab history records
> for various years (which may or may not exist for any given key), add up
> multiple sales field within each history record, and compare this against
> stock-on-hand to decide if I want to 'output' the record or not.
>
> Let me know if you want more detail. It would resolve the present issue if
> it can be done in a query(and improve my sql knowledge).
>
> >_
> >- Original Message -
> >From: "Ross Honniball" <[EMAIL PROTECTED]>
> >To: "Ignatius Reilly" <[EMAIL PROTECTED]>
> >Sent: Tuesday, August 03, 2004 1:46 PM
> >Subject: Re: [PHP-DB] Web page paginator that doesn't rely on the LIMIT
> >clause
> >
> >
> > > thanks ignatius. not sure i'm out of the woods though.
> > >
> > > I didn't know sql had CASE and IF. I just had a quick look in the
manual
> > > and aren't sure they will help.
> > >
> > > The specific logic I'm doing is this:
> > >
> > > total_sales = 0;
> > > select * from master
> > > while more master records
> > >if (select * from history record 1) // MAY NOT EVEN EXIST
> > >   loop through a dozen monthly sales fields adding into
total_sales;
> > >endif
> > >if (select * from history record 2) // MAY NOT EVEN EXIST
> > >   loop through a dozen monthly sales fields adding into
total_sales;
> > >endif
> > >//* the 'output' test
> > >if total_sales > some_amount
> > >   output record
> > >endif
> > > end-while
> > >
> > > So it's not real complex to do in code, but I really wouldn't know
where
> >to
> > > start to try and screw it all in to a single sql statement.
> > >
> > > I also had a look at HTML_Pager but, at a glance, it looks like some
kind
> > > of web-page presenter?
> > >
> > > At 09:14 PM 3/08/2004, you wrote:
> > > >1. What prevents you from implementing the conditions directly in
SQL?
> >You
> > > >can achieve a lot with CASE and IF.
> > > >2. For your paging needs, you may benefit from investigating the PEAR
> > > >HTML_Pager class.
> > > >
> > > >Ignatius
> > > >_
> > > >- Original Message -
> > > >From: "Ross Honniball" <[EMAIL PROTECTED]>
> > > >To: "php DB" <[EMAIL PROTECTED]>
> > > >Sent: Tuesday, August 03, 2004 12:52 PM
> > > >Subject: [PHP-DB] Web page paginator that doesn't rely on the LIMIT
> >clause
> > > >
> > > >
> > > > > Hi all,
> > > > >
> > > > > I use the LIMIT statement to cont

Re: [PHP-DB] Text area

2004-08-24 Thread Ignatius Reilly
You may profitably investigate PEAR Quickform.
Nice client-side and server-side validation functions to do just that.

HTH
_
- Original Message -
From: "Hafidz Abdullah" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 24, 2004 10:43 AM
Subject: [PHP-DB] Text area


Hi again, everyone.

I also have a problem creating my text area.  I meant to do a text area
(measuring 5 rows by 70 columns) which accompanies the words: "First 50
words are free. Subsequent 50 words or part thereof, $50 will be charged:"

function write_textarea()
 {
  return "";
 }

Doesn't work. How can I make it work?

Thanks & regards,
Hafidz

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



Re: [PHP-DB] PHP Array to Javascript?

2004-08-25 Thread Ignatius Reilly
look at the PEAR HTML_Javascript class

_
- Original Message - 
From: "Chris Payne" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 26, 2004 2:18 AM
Subject: [PHP-DB] PHP Array to Javascript?


> Hi there everyone,
> 
>  
> 
> I set an array using the following in PHP:
> 
>  
> 
> $ringb[$i]="$complex_area";
> 
> $i++;
> 
>  
> 
> It cycles through my DB and stores the info, my question is, how can I
> convert it to a value that can be read in Javascript?
> 
>  
> 
> I'm stumped.
> 
>  
> 
> Chris
> 
> 

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



Re: [PHP-DB] ER diagram class

2004-10-11 Thread Ignatius Reilly
Dezign / MySQL Importer

www.datanamic.com

HTH

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



Re: [PHP-DB] Numeric question

2004-11-16 Thread Ignatius Reilly
I am fairly confident that in this particular case the opinion(s) contained
within this email would nicely coincide with
those of St. Jude Children's Research Hospital.

We live in a world full of geometry.

Ignatius Reilly
_
- Original Message - 
From: "Norland, Martin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 16 November 2004 22:21
Subject: RE: [PHP-DB] Numeric question


> Just a quick question, I'm having to calculate some values from an
existing database,
> but on some of the results I get (For example)
> 0.5907
> How can I limit the result to only 2 digits after the decimal point
with PHP?
> Thanks
> Chris

Let the manual guide you: http://www.php.net/round
for example:
echo round(1.95583, 2);  // 1.96

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

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

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



Re: [PHP-DB] Use of 'as' name in where sub-clause

2004-12-01 Thread Ignatius Reilly
Very simply, because a clause
WHERE sales * cost > 100
would look up to "sales" and "cost" in the expression as SELECT fields.
Your clause will wotk if you add "sales" and "cost" to the SELECT fields,
but that would not be economical:
- you don't need them in the result
- you will execute the caclulation twice

In any case it good personal hygiene to use aliases

Ignatius

_
- Original Message - 
From: "Ross Honniball" <[EMAIL PROTECTED]>
To: "php DB" <[EMAIL PROTECTED]>
Sent: 01 December 2004 10:53
Subject: [PHP-DB] Use of 'as' name in where sub-clause


> Hi All,
>
> In MySql, you CAN'T do the following:
>
> SELECT sales * cost AS total WHERE total > 100
>
> Instead, you need to say:
>
> SELECT sales * cost AS total WHERE sales * cost > 100
>
>
> I'm just curious WHY you can't do it. You can, for example, specify ORDER
> BY total.
>
> I can't think of any reason why it would be either difficult or ambiguous
> for the SQL engine to allow you to use your calculated field name in the
> WHERE part of the query.
>
> If someone can give me a good reason why this is so, it will stop it
> annoying me so much.
>
> Regards ... Ross
> .
> . Ross Honniball. JCU Bookshop Cairns, Qld, Australia.
> .
>
> -- 
> 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] Pagination

2004-12-16 Thread Ignatius Reilly
have a look at the PEAR Pager class.
very useful.

_
- Original Message - 
From: "David Ziggy Lubowa" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 16 December 2004 23:38
Subject: [PHP-DB] Pagination


>
>
> Hey guys,
>
>   I am working on an internal db and i have a script[below] which does
some
> searching for me, now i am no expert in php but atleast i can always read
up,
> i want to add some kind of pagination because just incase i search for
> somethign in particular i dont want it to display 100 entries on my form,
how
> can i incorperate a pagination script in the script below,
>
> all help is highly appreciated
>
> [snip]
>
>
> 
>   $var = @$_GET['q'] ;
>   $trimmed = trim($var);
>
> // check for an empty string and display a message.
> if ($trimmed == "")
>   {
>   echo "Please enter a search...";
>   exit;
>   }
>
>
> $link = mysql_connect("localhost", "beef","b33f");
> mysql_select_db("ip", $link);
> $qry = mysql_query("SELECT * FROM IP_Addresses where free like '%".
> $_GET['q']."%'", $link);
>
> ?>
> 
> if (mysql_num_rows($qry)==0 ) {
>
> print " Oops No records found ";
> ?>
> 
> http://localhost/ipsearch2.html";>Back
> 
>  exit();
> }
> if (mysql_num_rows($qry) > 0) {
>for ($i = 0; $iecho "" . mysql_field_name($qry, $i) .
> "";   echo "" .
mysql_field_name($qry,
> $i) . "";
>}
> }
>
> ?>
>
> 
> if (mysql_num_rows($qry) > 0) {
>for ($j = 0; $j
>?>
>for ($k = 0; $kecho "" . mysql_result($qry,$j, $k) . "";
>}
>
>?>
>}
> }
>
> ?>
>
> [/snip]
>
> cheers
>
> -Z
>
> -- 
> 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] PHP Classes to generate Excel files ?

2004-12-22 Thread Ignatius Reilly
There is also the very good PEAR Excel Writer class.
http://pear.php.net/package/Spreadsheet_Excel_Writer

Ignatius

- Original Message - 
From: "John Holmes" <[EMAIL PROTECTED]>
To: "Stéphane Pinel" <[EMAIL PROTECTED]>; "'PHP DB'"

Sent: 22 December 2004 20:54
Subject: Re: [PHP-DB] PHP Classes to generate Excel files ?


> > From: Stéphane Pinel <[EMAIL PROTECTED]>
>
> > I'm looking for PHP classes (free or cheap) that are able to generate
> > Excel files (XML?) with a minimum
> > of customization capabilities (styles, borders, colors...).
>
> http://www.web-aware.com/biff/
>
> This has been around quite a while. I don't if it's still being actively
developed or kept up to date or what, though...
>
> ---John Holmes...
>
> UCCASS - PHP Survey System
> http://www.bigredspark.com/survey.html
>
> -- 
> 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] flytte bsd harddisk til anden pc

2002-12-12 Thread Ignatius Reilly
なるほど.
私も,そう言う問題に会った.

Ignatius

- Original Message -
From: "Martin Allan Jensen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 12, 2002 2:26 PM
Subject: [PHP-DB] flytte bsd harddisk til anden pc


Hej Allesammen, har et strt problem, jeg skal IDAG skifte server, men kan
jeg bare tage mine harddiske med FreeBSD på og smide over i den nye maskine
og så vil det køre eller 


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




Re: [PHP-DB] Selecting more than asked for

2002-12-14 Thread Ignatius Reilly
$SQL = " SELECT * FROM resources where unit_id='{$unit_id}' order by level
";

Ignatius

- Original Message -
From: "Alex Francis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 14, 2002 8:37 PM
Subject: [PHP-DB] Selecting more than asked for


> When using the statement below, as well as getting the data corresponding
to
> $unit_id, I also get any data where unit_id field is blank. I have tried
> various permutations of unit_id IS NOT NULL, but get syntax errors. Can
> someone help to get the syntax correct.
>
> $SQL = " SELECT * FROM resources where unit_id='$unit_id' order by level
";
>
>
>
>
> --
> 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] Get error message, need help

2002-12-16 Thread Ignatius Reilly
You should write:

$myquery = "SELECT * FROM user WHERE username = '{$user}' ..." ;

As a bonus, it is much more readable.

Ignatius

- Original Message -
From: "David" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 16, 2002 2:16 AM
Subject: [PHP-DB] Get error message, need help


> Hello all,
>
> I am new to PHP so I am going to need some help.
>
> I am trying to create a admin login page. But I am getting this error
> message:
>
> Parse error: parse error, unexpected T_VARIABLE in c:\program files\apache
> group\apache\htdocs\sunwestsilver\admin\tmpi5pcf76sy9.php on line 43
>
> tmpi5pcf76sy9.php is generated by Dreamweaver MX as a temp file from
> admin.php
>
> It is coming  from this line:
>
> this is line 43 code
>
> # $myquery = .'" AND password = '" . crypt($password, "xpz8ty") . "'";
>
> The complete code is:
>
> // Query Database with username and encrypted password
>   #$myquery = "SELECT * FROM user WHERE username = '" . $user
>   #$myquery = .'" AND password = '" . crypt($password, "xpz8ty") . "'";
>   #$result = mysql_query($myquery);
>   #if (!$result)
>   #{
>   #  $error = "Cannot run Query";
>  #return($error);
>   #}
>
> Any help will be nice.
>
> I got this code from Dreamweaver MX: PHP Web Development pg. 257
>
> Thanks
>
> David
>
>
>
> --
> 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] trees in MySQL

2002-12-19 Thread Ignatius Reilly
The difficulty you are being confronting could be alleviated by using an XML data 
model (meaning non relational). Of course, I don't know about your requirements, but 
it could be a direction worth investigating.

I use the php_xslt.dll (sablotron) extension, which I find works quite pleasantly.

Ignatius

  - Original Message -
  From: "José Moreira" <[EMAIL PROTECTED]>
  To: "Php-Db (Correio electrónico)" <[EMAIL PROTECTED]>
  Sent: Thursday, December 19, 2002 11:45 AM
  Subject: [PHP-DB] trees in MySQL


  > hello im implementing a portal and im choosing between the 'Nested Set'
  and
  > 'Adjacency Lists tree' models.
  > 
  >
  >
  > im perfectly aware of the 'Adjacency Lists tree' model how-to and I am
  > studying the 'Nested Set', example follows :
  >
  > CREATE TABLE LanguageTree (
  >
  >   Language VARCHAR(255) PRIMARY KEY
  > , Parent VARCHAR(255)
  > , Lft LONG
  > , Rgt LONG
  > , INDEX idxLft (Lft)
  > , INDEX idxRgt (Rgt)
  > ) Comment = "Related languages";
  >
  >
  > A[1 12]
  >   /  \
  > /   \
  > B[2 3]   C[4 11]
  >/  \
  >   /\
  >   D[5 8] F[9 10]
  >  |
  >   E[6 7]
  >
  >
  > my doubt is that if i want to insert a new node, for example 'G' under 'A'
  >
  > A[1 12]
  >   / | \
  > /  \
  > B[2 3]G[]   C[4 11]
  >/ \
  >   /   \
  >   D[5 8] F[9 10]
  >  |
  >   E[6 7]
  >
  >
  > i have? to update almost every left,righ fields after that node, resulting
  > in a website performance downgrade 
  >
  >
  > help? even if thjats the only way, how can i do it? perhaps im getting it
  > wrong ...
  >
  >
  > best regards
  >
  >
  > José Moreira
  > TEGOPI S.A.
  > http://www.tegopi.pt
  >
  >
  >
  >
  >
  >
  >
  >
  >
  > --
  > 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





  1   2   3   >