[PHP-DB] Re: mssql.datetimeconvert bug ?

2002-11-14 Thread Radovan Radic
What format do you want?
You can use
select convert(char(10),date_field,101)
and you will get mm/dd/, or look at the convert function in the SQL
Server Books Online, or
u can use php function date and format whatever you want.

Radovan


Matt Brown [EMAIL PROTECTED] wrote in message
news:MOEHKANCAIEPPJENOOJOOEDOCGAA.matt;ispsolutions.co.uk...
 Hi All,

 We have MS Sql Server 7 running backend and are running our reports via
 PHP 4.2.3 (compiled with freetds), we have the flag
 mssql.datetimeconvert = 0 set in the php.ini, but yet all date/time(s)
 are returned as 'Nov 13 2002 02:26PM'...

 This is driving us mad, everywhere we search for a solution says that
 the flag mssql.datetimeconvert = 0 or Off fixes this problem, however in
 our config it does not ...

 Anyone have any suggestions ?

 Regards

 Matt Brown
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.417 / Virus Database: 233 - Release Date: 08/11/2002




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




RE: [PHP-DB] Best reporting Tool

2002-11-14 Thread Ruprecht Helms

Hi  Mohammad Saad,

 [...] or should I use conventional method of writing database queries

if you want to use mysql you can use phpMyAdmin

[...]but still is there any other better way out, are
 Oracle Reports supported in PHP?

I dont think that php has a feature to support Oracle Reports. But I have
heard that php is able to use Oracle. The tools of Oracle are using Java 
and some of them base on jsp.

Regards,
Ruprecht


--
Ruprecht Helms IT-Service und Softwareentwicklung

Tel/Fax.:  +49[0]7621 16 99 16
Homepage:  http://www.rheyn.de
email:  [EMAIL PROTECTED]
--

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




Re: [PHP-DB] can i create an Access table or mdb with PHP?

2002-11-14 Thread Richard Allsebrook
Building on John idea with a few of my own (from a real word system I've
developed...)

Creating a blank MDB from scratch is particularly painful - so, like John
said - start with a ready made template.

Next make a copy with a unique name (there are loads of ways of doing this,
timestamps, uniqid()...) and populate the copy.

Send the copy to your user

You will end up with copies littering your site, so at the start of the
population phase, run some 'tidy up code' which deletes any old databases
(older than a day say).

Hope this helps.


--
Richard Allsebrook
Applications and Web Development


Anthony [EMAIL PROTECTED] wrote in message
news:3DD2A538.8090502;attechcomputer.com...
 You could use ODBC to do it.  Create a template access DB, poulate it
 with ODBC, then read the file and send it to the user.  After it's
 downloaded clear the table.  the downside to this is that you would only
 be able to haev one user ata time get an access database.  I'm sure
 there are better ideas, but this would work.

 - Anthony

 John A Davis wrote:
  I'm trying to supply our Contract Counties with mailing labels, already
formatted. They log on to our website and PHP will hit our SQL Server and
return a list of Public Water Systems for the County chosen. I would like a
link on this page that says something like Send me an Access .mdb with
mailing labels for these systems. PHP would delete whatever is in stock
Access .mdb table somewhere on our system and replace the rows with newer,
current ones, specific to the County chosen(same query that displays the
systems in HTML). The Access .mdb that gets downloaded will have a report
formatted for Avery 5160 labels, bound to the newer table that was filled.
All they have to do is adjust their printer settings.
 
  Does anyone have an easier way of supplying data formatted for mailing
labels? If they do, I'm all ears(eyes). Since this is a bonus service, we
don't want to have to have people involved providing this stuff to our
counties.
 
  tia
  John Davis
  IIS State of Oregon
  Drinking Water Program
 
 
 
 [EMAIL PROTECTED] 11/12/02 09:12PM 
 
  On Tue, 12 Nov 2002, John A DAVIS wrote:
 
 
 Want to give the user the ability to download a dynamic Access.mdb file
 that has a table and linked report formatted for Avery 5160 labels. Know
 how to create all this stuff in VBA code, but not using PHP.
 
 
   It is better to give too much information than not enough.
 
   You are trying to generate a dynamic Access.mdb file on the fly, using
   PHP?  Or you are trying to deliver this already existing file that
changes
   sometimes with PHP?  Or you are trying to do something else?
 
   If the first option, where is your data coming from?
 
   If the second, why are you trying to use PHP instead of just linking to
   the Access.mdb file via the web server?
 
  Peter

 --
-
  Peter BeckmanSystems Engineer, Fairfax Cable Access
Corporation
  [EMAIL PROTECTED]
http://www.purplecow.com/

 --
-
 
 





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




Re: [PHP-DB] A Question on Javascript

2002-11-14 Thread Jeffrey_N_Dyke


The relationsionship can be maintained by window.opener from within the
child wildow - parent window, and the simply the name of the window you
assigned can be used when going from the parent window - child window.

hth
jeff




   
 
Shahmat Dahlan 
 
