Re: [PHP] Question about creating php files from a form

2010-05-15 Thread Lester Caine

Kevin wrote:

I am having some issues with connecting to a SQLite database right now
... I'm getting the following error Fatal Error: 'sqlite_open' is an
unknown function
But I'm putting that on the side right now.


I think the docs are still screwed up. Try sqlite3_open() instead and
see if that works. Also, check phpinfo() to see if the SQLite/SQLite3
modules are loaded.


I tried with sqlite3_open() and it gave the same error.


 THEN ... 'check phpinfo()'
Obviously sqlite extension is not actually loaded.
You don't aey which OS ... On windows there are a list of extensions in the 
php.ini file, just 'uncomment' the one(s) you need ...


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



RE: [PHP] Question about creating php files from a form

2010-05-15 Thread Lawrance Shepstone
Kevin wrote:
 I am having some issues with connecting to a SQLite database right now
 ... I'm getting the following error Fatal Error: 'sqlite_open' is an
 unknown function
 But I'm putting that on the side right now.

 I think the docs are still screwed up. Try sqlite3_open() instead and
 see if that works. Also, check phpinfo() to see if the SQLite/SQLite3
 modules are loaded.

 I tried with sqlite3_open() and it gave the same error.

  THEN ... 'check phpinfo()'
Obviously sqlite extension is not actually loaded.
You don't aey which OS ... On windows there are a list of extensions in the 
php.ini file, just 'uncomment' the one(s) you need ...

-- 
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

__

There is no sqlite3_open() - there is only an OOP interface for php_sqlite3.

I wrote to the list in frustration about this choice not too long ago, and
concluded that the only way to accomplish this is to:

1.) Use php-sqlite3 extension (not to be confused with the php_sqlite3 -
dash vs underscore) - but this isn't a great solution because it would mean
you would need to ask your host to enable a custom extension, which they
usually don't do. If you're hosting this app on your own server, then give
it a bash.

2.) Otherwise, get involved in PECL development and help give php_sqlite3 a
procedural interface.

Of course, if you're looking for basic database storage, then SQLite2
(php_sqlite) would work fine.

Best of luck,
Lawrance


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



Re: [PHP] Question about creating php files from a form

2010-05-14 Thread Ashley Sheridan
On Thu, 2010-05-13 at 23:53 -0400, Kevin wrote:

 Ashley Sheridan wrote:
  On Thu, 2010-05-13 at 23:07 -0400, Kevin wrote:
  Hello All,
 
  I am trying to figure out how to create files when a user submits a form 
  ...
  I have seen something about '*fopen*' , is that the direction I should 
  be going?
 
  Here is what I am trying to accomplish:
 
  I am creating a program to keep track of recipes for my wife. I have 
  have page set up where she can put the name of the recipe, the 
  ingredients, and the amounts of each ingredient.
  Then she clicks Submit
 
  I would like a html file with the name of the recipe to be created ie 
  *cookies.html  *with a link to the cookies.html created on another page.
  *
  *I hope this makes sense,  and thank you all for your time...
 
  - - Kevin
 
  
 
  It might sound overkill, but I'd use a database for this. All the 
  recipes can be stored in a MySQL database, and then you can use a 
  simple couple of queries to produce the recipe list and the recipe 
  pages dynamically. This also has the advantage that it's very easy to 
  search the recipe list when it becomes larger, and if you ever want to 
  change the layout/presentation of the whole system you won't have to 
  recreate all the recipe pages.
 
  The DB could have several columns labelled: id, name, ingredients, method
 
  So, the form page (lets assume it's called add.php) could submit to 
  itself which then adds the recipe to the DB with a query like:
 
  INSERT INTO recipes(name, ingredients, method) VALUES($name, 
  $ingredients, $method)
 
  This is only a very simple example which could be extended to use 
  another table for ingredients for a recipe. Don't forget to sanitise 
  any input coming from the form with mysql_real_escape_string() for 
  inserting it into the DB.
 
  The list.php page could just use a simple query like:
 
  SELECT id, name FROM recipes
 
  And then create a link to each recipe in the form: 
  recipe.php?recipe=id (where id is the numerical value used in the DB) 
  and that would then use a query like:
 
  SELECT * FROM recipe WHERE id=$recipe
 
  MySQL is available on most hosting that you'll find has support for 
  PHP, and every Linux distribution I've seen has it too.
 
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 Thank you Ash for the quick reply.
 
 I was actually looking at using a database too... and I am testing out a 
 few different ones (SQLite and MySQL)
 I appreciate the extra information, it will be helpful in the future :-)
 
 /On a side note:
 I am having some issues with connecting to a SQLite database right now 
 ... I'm getting the following error Fatal Error: 'sqlite_open' is an 
 unknown function
 But I'm putting that on the side right now.
 
 /I wanted to try a different approach by just creating  the recipes in  
 individual  html files for the time being.
 Do happen to know how to create html files from a php form?
 
 Thank you.
 
 


