Hints on SQL...please.

Hello
I have successfully made a sign-up form that sends the data to my email using the PHP feedback form.

Now I would like to try sending the data to an SQL file. I tried MySQL Connect, thinking it would be just as easy as the PHP feedback form, after setting up my SQL database and table at my hosting site. So far, no luck-no record is received. And worse, I see my database and password info in the source of the page! I can’t imagine that is the proper protocol for safe webbing.

So, am I on the wrong path? or just on the first step of a longer path, needing more tools?

Any help appreciated…


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

As a start I suggest you get a good book on php and MySQL, PHP and MySQL Web Development, ISBN 0-672-32525-X is one.

I don’t know if it will help you but I have some * basic * examples of using php and MySQL with Freeway here:
Easibase: PHP/MySQL With Freeway (No great security or error checking implimented, these are for showing the basics only and one way of implimenting php and MySQL with Freeway).

In principal you need to check if the form was a success then add the code that makes the entry to the db, I would also expect the best way to do this would be to write a script that could be included after the success and include it then, you will of course need a db with the relative tables for the data you are passing to the db.

Honestly, get a good book and without going into detail, make sure you read up on the security side of using php and MySQL.

BTW, this is probably more relative to the Dynamo list. :slight_smile:

HTH


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Sometime around 15/2/09 (at 09:32 -0500) Joseph said:

worse, I see my database and password info in the source of the
page! I can’t imagine that is the proper protocol for safe webbing.

Correct, it isn’t. It sounds like your page filename ends in .html
rather than .php - or perhaps you haven’t put that data within the
PHP tag wrappers?

For more info on MySQL you could take a look at
http://www.thehepful.com/php/ and click the MySQL link.

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I know you are a pretty hep sort of guy, with all your tips and
techniques, but I think your URL for the PHP/MySQL link should be:

PHP and MySQL Explained: lessons, script samples and book recommendations

Just thought it might help to mention it, as you were obviously
suffering from the flying fingers syndrome when you typed it. :wink:

Colin

On 15 Feb 2009, at 18:49, Keith Martin wrote:

Sometime around 15/2/09 (at 09:32 -0500) Joseph said:

worse, I see my database and password info in the source of the
page! I can’t imagine that is the proper protocol for safe webbing.

Correct, it isn’t. It sounds like your page filename ends in .html
rather than .php - or perhaps you haven’t put that data within the
PHP tag wrappers?

For more info on MySQL you could take a look at http://www.thehepful.com/php/
and click the MySQL link.

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

you were obviously suffering from the flying fingers syndrome when
you typed it. :wink:

[bows towards Colin]

Thanks! Looks like I was. :slight_smile:

k


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

OK; thanks. Indeed, Problem One was not renaming the file to .php - I knew that, but forget that step when I started a fresh during debugging. Now at least the password doesn’t show. Unfortunately, I still don’t get a record into the database.

But the overview is that the SQL entry and retrieval steps haven’t matured to the same state that HTML and CSS have in the Freeway program. 2 or 3 years ago I would have been told to read up on CSS to get cool drop down menus, but now it is a breeze. Now I am told to read up on PHP and MySQL…ouch! that’s what I came to Freeway for. I learned RPG in '68 and dBase and Filemaker after that, and on and on. I’m expecting the computer to do this work now.

Simple SQL database needs are so ubiquitous, with the engine now on nearly every host I have seen, basically standardizing on the same phpMyAdmin front end. Having to work around the problems of having too many variables should end soon. I would hope that making a database becomes as direct with Freeway Actions as the php feedback mail solution and CSS has become.

A friend suggests that I fumble around with Joomla to see what is offered there…that my simple needs are easy with that CMS alternative.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I don’t think that you really need to bring in another tool to get the result you are after.

it is purely a case of having the right bit of code on your page to provide the bridge between the HTML and the MYSQL database. Introducing Joomla is like using a sledgehammer to crack a nut.

Have a look at http://www.phpfreaks.com/ or http://www.phpclasses.org/ and http://www.hotscripts.com/ or for manipulation Platon.sk

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