shahmatd@sain   To: PHP DB Mailing List 
[EMAIL PROTECTED] 
s.com.mycc:   
 
 Subject: [PHP-DB] A Question on 
Javascript 
11/14/2002 
 
01:27 AM   
 
   
 
   
 




I have a question on Javascript, if you don't mind.

Say if I have a main page, whereby I would also have a html form which
contains a button. Let's call it main document.

When I click on the button it will open a new window, which refers to
another html page. Now, let's call it child document.
Now on this html page, say, I would like to search for an e-mail address,
and returns the value of the e-mail address from the child document
to the main document.

Regards and thanks in advance.


(See attached file: smime.p7s)



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


Re: [PHP-DB] a menu item from a database, linked to a list from a anothertable

2002-11-14 Thread chip . wiegand

Jason Wong [EMAIL PROTECTED] wrote on 11/13/2002 10:46:32 PM:

 On Thursday 14 November 2002 07:32, [EMAIL PROTECTED] wrote:
  Is this even possible? I have a menu that is generated from a table.

 What is your menu -- a set of a tags? or a selector box? I suspect you
mean
 the latter ...

Not a list box, but a menu of about 15 category titles, all shown on the
page in
a list, click on category get the category items listed. Both the category
titles
and the individual items will come from a database.
I am trying this to make a faq's page - list the faq categories, click on
the
category and get the list of faq's. The first part is easy, the second part
is
easy, both seperately.
I am wondering if I can make the first part (title) be a link to select the
items
for the category from a database. I've seen this done before, but the app I
was
looking at had so many include files referencing other include files that
getting
it all straight was near impossible.

--
Chip

  Typically, the menu items are links
  to html pages. I would like to have the link bring up a list of items
from
  another table in the database,
  not an html page. So I guess this would be a select statement linked
from a
  select statement?
  Is this even possible?

 Yes, google - dynamic linked listbox php.

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


 /*
 The early bird who catches the worm works for someone who comes in late
 and owns the worm farm.
   -- Travis McGee
 */


 --
 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 data to MySql

2002-11-14 Thread Coert Metz
Hi

Never forget to include enctype=multipart/form-data into your formtag

Bye

Coert

Jason Wong wrote:

On Thursday 14 November 2002 04:47, Seabird wrote:


Hi everyone,

I don't get my upload to work properly. It's a tutorial of the web, but it
doesn't function (unless I made a mistake). 


HOW doesn't it function?



Please help me...



You have to provide more information, like what you see when you submit the 
form and whether there were any error messages etc.

For starters, you should always set error reporting to MAX, and log errors to 
a file (if you're not displaying it to screen). These can be set in php.ini.

Next use print_r() on all your important variables at strategic places in your 
code so you can verify that they contain what you expect them to contain.



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




Re: [PHP-DB] Shopping Cart Sessions - Think this is a simple prolem- hopefully

2002-11-14 Thread Peter Beckman
1. Are you 100% sure register_globals is turned on?
2. You session_register your variable before you change it.  Replace
$ShoppingCart with $_SESSION[ShoppingCart] every time you use it.  This way
you are modifying the session variable actually in the session, not just
the one time.

   session_register() copies the named variable into the session space, but
   adding or removing items from that variable does NOT change it in the
   session if you use _register.  If you modify $_SESSION[shoppingcart]
   every time, then you are actually reading/writing to the real session
   variable and don't have to worry about it.

Peter

On Thu, 14 Nov 2002, Boa Constructor wrote:

 Evening all, I'm pretty stumped with this basic shopping cart I'm trying
 to integrate into my site, if u wanna see what I'm on about visit
 http://www.hostmaster-x.co.uk/Products.php.  On my products script I've
 got the following:
 [...]
 Of course I need a link so that I can buy a product, so I've got the following in a 
loop:
 echo a href=$PHP_SELF?buy=$iBuy/aBR;

 The link works fine for each product, the problem is that the ID of the
 product doesn't seem to be stored in the session and I get a whole pile
 of mysql errors which don't appear in the same page when products are
 displayed.  The errors highlight the following code:

 while($ProductDetails = mysql_fetch_array($Q))
 {
 $ProductID = $ProductDetails[ID];
 $ProductName = $ProductDetails[ProductName];
 $SellingPrice = $ProductDetails[SellingPrice];
 $ProductPicture = $ProductDetails[PictureOfProduct];
 $AmountInStock = $ProductDetails[AmountInStock];
 $Description = $ProductDetails[ProductDescription];
 $PictureOfProduct = $ProductDetails[PictureOfProduct];
 }
 if(mysql_num_rows($Q)  0)

 Anyone got any ideas? I'm a bit lost as to why this doesn't work.

 G :)

---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---



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




Re: [PHP-DB] Best reporting Tool

2002-11-14 Thread John KRewson

I have recently been creating reports using PHP's pdf libraries. 
Somewhat time consuming to develop them from scratch and the client has 
to have the acrobat reader, but they look slick, I must say.  Another 
option is to create RTF or PDF templates and simply replace certain 
areas with your data.