To create files I'd probably just use fopen() and fwrite(). It's how I
always do it.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Question about creating php files from a form

2010-05-14 Thread Richard Quadling
On 14 May 2010 04:07, Kevin kevin.mailingli...@gmail.com wrote:
 Hello All,

 I am trying to figure out how to create files when a user submits a form ...
 I have seen something about '*fopen*' , is that the direction I should be
 going?

 Here is what I am trying to accomplish:

 I am creating a program to keep track of recipes for my wife. I have have
 page set up where she can put the name of the recipe, the ingredients, and
 the amounts of each ingredient.
 Then she clicks Submit

 I would like a html file with the name of the recipe to be created ie
 *cookies.html  *with a link to the cookies.html created on another page.
 *
 *I hope this makes sense,  and thank you all for your time...

 - - Kevin

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



If you can build the HTML in memory, then you can use ...

file_put_contents('your_file.html', $YourHtml');

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



RE: [PHP] Question about creating php files from a form

2010-05-14 Thread Bob McConnell
From: Kevin

 I am trying to figure out how to create files when a user submits a
form ...
 I have seen something about '*fopen*' , is that the direction I should

 be going?
 
 Here is what I am trying to accomplish:
 
 I am creating a program to keep track of recipes for my wife. I have 
 have page set up where she can put the name of the recipe, the 
 ingredients, and the amounts of each ingredient.
 Then she clicks Submit
 
 I would like a html file with the name of the recipe to be created ie 
 *cookies.html  *with a link to the cookies.html created on another
page.

There are already a number of free applications for this. I have
reviewed over a dozen of them in the past year. Drupal has a recipe
module, Gourmet for Gnome users, Krecipes for KDE users. ReciPants in
Perl, Qookbook, to name a few off the top of my head. Some of them will
link into the USDA Nutrition Database as well. You may not need to
reinvent this particular wheel.

Bob McConnell

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



Re: [PHP] Question about creating php files from a form

2010-05-14 Thread tedd

At 11:07 PM -0400 5/13/10, Kevin wrote:

Hello All,

I am trying to figure out how to create files when a user submits a form ...
I have seen something about '*fopen*' , is that the direction I 
should be going?


Here is what I am trying to accomplish:

I am creating a program to keep track of recipes for my wife. I have 
have page set up where she can put the name of the recipe, the 
ingredients, and the amounts of each ingredient.

Then she clicks Submit

I would like a html file with the name of the recipe to be created 
ie *cookies.html  *with a link to the cookies.html created on 
another page.

*
*I hope this makes sense,  and thank you all for your time...

- - Kevin


Kevin:

Your wife is trying to make cookies?  :-)

Sorry, I couldn't resist.

I recommend the same thing that Ash recommended, namely creating a 
database where your wife can enter the ingredients via a form and 
have those recorded in a database -- a database where one can pull 
the data and show the recipes in any manner you want.


Don't look to saving these data as files, or as cookies, but rather 
as data in a database.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Question about creating php files from a form

2010-05-14 Thread Kevin

Paul M Foster wrote:

On Thu, May 13, 2010 at 11:53:54PM -0400, Kevin wrote:

snip

  

/On a side note:
I am having some issues with connecting to a SQLite database right now
... I'm getting the following error Fatal Error: 'sqlite_open' is an
unknown function
But I'm putting that on the side right now.



I think the docs are still screwed up. Try sqlite3_open() instead and
see if that works. Also, check phpinfo() to see if the SQLite/SQLite3
modules are loaded.

Paul

  

Thanks Paul,
I tried with sqlite3_open() and it gave the same error.

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



Re: [PHP] Question about creating php files from a form

2010-05-13 Thread Ashley Sheridan
On Thu, 2010-05-13 at 23:07 -0400, Kevin wrote:

 Hello All,
 
 I am trying to figure out how to create files when a user submits a form ...
 I have seen something about '*fopen*' , is that the direction I should 
 be going?
 
 Here is what I am trying to accomplish:
 
 I am creating a program to keep track of recipes for my wife. I have 
 have page set up where she can put the name of the recipe, the 
 ingredients, and the amounts of each ingredient.
 Then she clicks Submit
 
 I would like a html file with the name of the recipe to be created ie 
 *cookies.html  *with a link to the cookies.html created on another page.
 *
 *I hope this makes sense,  and thank you all for your time...
 
 - - Kevin
 


