Welcome Guest, Not a member yet? Register   Sign In
Form that Submits to a Database
#11

[eluser]Rick Jolly[/eluser]
Welcome WTHIGO. Some of us think that starting with CI is the best way to familiarize yourself with php. You won't pick up as many bad habits.

Actually, given your asp.net background, I think you're better prepared for a php oop framework like CI than a procedural php person.
#12

[eluser]textnotspeech[/eluser]
Welcome to the community. Unfortunately, I think you're going to have to learn some PHP first (at least object oriented PHP) before you can really get the most out of Code Igniter. There really isn't a "Code Igniter" way. It's all based on Object Oriented PHP and inheritance. Code Igniter is basically a base framework to work with and extend using PHP. This is a great community that's more than willing to help, but seriously, how to save form data? That's PHP 101, and if you're having trouble with that, you've got a world of pain ahead. I'm sure you're a very smart guy, but you have to crawl before you can walk before you can run. I'm not trying to put you down but you've gotta look at it from our perspective. We've all spent countless nights banging our heads against a wall trying to figure something out until we break down and ask for help. There's also an old cliche that applies here: Give a man a fish... :-)
#13

[eluser]textnotspeech[/eluser]
I hope I didn't come off as being a jerk. I just think that if you don't know the basics (I know they can be boring as hell but you gotta start there) you'll get in trouble for no good reason. PHP is a large and extensive language and there's all sorts of minutiae that adds up when building complicated apps, especially when considering performance. My recommendations for getting up and running quickly with PHP are:

PHP 5 Visual QuickStart Guide
Object Oriented PHP
PHP 5 Advanced Visual QuickPro Guide

Those books were very helpful to me when I was getting started. The Visual Quickstart series is mostly code and short explanations to get you going as quick as possible. I'm sure you could borrow a copy from your local library(torrent site), although I recommend buying the books; you'll crack them open a hundred times a year for reference.
#14

[eluser]Rick Jolly[/eluser]
[quote author="textnotspeech" date="1222767418"]There really isn't a "Code Igniter" way. It's all based on Object Oriented PHP and inheritance. [/quote]
Then he should have no trouble if coming from another OOP language. It's just a different api and syntax.

I do php, c#, java, and maintain asp. Frameworks are time consuming to learn, syntax isn't.
#15

[eluser]textnotspeech[/eluser]
Quote:It’s just a different api and syntax.

I do php, c#, java, and maintain asp. Frameworks are time consuming to learn, syntax isn’t.

@Rick Jolly So he should have no problem boning up on PHP syntax and using form data as well. If that's the case, this is the wrong place for that question. There's gotta be millions of basic PHP tutorials out there. If it's hard to learn a framework, it's harder to learn it when you don't know the language.
#16

[eluser]Jason McCallister[/eluser]
I understand the concept but isn't this what PHP "framework" is all about? Meaning you can use CI to assist in inserting data into the DB? Or did I read all of the documentation wrong last night? So this isn't CI helping with the database?

Code:
$this->db->insert();
#17

[eluser]textnotspeech[/eluser]
Can you post the code you're working with. It'll help loads if we can see what you're doing.
#18

[eluser]Jason McCallister[/eluser]
maybe my first post wasn't clear... I have my app that I am building and I have it working... meaning pulling the data from the DB using the home controller. I guess the point I'm stuck at applies to memberships and forms. I need a form that submits information into the database and uses a hidden field that retrieves the current users member_id. Maybe I should use a pre-made member library?
#19

[eluser]textnotspeech[/eluser]
Here's an adaptation of the user guide code assuming you have form data posted with these input names

Code:
$data = array(
               'title' => $_POST['title'] ,
               'name' => $_POST['name'] ,
               'date' => $_POST['date']
            );

$this->db->insert('mytable', $data);

// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
#20

[eluser]Jason McCallister[/eluser]
[quote author="textnotspeech" date="1222768445"]I hope I didn't come off as being a jerk. I just think that if you don't know the basics (I know they can be boring as hell but you gotta start there) you'll get in trouble for no good reason. PHP is a large and extensive language and there's all sorts of minutiae that adds up when building complicated apps, especially when considering performance. My recommendations for getting up and running quickly with PHP are:

PHP 5 Visual QuickStart Guide
Object Oriented PHP
PHP 5 Advanced Visual QuickPro Guide

Those books were very helpful to me when I was getting started. The Visual Quickstart series is mostly code and short explanations to get you going as quick as possible. I'm sure you could borrow a copy from your local library(torrent site), although I recommend buying the books; you'll crack them open a hundred times a year for reference.[/quote]

See... now that is actually useful information to post.




Theme © iAndrew 2016 - Forum software by © MyBB