This might not be what you are looking for, but a couple of places to start:
http://zope1.devshed.com/zope.devshed.com/Server_Side/PHP/PDF/page1.html
http://www.phpbuilder.com/columns/perugini20001026.php3

One nice thing about this is that quite a few people seem to be 
developing classes for this kind of reporting.


Mohammad Saad wrote:

Hi, I wanted to ask a question, Whats the best way of developing reports in
PHP. I mean in case of ASP, developers use Crystal Reports but apparently
PHP doesn't support Crystal Reports. so is there any other tool for me? or
should I use conventional method of writing database queries, PHP paging and
HTML table formatting to generate reports. The reason I am asking is this,
that for a particular project I need to come up with around 175 reports,
Although am sure some of the reports formats will be the same so I can just
switch queries in those. but still is there any other better way out, are
Oracle Reports supported in PHP?

Thanks in Advance
Saad


 



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




RE: [PHP-DB] Best reporting Tool

2002-11-14 Thread Aaron Wolski
I have to agree on the PDF.


Currently my host does not provide for PDF capabilities as of yet but I
believe they are going to be compiling with support for PDF soon.

When they do, look out. The success of some of our commercial apps will
rise for sure as this reporting options becomes available. A lot of our
apps/tools are for customers of our clients... meaning our clients
(marketing and Ad firms) utilize our tools to sell to their clients
therefore a lot of the reports need to be made available to their
clients as well. PDF files will really enhance the client-relationship
thus making it that much stronger and a longer lasting business
relationship (more$).

Just my thoughts.

Aaron

-Original Message-
From: John KRewson [mailto:krewsonj;sworps.utk.edu] 
Sent: November 14, 2002 10:47 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Best reporting Tool


I have recently been creating reports using PHP's pdf libraries. 
 Somewhat time consuming to develop them from scratch and the client has

to have the acrobat reader, but they look slick, I must say.  Another 
option is to create RTF or PDF templates and simply replace certain 
areas with your data.

This might not be what you are looking for, but a couple of places to
start:
http://zope1.devshed.com/zope.devshed.com/Server_Side/PHP/PDF/page1.html
http://www.phpbuilder.com/columns/perugini20001026.php3

 One nice thing about this is that quite a few people seem to be 
developing classes for this kind of reporting.


Mohammad Saad wrote:

Hi, I wanted to ask a question, Whats the best way of developing
reports in
PHP. I mean in case of ASP, developers use Crystal Reports but
apparently
PHP doesn't support Crystal Reports. so is there any other tool for me?
or
should I use conventional method of writing database queries, PHP
paging and
HTML table formatting to generate reports. The reason I am asking is
this,
that for a particular project I need to come up with around 175
reports,
Although am sure some of the reports formats will be the same so I can
just
switch queries in those. but still is there any other better way out,
are
Oracle Reports supported in PHP?

Thanks in Advance
Saad


  



-- 
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] Multiple Inserts with mySQL

2002-11-14 Thread Anthony
hmm, I guess that would work.  There is no way to have mySQL check for 
integrity for me is there?  I read in a SQL book a while ago about 
wrapping multiple inserts in a select statement, that way if any part of 
the statement failed the whole thing would be rolled back.  From my 
research though, it doesn't look like mySQL supports this.  Am I right 
here?  So far it looks like your idea could be the most reliable 
suggestions I've gotten, so I'll start working on that for now.  Thanks.

- Anthony

Peter Beckman wrote:
Try this:

$stack is an array of hashes:

$stack[0] = array(0=tablename, 1=insertid());

For each insert you do, push an anonymous array on $stack which includes
the tablename and insertid of the insert.

Then as you continue your inserts, if any of them fail, call a function
which takes that array $stack, and iterate through it, deleting the rows
you just inserted. (see mysql_insert_id() function to get the insert ID)

If none of them do fail, then you are in the clear.  Either unset $stack or
ignore it.

Peter

On Wed, 13 Nov 2002, Anthony wrote:



I have to drop a lot of data into mySQL from PHP.  It will go into quite
a few different tables.  How can I maintain integrity of the entire
insert?  I need to do about a dozen inserts on four tables and I need to
insure that all the inserts are successful or that none of them get
done.  I'm sort of new at this, so please help me out.  Thanks.

- Anthony


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




---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---




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




Re: [PHP-DB] Multiple Inserts with mySQL

2002-11-14 Thread Anthony
hmm, I guess that would work.  There is no way to have mySQL check for 
integrity for me is there?  I read in a SQL book a while ago about 
wrapping multiple inserts in a select statement, that way if any part of 
the statement failed the whole thing would be rolled back.  From my 
research though, it doesn't look like mySQL supports this.  Am I right 
here?  So far it looks like your idea could be the most reliable 
suggestions I've gotten, so I'll start working on that for now.  Thanks.

- Anthony

Peter Beckman wrote:
Try this:

$stack is an array of hashes:

$stack[0] = array(0=tablename, 1=insertid());

For each insert you do, push an anonymous array on $stack which includes
the tablename and insertid of the insert.