It might sound overkill, but I'd use a database for this. All the
recipes can be stored in a MySQL database, and then you can use a simple
couple of queries to produce the recipe list and the recipe pages
dynamically. This also has the advantage that it's very easy to search
the recipe list when it becomes larger, and if you ever want to change
the layout/presentation of the whole system you won't have to recreate
all the recipe pages.

The DB could have several columns labelled: id, name, ingredients,
method

So, the form page (lets assume it's called add.php) could submit to
itself which then adds the recipe to the DB with a query like:

INSERT INTO recipes(name, ingredients, method) VALUES($name,
$ingredients, $method)

This is only a very simple example which could be extended to use
another table for ingredients for a recipe. Don't forget to sanitise any
input coming from the form with mysql_real_escape_string() for inserting
it into the DB.

The list.php page could just use a simple query like:

SELECT id, name FROM recipes

And then create a link to each recipe in the form: recipe.php?recipe=id
(where id is the numerical value used in the DB) and that would then use
a query like:

SELECT * FROM recipe WHERE id=$recipe

MySQL is available on most hosting that you'll find has support for PHP,
and every Linux distribution I've seen has it too.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Question about creating php files from a form

2010-05-13 Thread Kevin

Ashley Sheridan wrote:

On Thu, 2010-05-13 at 23:07 -0400, Kevin wrote:

Hello All,

I am trying to figure out how to create files when a user submits a form ...
I have seen something about '*fopen*' , is that the direction I should 
be going?


Here is what I am trying to accomplish:

I am creating a program to keep track of recipes for my wife. I have 
have page set up where she can put the name of the recipe, the 
ingredients, and the amounts of each ingredient.

Then she clicks Submit

I would like a html file with the name of the recipe to be created ie 
*cookies.html  *with a link to the cookies.html created on another page.

*
*I hope this makes sense,  and thank you all for your time...

- - Kevin




It might sound overkill, but I'd use a database for this. All the 
recipes can be stored in a MySQL database, and then you can use a 
simple couple of queries to produce the recipe list and the recipe 
pages dynamically. This also has the advantage that it's very easy to 
search the recipe list when it becomes larger, and if you ever want to 
change the layout/presentation of the whole system you won't have to 
recreate all the recipe pages.


The DB could have several columns labelled: id, name, ingredients, method

So, the form page (lets assume it's called add.php) could submit to 
itself which then adds the recipe to the DB with a query like:


INSERT INTO recipes(name, ingredients, method) VALUES($name, 
$ingredients, $method)


This is only a very simple example which could be extended to use 
another table for ingredients for a recipe. Don't forget to sanitise 
any input coming from the form with mysql_real_escape_string() for 
inserting it into the DB.


The list.php page could just use a simple query like:

SELECT id, name FROM recipes

And then create a link to each recipe in the form: 
recipe.php?recipe=id (where id is the numerical value used in the DB) 
and that would then use a query like:


SELECT * FROM recipe WHERE id=$recipe

MySQL is available on most hosting that you'll find has support for 
PHP, and every Linux distribution I've seen has it too.


Thanks,
Ash
http://www.ashleysheridan.co.uk



Thank you Ash for the quick reply.

I was actually looking at using a database too... and I am testing out a 
few different ones (SQLite and MySQL)

I appreciate the extra information, it will be helpful in the future :-)

/On a side note:
I am having some issues with connecting to a SQLite database right now 
... I'm getting the following error Fatal Error: 'sqlite_open' is an 
unknown function

But I'm putting that on the side right now.

/I wanted to try a different approach by just creating  the recipes in  
individual  html files for the time being.

Do happen to know how to create html files from a php form?

Thank you.



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



Re: [PHP] Question about creating php files from a form

2010-05-13 Thread Paul M Foster
On Thu, May 13, 2010 at 11:53:54PM -0400, Kevin wrote:

snip

 /On a side note:
 I am having some issues with connecting to a SQLite database right now
 ... I'm getting the following error Fatal Error: 'sqlite_open' is an
 unknown function
 But I'm putting that on the side right now.

I think the docs are still screwed up. Try sqlite3_open() instead and
see if that works. Also, check phpinfo() to see if the SQLite/SQLite3
modules are loaded.

Paul

-- 
Paul M. Foster

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