And http://php.resourceindex.com/


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Now I would like to try sending the data to an SQL file.

Any help appreciated…

I like referring to the w3schools site. For PHP see PHP Tutorial

LLE


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for the continued attempts at helping…but I want to manage my business and learn about client needs, not learn about how to give correcting coordinates by keyboard input instead of using the steering wheel of the car. My premise is “that is what the tool is for.”

Here is how a couple of developers have approached it in other formats:
For RapidWeaver: http://www.yabdab.com/formloom/

For Joomla: http://www.joomla-forms.com/download

The latter is quite feature rich, the former is close to what I was hoping for…except that I would be immediately asking for 1) a dump of the format which, imported, correctly and easily creates the SQL table and 2) a report creator mechanism, from SQL to an HTML page (which the Joomla product kinda has.)


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is interesting, I don’t think there are any Freeway actions like this, yet… (has there every been any real requests for this)

There are various php/sql actions, or you code it yourself in freeway (Keith site should help you with this) Yes its good to learn this, by hand, but perhaps its time to have some measure of Freeway automation to auto-create create a basic database and input data from a page.

Maybe one of the Action Writers might chip in to comment to see what potentially possible?

On 17 Feb 2009, at 07:53, Joseph wrote:

Here is how a couple of developers have approached it in other formats:
For RapidWeaver: <http://www.yabdab.com/formloom/>

David Owen :: Freeway Friendly Web hosting and Domains ::

http://www.ineedwebhosting.co.uk :: http://www.ineedwebhosting.co.uk/blog

If I can be so bold, having done searches in this iteration of the forum, and remembering having done it in the previous version, people have needed an un-complicating of SQL for a while - there are threads from people not quite knowing what to ask and fishing around. I thought that I would get access to such an interface when I paid for the pro version after being frustrated with the express version.

In Rear-ViewMirrorPerfectVision™ speak, it is an example of, 1) us not knowing what questions to ask (from my side) and 2) you not knowing what we didn’t know (from developers side.)

Perhaps I’ll ask the developers if they feel like converting what they have to an Action…don’t know how rough that would be, or appropriate.

I am also going to make my first Joomla page and buy this guy’s Extension to see how it works. The way the pound has slipped, it seems like a bargain. I’ll let you know.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Technically, the interface is there in the Pro-version. It needs knowledge and experience to piece it all together, and customise however you like.

I would think a third party actions writer might do this as a paid for action. Like the RapidWeaver Formloom you mention. If the demand is there?

On 17 Feb 2009, at 09:30, Joseph wrote:

I thought that I would get access to such an interface when I paid for the pro version after being frustrated with the express version.

David Owen :: Freeway Friendly Web hosting and Domains ::

http://www.ineedwebhosting.co.uk :: http://www.ineedwebhosting.co.uk/blog

At 02:53 -0500 17/2/09, Joseph wrote:

Thanks for the continued attempts at helping…but I want to manage
my business and learn about client needs, not learn about how to
give correcting coordinates by keyboard input instead of using the
steering wheel of the car. My premise is ³that is what the tool is
for.²

Here is how a couple of developers have approached it in other formats:
For RapidWeaver: http://www.yabdab.com/formloom/

For Joomla: http://www.joomla-forms.com/download

The latter is quite feature rich, the former is close to what I was
hoping for…except that I would be immediately asking for 1) a dump
of the format which, imported, correctly and easily creates the SQL
table and 2) a report creator mechanism, from SQL to an HTML page
(which the Joomla product kinda has.)

Depending on what you already know of PHP and MySQL, Joomla may well
be easier to learn than the SQL you need - provided you are happy to
use a supplied or purchased template that you can identify. If what
you get from Joomla (plus the thousands of add-ons) doesn’t do what
you want, then learning more SQL is the easier route. There are lots
of books and tutorial sites for Joomla, but I’ve yet to find one that
tells what I need to know for my purposes.

David