Then as you continue your inserts, if any of them fail, call a function
which takes that array $stack, and iterate through it, deleting the rows
you just inserted. (see mysql_insert_id() function to get the insert ID)

If none of them do fail, then you are in the clear.  Either unset $stack or
ignore it.

Peter

On Wed, 13 Nov 2002, Anthony wrote:



I have to drop a lot of data into mySQL from PHP.  It will go into quite
a few different tables.  How can I maintain integrity of the entire
insert?  I need to do about a dozen inserts on four tables and I need to
insure that all the inserts are successful or that none of them get
done.  I'm sort of new at this, so please help me out.  Thanks.

- Anthony


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




---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---




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




Re: [PHP-DB] Multiple Inserts with mySQL

2002-11-14 Thread Adam Voigt
10 Seconds searching in the MySQL Manual:

http://www.mysql.com/doc/en/ANSI_diff_Transactions.html

You have to use InnoDB tables, but this will work.

On Thu, 2002-11-14 at 11:26, Anthony wrote:
 hmm, I guess that would work.  There is no way to have mySQL check for 
 integrity for me is there?  I read in a SQL book a while ago about 
 wrapping multiple inserts in a select statement, that way if any part of 
 the statement failed the whole thing would be rolled back.  From my 
 research though, it doesn't look like mySQL supports this.  Am I right 
 here?  So far it looks like your idea could be the most reliable 
 suggestions I've gotten, so I'll start working on that for now.  Thanks.
 
 - Anthony
 
 Peter Beckman wrote:
  Try this:
  
  $stack is an array of hashes:
  
  $stack[0] = array(0=tablename, 1=insertid());
  
  For each insert you do, push an anonymous array on $stack which includes
  the tablename and insertid of the insert.
  
  Then as you continue your inserts, if any of them fail, call a function
  which takes that array $stack, and iterate through it, deleting the rows
  you just inserted. (see mysql_insert_id() function to get the insert ID)
  
  If none of them do fail, then you are in the clear.  Either unset $stack or
  ignore it.
  
  Peter
  
  On Wed, 13 Nov 2002, Anthony wrote:
  
  
 I have to drop a lot of data into mySQL from PHP.  It will go into quite
 a few different tables.  How can I maintain integrity of the entire
 insert?  I need to do about a dozen inserts on four tables and I need to
 insure that all the inserts are successful or that none of them get
 done.  I'm sort of new at this, so please help me out.  Thanks.
 
 - Anthony
 
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  
  
  ---
  Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
  [EMAIL PROTECTED] http://www.purplecow.com/
  ---
  
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc



signature.asc
Description: This is a digitally signed message part


Re: [PHP-DB] Best reporting Tool

2002-11-14 Thread Kent Roper
For PDF capabilities for a host that doesn't provide them check out
http://www.ros.co.nz/pdf

They have some free php scripts that you can upload to your server to create
PDF on the fly.
It might not be able to do everything, but I've found it very useful on one
of my sites.


- Original Message -
From: Aaron Wolski [EMAIL PROTECTED]
To: 'John KRewson' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 7:50 AM
Subject: RE: [PHP-DB] Best reporting Tool


 I have to agree on the PDF.


 Currently my host does not provide for PDF capabilities as of yet but I
 believe they are going to be compiling with support for PDF soon.

 When they do, look out. The success of some of our commercial apps will
 rise for sure as this reporting options becomes available. A lot of our
 apps/tools are for customers of our clients... meaning our clients
 (marketing and Ad firms) utilize our tools to sell to their clients
 therefore a lot of the reports need to be made available to their
 clients as well. PDF files will really enhance the client-relationship
 thus making it that much stronger and a longer lasting business
 relationship (more$).

 Just my thoughts.

 Aaron

 -Original Message-
 From: John KRewson [mailto:krewsonj;sworps.utk.edu]
 Sent: November 14, 2002 10:47 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Best reporting Tool


 I have recently been creating reports using PHP's pdf libraries.
  Somewhat time consuming to develop them from scratch and the client has

 to have the acrobat reader, but they look slick, I must say.  Another
 option is to create RTF or PDF templates and simply replace certain
 areas with your data.

 This might not be what you are looking for, but a couple of places to
 start:
 http://zope1.devshed.com/zope.devshed.com/Server_Side/PHP/PDF/page1.html
 http://www.phpbuilder.com/columns/perugini20001026.php3

  One nice thing about this is that quite a few people seem to be
 developing classes for this kind of reporting.


 Mohammad Saad wrote:

 Hi, I wanted to ask a question, Whats the best way of developing
 reports in
 PHP. I mean in case of ASP, developers use Crystal Reports but
 apparently
 PHP doesn't support Crystal Reports. so is there any other tool for me?
 or
 should I use conventional method of writing database queries, PHP
 paging and
 HTML table formatting to generate reports. The reason I am asking is
 this,
 that for a particular project I need to come up with around 175
 reports,
 Although am sure some of the reports formats will be the same so I can
 just
 switch queries in those. but still is there any other better way out,
 are
 Oracle Reports supported in PHP?
 
 Thanks in Advance
 Saad
 
 
 
 


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




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





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




