|
|
 |
|
12-22-2012, 01:41 PM
|
#1
|
|
Member
Join Date: Sep 2012
Posts: 122
|
Php procedural CRUD
I have problems learning crud using php and procedural programming.
I have 1.5 years with php and I know a lot from the basics, but this crud really is not my best. Can anyone help with this? I have found object oriented cruds, but not procedural and i dont want it oop since i never used object oriented to create a webiste.
|
|
|
12-22-2012, 02:47 PM
|
#2
|
|
Golden Member
Join Date: Jun 2009
Posts: 1,547
|
???
If you don't use and ORM it does not matter at all if you do it procedural or OO because SQL is neither of both.
Create = INSERT (your data)
Read = SELECT (your data)
Update = UPDATE (your data)
Delete = DELETE (your data)
I don't see the problem at all.
|
|
|
12-22-2012, 04:06 PM
|
#3
|
|
Member
Join Date: Sep 2012
Posts: 122
|
Ok, thanks for the reply
The whole problem is that when i try to create something, like a link with the name for example Anand and when i click on that i don't understand how am i supposed to send the user to the anand article??? It has the same name
Can you help? Or at least provide a link to that?
|
|
|
12-22-2012, 06:14 PM
|
#4
|
|
Elite Member
Join Date: Dec 1999
Location: Colorado
Posts: 7,316
|
I'm confused. You don't know what an "href" (Hypertext REFerence) is in HTML, or you haven't figured out how to send the Anand article from a PHP site?
You have to be CRUDding in some kind of backend, like a database. What are you using?
|
|
|
12-23-2012, 08:21 AM
|
#5
|
|
Member
Join Date: Sep 2012
Posts: 122
|
I am using MySQL and i know the basics. I don't understand the logic behind that.
I don't know how to Edit posts and how to delete them using CRUD so others will delete them without me making additional coding.
|
|
|
12-23-2012, 12:09 PM
|
#6
|
|
Moderator Programming
Join Date: Sep 2005
Posts: 8,119
|
Quote:
Originally Posted by GSquadron
I am using MySQL and i know the basics. I don't understand the logic behind that.
I don't know how to Edit posts and how to delete them using CRUD so others will delete them without me making additional coding.
|
I think you may be a little confused. I know I am  . CRUD is just an acronym that refers to Create, Read, Update, Delete. It's shorthand for "the basic things any website does with data."
If you use an automatic data mapping layer (ORM, as previously mentioned) then you perform these CRUD operations against that layer. If not, then you write your own data access code to perform the operations.
|
|
|
12-23-2012, 01:44 PM
|
#7
|
|
Member
Join Date: Sep 2012
Posts: 122
|
You mean if I search and study the ORM, the users won't have to write the code, but simply press edit, delete and new?
If that is what you mean, than it is what i am searching for!
Please provide any source where i can learn that, it seems too difficult to find.
Last edited by GSquadron; 12-23-2012 at 01:47 PM.
|
|
|
12-23-2012, 05:38 PM
|
#8
|
|
Moderator Programming
Join Date: Sep 2005
Posts: 8,119
|
Quote:
Originally Posted by GSquadron
You mean if I search and study the ORM, the users won't have to write the code, but simply press edit, delete and new?
If that is what you mean, than it is what i am searching for!
Please provide any source where i can learn that, it seems too difficult to find.
|
It's not at all difficult to find, but you don't know what you're looking for, and that might make it a little harder  .
Bottom line, to proceed down the path you seem to be pursuing you would need a base of programming and system knowledge that you appear not to have. There are platforms that require little to no programming, Wordpress for example, and you may want to check out something along those lines, depending on the sort of site you want to build.
|
|
|
12-23-2012, 06:42 PM
|
#9
|
|
Elite Member
Join Date: Aug 2001
Location: Bellevue, WA
Posts: 35,479
|
It might even be a good idea to go with Wordpress.com hosting so you don't need to worry about your site being hacked.
|
|
|
12-24-2012, 02:35 PM
|
#10
|
|
Member
Join Date: Sep 2012
Posts: 122
|
I have already built my website from scratch with html, css, jquery, php, mysql
Have a look yourself: www.anothergames.com
I started reading a book about php and mysql, but what I am missing here, is how I create an easy way for others to add their own content on the website, without needed knowledge of a single HTML code. This is what i am trying to do.
The book I am reading perfectly explained MySQL, insert into, delete, create, update, but the real problem is, how am I supposed to use this MySQL combined with PHP and create a webpage, using sessions, so the users will upload their own stuff.
For example, if I payed someone to work for my website and he doesn't know a single HTML code, I will certainly need to do this. I want it for time saving too, since I have to add coding every time I try to add new content.
Or better saying make my own CMS
I am totally against pre-build CMS, especially now that the website is in a very good state.
(when it comes to hacking, I have already used php functions and Google's anti-bots questions on the forums)
@Mark
Looks like I appear to have the knowledge you are talking about
Last edited by GSquadron; 12-24-2012 at 02:39 PM.
|
|
|
12-24-2012, 02:47 PM
|
#11
|
|
Elite Member
Join Date: Aug 2001
Location: Bellevue, WA
Posts: 35,479
|
It sounds like you are looking for a "content management system."
Wordpress is one example of a CMS, but a Google search will turn up more like Drupal.
If you use an existing CMS, it saves a huge amount of work, but you also must be good about installing patches. Because these CMS are used on tens of thousands of websites, there is money to be made in attacking them to take them over and add spam and viruses.
If you write your own CMS, it will be a lot more work but could have exactly the features you want. There is the risk that you won't get the security right, so someone can find a hole to take over your server.
|
|
|
12-25-2012, 08:01 AM
|
#12
|
|
Member
Join Date: Sep 2012
Posts: 122
|
I actually am looking for the crud features from the whole CMS
I am not that good to create an entire CMS, so only crud will do.
Any help? Again.....
|
|
|
12-25-2012, 10:31 AM
|
#13
|
|
Member
Join Date: Nov 2012
Posts: 43
|
Most confusing thread ever!
|
|
|
12-25-2012, 11:51 PM
|
#14
|
|
Lifer
Join Date: Aug 2000
Posts: 11,980
|
Quote:
Originally Posted by Graze
Most confusing thread ever!
|
Truth!
Web apps pretty much all start from CRUD and go up in complexity from there.
If you don't understand how to tie HTML, PHP, and MySQL together, you definitely do not have the knowledge Markbnj speaks of. If you did, you'd be doing it--the info is out there, and you'd be looking up specific feature details and gotchas. I'm guessing you procedurally know how to use PHP, HTML, and Javascript, but don't understand the underpinnings of managing data. Persistent files and DBs require their own kind of thinking.
Quote:
|
The book I am reading perfectly explained MySQL, insert into, delete, create, update, but the real problem is, how am I supposed to use this MySQL combined with PHP and create a webpage, using sessions, so the users will upload their own stuff.
|
This is handled in many LAMP tutorials, and is basically what PHP is there to do, these days. You have options as to how to implement it, but if you understand how it works, the interface will be the hard part (YUI for reasonable image support?).
Your site as it is would be a perfect candidate for a Wordpress conversion, IMO. Wordpress, specifically, tries to keep updates from causing regressions, so patching is much safer than with, say, Drupal; and it's fairly easy to customize the look and feel. Don't succumb to NIH syndrome.
__________________
"The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows." - Frank Zappa
|
|
|
12-26-2012, 02:24 AM
|
#15
|
|
Golden Member
Join Date: Jun 2009
Posts: 1,547
|
Whats the actual background of this?
I'm gonna be blunt. The whole thread has this touch about "I'm lazy and don't want to learn but I want to get rich with my great web site idea."
Programming isn't something you just can. to come up with something good you will need experience and lots of it. It's even more problematic when creating a public available web site. You either won't be successful or get hacked.
Quote:
Originally Posted by DaveSimmons
If you write your own CMS, it will be a lot more work but could have exactly the features you want. There is the risk that you won't get the security right, so someone can find a hole to take over your server.
|
Considering how the thread went up till now I don't see this as a risk, more like a fact...
|
|
|
12-26-2012, 02:48 AM
|
#16
|
|
Diamond Member
Join Date: Apr 2009
Location: Upstate NY
Posts: 6,652
|
He will be fine, we all just set him up for that haha.
That's how I started, constructive criticism.
|
|
|
12-26-2012, 12:21 PM
|
#17
|
|
Moderator Programming
Join Date: Sep 2005
Posts: 8,119
|
Quote:
Originally Posted by GSquadron
@Mark
Looks like I appear to have the knowledge you are talking about
|
If you did that stuff from scratch, then yeah, you should have picked up a lot of what we've been discussing. Perhaps this has been a language issue. When I read a statement like this one...
Quote:
Originally Posted by GSquadron
I actually am looking for the crud features from the whole CMS
I am not that good to create an entire CMS, so only crud will do.
Any help? Again.....
|
... that is just not how a person who understands the problem would describe it. I'll try again. The acronym CRUD is useless in this context, so stop using it. We all know what CRUD is. It's short for "I don't see why this should take more than half a day; it's just CRUD."
In other words, it's usually spoken by people who don't really know what it means. Once you get past the jargon, you have actual stuff that you need to put in an actual database in response to actual user iinput. Describe your real problem, and maybe we can help. You want to read and write what? Forum posts? Blog entries? Stock quotes? Music files? Football stats?
In the real world we programmers have to know the specific, minute details of every problem domain we work in. It's not just "CRUD."
|
|
|
12-26-2012, 04:02 PM
|
#18
|
|
Lifer
Join Date: Feb 2003
Posts: 20,474
|
I are confuse.
|
|
|
12-26-2012, 08:44 PM
|
#19
|
|
Member
Join Date: Sep 2012
Posts: 122
|
ok, but it is hard to explain, at least for me.
I want to create an admin account where only me, will be able to EDIT, DELETE, INSERT and CREATE articles. To do that, first of all, I want to add a button, which only the admin account can see in the reviews section, with the statement ADD NEW REVIEW. After this, I will have to create a page which will have a form to write the review and a submit button. The big problem is that if I add in the title textbox the name for example "Far Cry 3 review", how it is supposed to become a link this title, so people will click on the title after I submit the review and go to a page named "\far%20cry%203%20review" and read the Far Cry 3 title + the whole review with images. I know how to add the reviews and add the info on the database, but the problem which I don't understand at all is: How am I supposed to create this link with the Far Cry 3 title so when a user clicks on it goes to a page which has the review?
So 2 things to discuss: How to appear and dissapear that button and the link. Not talking about how to create sessions or other users who will add info. I need only these 2 things. I am going on reading this book which explains PDO and seems very different from the normal way used. I will find this one day, normally, but since I need help for now, I just need it to add stuff meanwhile I learn new stuff.
About that part of getting money... 2.5 months old is a joke, so I don't see how to get the money with this young website. I am not doing it for the money at all, it is an experience and learning source, rather than earning.
And yes, you are right, I don't really need the crud stuff, just specific problems I came into.
I was thinking now, if the $_GET['review']; should be used on the link
or $review = "SELECT * FROM review WHERE name='Far Cry 3'"
This is alright, but the problem is how to make this a link???
/'.$title.' ???? It just doesn't make sense.
Last edited by GSquadron; 12-26-2012 at 08:46 PM.
|
|
|
12-26-2012, 09:43 PM
|
#20
|
|
Moderator Programming
Join Date: Sep 2005
Posts: 8,119
|
Quote:
Originally Posted by GSquadron
I have already built my website from scratch with html, css, jquery, php, mysql
Have a look yourself: www.anothergames.com
|
I checked out that website, and what I don't get is how you built it from scratch without coming to some understanding of the things you're asking about? It already does most of them. For example, how do the review links on that site work?
The features you've asked about you'll get out of the box using Wordpress, and there are already packaged versions for review sites and the like. That direction is still the one I would recommend to you.
|
|
|
12-27-2012, 02:43 AM
|
#21
|
|
Golden Member
Join Date: Jun 2009
Posts: 1,547
|
The technical term you are looking for is
url rewriting
Use google.
|
|
|
12-27-2012, 01:57 PM
|
#22
|
|
Member
Join Date: Sep 2012
Posts: 122
|
It is simply a function thing I am missing.
It has nothing to do with rewritting, but I need a need for pointing to that review.
btw, I add reviews manually, writting all the code and it sucks up a lot of time.
|
|
|
12-27-2012, 02:04 PM
|
#23
|
|
Elite Member
Join Date: Dec 1999
Location: Colorado
Posts: 7,316
|
Are you just looking for the urlencode function?
You should totally use a pre-built CMS like Wordpress or Drupal. Drupal is open-source and you can rewrite it to your heart's content.
|
|
|
12-27-2012, 06:56 PM
|
#24
|
|
Member
Join Date: Sep 2012
Posts: 122
|
Looks like the book I am reading gives the solution to my problem, but I will have to change everything to PDO connections. Don't worry anymore guys, since I guess this is exactly what I was searching and am studying it right now.
|
|
|
12-30-2012, 02:57 PM
|
#25
|
|
Senior Member
Join Date: Mar 2008
Posts: 671
|
Quote:
Originally Posted by Graze
Most confusing thread ever!
|
No, not really, it is quite obvious that the OP read the magic "CRUD" acronym somwhere but has not realized what it actually means.
Create Read Update Delete, and is just another way of referencing some section of code that does database IO, persistence, drives the nail in, whatever.
I must give cudos to the OP cause it sounds like you're in way over your head and you're still hanging in there .. Dont give up, keep reading :-).
edit. reading the rest of the thread, I'm sorta confused too. Doesnt add up.
__________________
Quote:
Please dont deal in absolutes.
Everything in the verse is percentages. Everything.
-With the exception of the love for our children.
(cytg 2001)
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:27 PM.
|