David Ledger - Freelance Unix Sysadmin in the UK.
HP-UX specialist of hpUG technical user group (www.hpug.org.uk)
email@hidden
www.ivdcs.co.uk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes; it does seem quite googlish…too much data, too ill defined, too filled with enthusiasts who just found the web. It gives the impression of being in a swamp filled with potential pearls, with way too many out-of-focus demos telling me how to get the pull-down menu working on the snorkel I need to see through the murky waters.

Unfortunately, I seem to be willing to go quite long and ridiculous paths to avoid learning how to program another language. But I still want to use the tools…an opportunity for those who can mold them.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

IMHO, the problem is fundamental to a lot of things. When you can
write your own code, e.g. PHP,SQL, you can do everything allowed in
that language. When you use a package like Freeway, you get to do that
subset of tasks that they have put in their product. Of course,
Freeway has included a capability to mix in your own code. Its kinda
like fixing a meal. If you cook everything from scratch, you can
season the meal however you like. If you get a frozen diner from the
store, you get what seasonings they put in it. So, if you don’t want
to learn how to customize by writing your own code, you have to adjust/
modify your output to do what Freeway allows. Or go shopping in a
different store.

LLE

On Feb 17, 2009, at 5:21 AM, Joseph wrote:

Yes; it does seem quite googlish…too much data, too ill defined,
too filled with enthusiasts who just found the web. It gives the
impression of being in a swamp filled with potential pearls, with
way too many out-of-focus demos telling me how to get the pull-down
menu working on the snorkel I need to see through the murky waters.

Unfortunately, I seem to be willing to go quite long and ridiculous
paths to avoid learning how to program another language. But I still
want to use the tools…an opportunity for those who can mold them.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 17 Feb 2009, 2:40 pm, LLE wrote:

IMHO, …
you have to adjust/modify your output to do what Freeway allows. Or go shopping in a different store.

…or encourage those who can put new ingredients together into a package that I need to do so.

When you can write your own code, e.g. PHP,SQL, you can do everything allowed in that language.

The same could be said about Freeway in general, no? There is a lot to HTML to learn as well, tweaks can be made to the Freeway output and there is an Action that helps that. Or CSS coding… But Freeway has specifically handled the most relevant points of making a sophisticated website without having to know what could be otherwise studied.

I certainly understand your point and all the others who find learning PHP and SQL the correct and simplest path. But the logistics of reading and understanding the dozens of pages of the dozen links that have been recommended are outside the scope of my other priorities.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Understood. Now let me tell you a little story.

Once upon a time there was an Action package called DataDesigner,
which linked Filemaker 5 to Freeway in a neat round-trip manner. Of
course, once upon a time there was Filemaker 5, but that’s kind of the
point.

This product worked (and existed at all) because there was a strong
AppleScript library for Filemaker Pro, and because you could program
Web applications in FDML (long since resting with the dinosaurs),
which was itself not too distant a cousin to HTML. Instead of you
having to look in FIlemaker to see the names of the data fields (and
their types) you would just give DataDesigner your login credentials,
and it would interrogate the database, get all the details it needed,
and auto-generate nice picking lists of field names and so forth. It
was possible to create quite elaborate Web front-ends to FIlemaker
databases using this system and very little actual understanding of
programming.

Then Filemaker changed their entire application and data model, canned
FDML, and DD was dead. Not only was it dead, but the changes made it
very difficult to imagine how you could make it over again.

So endeth the story. Now fast-forward to today:

There is no equivalent mechanism for “discovering” the inner structure
of a MySQL database from within an Action.

Pause, and let that sink in.

MySQL itself could tell you anything you know how to ask it, but that
would mean writing SQL queries with AppleScript, sending them over the
command-line to the MySQL daemon running on your Mac, having it return
MySQL result sets, interpreting those results in AppleScript, and
finally converting all that into something the Action could consume.
It’s an enormous challenge on every one of those levels. Throw in the
fact that you might not have MySQL running on your Mac, but rather are
working with a remote server (and that you might not have the
privileges to remotely access MySQL on that server) and you begin to
see that there are many serious problems with that approach.

I have for the past several years been programming PHP/MySQL using a
very nice Object Relational Mapper (ORM) called MyActiveRecord[1]
(originally written by Jake Grimley, who is a neighbor of Softpress’
in Oxford). This library includes many functions that allow PHP to
introspect a MySQL database, and allow high-level PHP functions to
replace acres of hand-coded dreck. In your mythical form page, you
would write your handler using MAR thusly:

<?php
require_once('MyActiveRecord.0.5.php');
class contacts extends MyActiveRecord {
	function save(){
		$this->validate_existence('name');
		$this->validate_email('email');
		$this->validate_existence('comment','What did you want to say?');
		$this->added_at = $this->DbDateTime();
		return parent::save();
	}
}
$contact = MyActiveRecord::Create('contacts');
if(isset($_POST['submit'])){
	$contact->populate($_POST);
	$contact->save();
	if(! false == $contact->get_errors()){
		header('Location: thanks.html');
		exit;
	}else{
		print_r($contact->get_errors());
	}
}
?>

So even with this very high-level library, there is still some hand-
work to be done. And there is the chicken-or-egg problem of
discovering the field names and their types, plus the larger issue of
how to architect your objects. There’s only so much that can be
communicated through an Action interface, and only so much that can be
pushed on to the Action developer. At some point, you have to figure
out what the boundaries of your application are, what the pieces are
and how they are meant to interact, and it’s non-trivial for anyone to
do if you don’t speak the language.

I do speak the language, and yet I know that there are things that I
have to figure out as I go every time. It’s incomprehensible to me how
that understanding could be abstracted into a nice GUI interface with
menus and buttons and such. But I am thinking about the problem in my
spare time. I would love to see DD fly again, this time speaking Web-
standard PHP/MySQL instead of cheap-and-cheerful Filemaker.

Walter

  1. GitHub - walterdavis/myactiverecord: Fork of MyActiveRecord by Jake Grimley

On Feb 17, 2009, at 11:14 AM, Joseph wrote:

I certainly understand your point and all the others who find
learning PHP and SQL the correct and simplest path. But the
logistics of reading and understanding the dozens of pages of the
dozen links that have been recommended are outside the scope of my
other priorities.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I have to mix practice with theory to make any of the theory become aha!

I’d like to be able to create online database(s) and use them in my sites
and feel there must be ways that don’t learn HTML,PHP and SQL from the
ground up?

But maybe I’m wrong.(?)

all the best
Brian

Joseph said recently:

On 17 Feb 2009, 2:40 pm, LLE wrote:

IMHO, …
you have to adjust/modify your output to do what Freeway allows. Or go
shopping in a different store.

…or encourage those who can put new ingredients together into a package that
I need to do so.

When you can write your own code, e.g. PHP,SQL, you can do everything allowed
in that language.

The same could be said about Freeway in general, no? There is a lot to HTML to
learn as well, tweaks can be made to the Freeway output and there is an Action
that helps that. Or CSS coding… But Freeway has specifically handled the
most relevant points of making a sophisticated website without having to know
what could be otherwise studied.

I certainly understand your point and all the others who find learning PHP and
SQL the correct and simplest path. But the logistics of reading and
understanding the dozens of pages of the dozen links that have been
recommended are outside the scope of my other priorities.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I can vouch for the usefulness of MAR (MyActiveRecord), Walter turned
me onto it last year. At the time my experience with PHP/MySQL was -
to understate it - minimal, but if you can grasp the more basic
aspects you begin to see how useful it is as a springboard for all
sorts of applications. I used it to build a fairly simple custom db
for a client which he loved; much better than grabbing a generic
script from HotScripts and trying to modify it to the clients needs.

I have a copy of MAR in my Subversion repository on Beanstalk so if
anyone wants to poke around with the code for the sake of learning in
a collaborative environment contact me off-list. Lots more to learn.

Todd

On Feb 17, 2009, at 11:50 AM, Walter Lee Davis wrote:

I have for the past several years been programming PHP/MySQL using a
very nice Object Relational Mapper (ORM) called MyActiveRecord[1]
(originally written by Jake Grimley, who is a neighbor of Softpress’
in Oxford). This library includes many functions that allow PHP to
introspect a MySQL database, and allow high-level PHP functions to
replace acres of hand-coded dreck.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options