[PHP-DB] Move PDFs

2002-11-14 Thread Natividad Castro
Hi to all,
I have an Access DB with a table call newchecklist. On this table I have a
field call PDF where I have many PDFs.
What I'm trying to do is to move all these PDFs into different folders.
For example, if I have a folder name VA, so my query will be:

SELECT STATE FROM newcheklist WHERE STATE='VA';

Once I get these records, I would like to move these PDFs to the VA folder.

Is there a way to do this?

Any idea or reference how can I start this, is greatly appreciate.

Thanks in advance
Nato



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




Re: [PHP-DB] Shopping Cart Sessions - Think this is a simple prolem- hopefully

2002-11-14 Thread Boa Constructor
Peter, thanks for your reply.  I'm 100% unsure that register_globals is
turned on.  I've not tried any of your points as for some reason my code
works and my errors have somehow disappeared.  It simply doesn't make any
sense.  Although I did email my web host to see if register_globals were
turned on and they may have done this, but I'm thinking its not that as
nobody has got back to me.  I printed out the contents of the $buy variable
and it contained exactly  what I expected it to so it seems to be behaving
as it should, I'm just unsure as to why its working now - bizarre!  Even
when I passed the Catagory/Interests ID along with the product ID in the
URL, that still produced errors but I wasn't going to stay up any later to
try and solve it.  All I know is last night is didn't work and now it does !


Thanks again for your reply.

Graeme :)

- Original Message -
From: Peter Beckman [EMAIL PROTECTED]
To: Boa Constructor [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, November 14, 2002 3:41 PM
Subject: Re: [PHP-DB] Shopping Cart Sessions - Think this is a simple
prolem- hopefully


 1. Are you 100% sure register_globals is turned on?
 2. You session_register your variable before you change it.  Replace
 $ShoppingCart with $_SESSION[ShoppingCart] every time you use it.
This way
 you are modifying the session variable actually in the session, not
just
 the one time.

session_register() copies the named variable into the session space,
but
adding or removing items from that variable does NOT change it in the
session if you use _register.  If you modify $_SESSION[shoppingcart]
every time, then you are actually reading/writing to the real session
variable and don't have to worry about it.

 Peter

 On Thu, 14 Nov 2002, Boa Constructor wrote:

  Evening all, I'm pretty stumped with this basic shopping cart I'm trying
  to integrate into my site, if u wanna see what I'm on about visit
  http://www.hostmaster-x.co.uk/Products.php.  On my products script I've
  got the following:
  [...]
  Of course I need a link so that I can buy a product, so I've got the
following in a loop:
  echo a href=$PHP_SELF?buy=$iBuy/aBR;
 
  The link works fine for each product, the problem is that the ID of the
  product doesn't seem to be stored in the session and I get a whole pile
  of mysql errors which don't appear in the same page when products are
  displayed.  The errors highlight the following code:
 
  while($ProductDetails = mysql_fetch_array($Q))
  {
  $ProductID = $ProductDetails[ID];
  $ProductName = $ProductDetails[ProductName];
  $SellingPrice = $ProductDetails[SellingPrice];
  $ProductPicture = $ProductDetails[PictureOfProduct];
  $AmountInStock = $ProductDetails[AmountInStock];
  $Description = $ProductDetails[ProductDescription];
  $PictureOfProduct = $ProductDetails[PictureOfProduct];
  }
  if(mysql_num_rows($Q)  0)
 
  Anyone got any ideas? I'm a bit lost as to why this doesn't work.
 
  G :)

 --
-
 Peter BeckmanSystems Engineer, Fairfax Cable Access
Corporation
 [EMAIL PROTECTED]
http://www.purplecow.com/
 --
-




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




Re: [PHP-DB] a menu item from a database, linked to a list from a another table

2002-11-14 Thread Jason Wong
On Thursday 14 November 2002 23:17, [EMAIL PROTECTED] wrote:
 Jason Wong [EMAIL PROTECTED] wrote on 11/13/2002 10:46:32 PM:
  On Thursday 14 November 2002 07:32, [EMAIL PROTECTED] wrote:
   Is this even possible? I have a menu that is generated from a table.
 
  What is your menu -- a set of a tags? or a selector box? I suspect you

 mean

  the latter ...

 Not a list box, but a menu of about 15 category titles, all shown on the
 page in
 a list, click on category get the category items listed. Both the category
 titles
 and the individual items will come from a database.
 I am trying this to make a faq's page - list the faq categories, click on
 the
 category and get the list of faq's. The first part is easy, the second part
 is
 easy, both seperately.

Right, so make your links something like:

  http://www.example.com/faq.php?category=3

Your page then uses $_GET['category'] to builds a query to extract the items 
in the selected category.

Then it builds links which looks something like:

  http://www.example.com/faq.php?category=3item=2


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


/*
It may be that our role on this planet is not to worship God but to
 create him.
 -Arthur C. Clarke
*/


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




Re: [PHP-DB] upload data to MySql

2002-11-14 Thread Anthony
Just wrote an app that does this myself.  Loads inmages/movies/audio and 
what not into a database.  I've posted the code below, feel free to try 
it out.  This file does all the uploading.  It took me a while to figure 
out how to do this, so don;t worry it it seams like it's tough.  I 
actualy store the files dirrectly in the databse in a longblob, it may 
be better to save the files in a folder (how I most people do it).  Feel 
free to ask any questions you have.  The app is in beta right now, it 
will go on www.supras.com when its done.

HTH - Anthony

?php
/* add.php  -- part of the SOGI website media module
   writen by Knightrider version 1.0 9-24-02

   This script will alow a user to upload files into the database
*/

// lets include some files so that this crap will work
include 'database.inc';
include 'functions.inc';

// get some info from the config record so we know about upload settings
getConfig();
//echo preDiag mode:BR;
//print_r($HTTP_POST_VARS);

  if (empty($_POST['short']) || empty($_FILES['newfile']) || 
empty($_POST['gen']) || empty($_POST['category']))
  {
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN 
http://www.w3.org/TR/html4/loose.dtd;
html
head
  titleSOGI Media Module - Upload a file/title
	  link rel='stylesheet' type='text/css' href='media.css'
/head
body
	table border='0' width='100%'
		tr
			td width='50%' valign='top'class='pageheader'
Media - Add a file
			/td
			td width='50%' 
			
			/td
		/tr
	/table
	HR class='headertxt'
	table width='500' class='border'
	tr
	td align='center'
form method='post' action='add.php' enctype='multipart/form-data'
	
	Upload an Image File
	Please fill in the details below to upload your file.BR
		Fields shown in font class='bad'red/font are mandatory.
	
		?
			if (isset($_POST['submit']))
echo p class='bad'You did not enter info into a required field!/p;
		?
	
table width='100%' class='border'
col span='1' align='right'

tr
	td valign='top'
	   		font class='bad'Short description:/font
		/td
   	td
			input type='text' name='short' size=50BR
	/tr
	tr
		td
			Long Description
		/td
		td
			textarea rows='5' name='longdesc' cols='33'/textareaBR
		/td
	/trtr
		td
			Uploaded by:
		/td
		tdinput type='text' name='user' cols='33'
		/td
	/trtr
		td
	   font class='bad'Select a Car Type/font
	   /td
	   tdselect size='1' name='gen' class='smalltext'
			option selected Select One/option
? catDropDown('1'); ?
			/select
	/trtr
		td
			font class='bad'Select a media depiction/font
		/tdtd
			select size='1' name='category' class='smalltext'
option selected Select One/option
? catDropDown('2'); ?
	 /select	
	   /td
/tr

tr
   tdfont class='bad'File:/font/td
   tdinput name='newfile' type='file'/td
/tr
	tr
  td align='right'
	   input type='hidden' name='MAX_FILE_SIZE' value='16777216'
	   input name='submit' class='smalltext' type='submit' value='Upload 
your file'
	  /td
/tr
/table
	/td
	/tr
	/table
	/form
div align=center
 	 table border=0 width=300 cellspacing=0 cellpadding=0
 		tr
  td width=100% align=center class=smalltext
hr class=headertxt
a href=default.phpBrowse Media/a
/td
/tr
  /table
/div
/body
/html
?php
  }
  else
  {


	$s=;	// set the var blank to add to query
 // Was a file uploaded?
	if (is_uploaded_file($_FILES['newfile']['tmp_name']))
	{			
			// open and read the uploaded file
			$file1=fopen($_FILES['newfile']['tmp_name'], r);
			$file=fread($file1, $_FILES['newfile']['size']);

			// Escape special characters in the file
			$file=AddSlashes($file);
			
			$tmp=split('/',$_FILES['newfile']['type']);
			if ($tmp[0]=='image')
{
	$size = getimagesize($_FILES['newfile']['tmp_name']);
	$s=,width='{$size[0]}', height='{$size[1]}';
}		
			
		}
	else
$file=NULL;

	$insertQuery = INSERT INTO media_files SET
	 
	shortdesc='{$_POST['short']}',
		longdesc='{$_POST['longdesc']}',
		username='{$_POST['user']}',
		mimetype='{$_FILES['newfile']['type']}',
		filedata='{$file}',
		filesize='{$_FILES['newfile']['size']}',
		filename='{$_FILES['newfile']['name']}',
		uploaded=CURDATE(),
		category1='{$_POST['gen']}',
		category2='{$_POST['category']}'		
		;
	$insertQuery.=$s;
	// check for unknown file type, if it's unknown, automatically censor it.		
	$foo=split(/,$_FILES['newfile']['type']);
	if (AUTOCENSOR or !($foo[0]==image or $foo[0]==video or 
$foo[0]==audio))
		$insertQuery.=, censor='t';
		
if ((doQuery($insertQuery)))
	 
	{
			// @ mysql_affected_rows() == 1)
			$lastid=mysql_insert_id();
			$statement=INSERT INTO media_stats SET id=$lastid;
			if ((doQuery($statement)))
{
				header(Location: receipt.php?status=Tfile=$lastid);		
}
			else
{
	echo getError(); 

}
		}
 else
	 
	echo getError();
  }
?


HTH - Anthony






Boa Constructor wrote:

[PHP-DB] Code for File Upload

2002-11-14 Thread wade
I have been seeing a lot of talk about file uploads.
I wrote the following code and it works well when uploading images. The
actual image is not stored in the database just the name of the image.
When you want to view the image just query the database and include the
database variable in your IMG SRC tag.
IMG SRC = http://www.path to image $image_name.

?
// includes
include(config.php);
?

?
// Validate entries
if ($_REQUEST[pic_category] == )
{
echo Must enter a Category for the pictures to go in.;
exit;
}
if ($_FILES['userfile']['size'] == 0)
{
echo No size;
exit;
}
if ($_FILES['userfile']['type'] == text/plain)
{
echo cannot upload text it must be an image;
exit;
}

// Set Name of Image for Database entry. This comes from the input
fields in the HTML form.
$pic_1 = $_FILES['userfile']['name'];
$pic_2 = $_FILES['userfile_2']['name'];
$pic_3 = $_FILES['userfile_3']['name'];
$pic_4 = $_FILES['userfile_4']['name'];
$pic_5 = $_FILES['userfile_5']['name'];
$pic_6 = $_FILES['userfile_6']['name'];

// Path to where images are to be uploaded
$upfile = /home/SOMEWHERE/php/photos/.$_FILES['userfile']['name'];
$upfile_2 = /home/SOMEWHERE/php/photos/.$_FILES['userfile_2']['name'];

$upfile_3 = /home/SOMEWHERE/php/photos/.$_FILES['userfile_3']['name'];

$upfile_4 = /home/SOMEWHERE/php/photos/.$_FILES['userfile_4']['name'];

$upfile_5 = /home/SOMEWHERE/php/photos/.$_FILES['userfile_5']['name'];

$upfile_6 = /home/SOMEWHERE/php/photos/.$_FILES['userfile_6']['name'];

// Upload files to the $upfile Directory
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
move_uploaded_file($_FILES['userfile']['tmp_name'], $upfile);
move_uploaded_file($_FILES['userfile_2']['tmp_name'],
$upfile_2);
move_uploaded_file($_FILES['userfile_3']['tmp_name'],
$upfile_3);
move_uploaded_file($_FILES['userfile_4']['tmp_name'],
$upfile_4);
move_uploaded_file($_FILES['userfile_5']['tmp_name'],
$upfile_5);
move_uploaded_file($_FILES['userfile_6']['tmp_name'],
$upfile_6);
}
else
{
echo Possible file upload attack. Filename:  .
$_FILES['userfile']['name'];
}

// Print out the files that were uploaded
echo file was uploaded BR  . $_FILES['userfile']['name'];
echo BR  . $_FILES['userfile_2']['name'];
echo BR  . $_FILES['userfile_3']['name'];
echo BR  . $_FILES['userfile_4']['name'];
echo BR  . $_FILES['userfile_5']['name'];
echo BR  . $_FILES['userfile_6']['name'];
?

?
// open connection to database
$connection = mysql_connect($hostname, $user, $pass) or die (Unable to
connect!);

// Place the picture name and captions in the database
$query = INSERT INTO table name and so on and so
on

Hope this will helps!

Wade

--
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-DB] serious help with linking data together...

2002-11-14 Thread Aaron Wolski
Hey all,

Been trying too figure this out all day.

First off I'll explain what I am TRYING to do.


I am creating a Search Engine Tracking Report that lists keywords and
the Search Engines used on that keyword along with the count total for
that search Engine - example:


Keyword Search Engine   Count

Web hosting Yahoo
27
Google
20
MSN
12

Web Design  Overture
30
MSN
17



So on and so forth.


Seems simple right? But no not for me!

CODE:

?php

$keyQuery = db_query(SELECT keyword, COUNT(keyword) as kTotal
FROM SiteTrackingTable WHERE $query GROUP BY keyword);
while ($keyResult = db_fetch($keyQuery)) {

if (strlen($keyResult[keyword])  2) {

$refQuery = db_query(SELECT *, COUNT(referer)
as refTotal FROM SiteTrackingTable WHERE keyword=.$keyResult[keyword].
GROUP BY referer ORDER BY refTotal DESC);
$nrows = db_numrows($refQuery);

?

tr valign=top

td class=content2?php echo $keyResult[keyword]; ?/td

td colspan=2

table border=0 cellpadding=0 cellspacing=0 width=250

tr valign=top

tdimg src=../Graphics/spacer.gif  width=150 height=1/td

tdimg src=../Graphics/spacer.gif  width=100 height=1/td

/tr
?php

while ($refResult = db_fetch($refQuery)) {

?

tr valign=top

td class=content2?php echo $refResult[referer]; ?/td

td class=content2 align=center?php echo $refResult[refTotal];
?/td

/tr
?php

}

?

/table


/td

/tr
?php

}


}

?


If this is too messed up let me know and I'll reformat.

Sorry guy the annoying question guys.

Aaron





Re: [PHP-DB] Move PDFs

2002-11-14 Thread Peter Beckman
http://www.php.net/manual/en/function.rename.php

You are just moving files on a file system from one place to another right?

rename(/old/path/to/file/filename.pdf,/new/path/newfilename.pdf) or die(can't 
move file);

Can't remember what variable/function holds the last error for rename,
otherwise I'd put it there.

Peter

On Thu, 14 Nov 2002, Natividad Castro wrote:

 Hi to all,
 I have an Access DB with a table call newchecklist. On this table I have a
 field call PDF where I have many PDFs.
 What I'm trying to do is to move all these PDFs into different folders.
 For example, if I have a folder name VA, so my query will be:

 SELECT STATE FROM newcheklist WHERE STATE='VA';

 Once I get these records, I would like to move these PDFs to the VA folder.

 Is there a way to do this?

 Any idea or reference how can I start this, is greatly appreciate.

 Thanks in advance
 Nato



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


---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




[PHP-DB] Re: a menu item from a database, linked to a list from a another table

2002-11-14 Thread David Robley
In article OF48D424BD.87A6C8FB-ON88256C70.0080DCAD-
[EMAIL PROTECTED], [EMAIL PROTECTED] says...
 Is this even possible? I have a menu that is generated from a table.
 Typically, the menu items are links
 to html pages. I would like to have the link bring up a list of items from
 another table in the database,
 not an html page. So I guess this would be a select statement linked from a
 select statement?
 Is this even possible?
 
 --
 Chip Wiegand
 Computer Services
 Simrad, Inc
 www.simradusa.com
 [EMAIL PROTECTED]

The concept would be to pass a value(s) in the link which would enable you 
to construct the appropriate query in the called page.

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP-DB] Re: upload data to MySql

2002-11-14 Thread Seabird
Thanx, I found out I forgot to pass it to my db.

Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
David Robley [EMAIL PROTECTED] wrote in message
news:MPG.183f2f6ec46a84169897c8;news.php.net...
 In article [EMAIL PROTECTED], [EMAIL PROTECTED]
 says...
  Hi everyone,
 
  I don't get my upload to work properly. It's a tutorial of the web, but
it
  doesn't function (unless I made a mistake). Please help me...
  I have a form passing on 5 fields (text for testing), name: year, make,
  model, price, picture and submit to PHP_SELF
 
  ?php
  if ($submit) {
 
  $db = mysql_connect(localhost,myname,mypassword);
 
  mysql_select_db($test,$db);
  //DB Test for testing...
 
  $sql = INSERT INTO test (year,make,model,price,picture) VALUES
  ('$year,$make,$model,$price,$picture');

 This line looks like your first problem. Each value being inserted which
 is a text type should be separately surrounded by single quotes. So:

  ('$year','$make','$model','$price','$picture');

 As a debugging aid, use

 echo mysql_error()

 after you pass the query to mysql with mysql_query() I don't see where you
 actually do that in this code snippet??

  //I created these columns in the table test
 
 
  echo year: $yearbr\n;
  echo make: $makebr\n;
  echo model: $modelbr\n;
  echo price: $pricebr\n;
  echo picture: $picturebr\n;
  }
 
  ?
 
  I know I need globals on for this.
  Thanx for the help,

 --
 David Robley
 Temporary Kiwi!

 Quod subigo farinam



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




Re: [PHP-DB] storing(/retrieving) HTML from textbox fields

2002-11-14 Thread Marco Tabini
Hi Gavin,

Have you tried escaping your input? Take a look at the following:

http://ca.php.net/manual/en/function.mysql-real-escape-string.php

It should help you take care of the problem.


Marco

-- 

php|architect - The magazine for PHP Professionals
The first monthly worldwide magazine dedicated to PHP programmers
Check us out on the web at http://www.phparch.com


On Thu, 2002-11-14 at 22:29, Gavin Amm wrote:
 Hi,
 
 I'm having some trouble storing html into a MySQL table, it is typed into a
 html 'textarea'.
 actually, i can't even get basic text to be stored from the textarea.
 
 the mysql_query() works fine with standard text input fields alone.
 i try and insert the textarea data in the same way as i do the text fields,
 but it doesn't work.
 
 i am trying to store the textarea data (html code typed into the textarea by
 a user) into a longtext SQL field atm. is that correct? i've heard a lot
 about storing non-standard data into blobs of recent...
 
 Is it because the textarea spans multiple lines and contains quote marks
 (amongst other characters that PHP or MySQL might not like...)?
 
 
 ...Would retrieving the data from the table be any different once i've got
 it in there?
 maybe i'd need to use mysql_fetch_array($result) instead of
 mysql_fetch_row($result) to get all of the data across?
 
 
 thanks guys,
 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