Go Back   AnandTech Forums > Software > Programming

Forums
· Hardware and Technology
· CPUs and Overclocking
· Motherboards
· Video Cards and Graphics
· Memory and Storage
· Power Supplies
· Cases & Cooling
· SFF, Notebooks, Pre-Built/Barebones PCs
· Networking
· Peripherals
· General Hardware
· Highly Technical
· Computer Help
· Home Theater PCs
· Consumer Electronics
· Digital and Video Cameras
· Mobile Devices & Gadgets
· Audio/Video & Home Theater
· Software
· Software for Windows
· All Things Apple
· *nix Software
· Operating Systems
· Programming
· PC Gaming
· Console Gaming
· Distributed Computing
· Security
· Social
· Off Topic
· Politics and News
· Discussion Club
· Love and Relationships
· The Garage
· Health and Fitness
· Merchandise and Shopping
· For Sale/Trade
· Hot Deals
· Free Stuff
· Contests and Sweepstakes
· Black Friday 2013
· Forum Issues
· Technical Forum Issues
· Personal Forum Issues
· Suggestion Box
· Moderator Resources
· Moderator Discussions
   

Reply
 
Thread Tools
Old 12-22-2012, 01:41 PM   #1
GSquadron
Member
 
GSquadron's Avatar
 
Join Date: Sep 2012
Posts: 162
Default 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.
GSquadron is offline   Reply With Quote
Old 12-22-2012, 02:47 PM   #2
beginner99
Platinum Member
 
Join Date: Jun 2009
Posts: 2,072
Default

???

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.
beginner99 is offline   Reply With Quote
Old 12-22-2012, 04:06 PM   #3
GSquadron
Member
 
GSquadron's Avatar
 
Join Date: Sep 2012
Posts: 162
Default

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?
GSquadron is offline   Reply With Quote
Old 12-22-2012, 06:14 PM   #4
Ken g6
Elite Member
 
Ken g6's Avatar
 
Join Date: Dec 1999
Location: Colorado
Posts: 8,308
Default

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?
__________________
Look for really BIG primes with TeAm AnandTech PrimeGrid!
Next race: April 20-23

vBulletin looking run down? Get your script fix here.
Ken g6 is offline   Reply With Quote
Old 12-23-2012, 08:21 AM   #5
GSquadron
Member
 
GSquadron's Avatar
 
Join Date: Sep 2012
Posts: 162
Default

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.
GSquadron is offline   Reply With Quote
Old 12-23-2012, 12:09 PM   #6
Markbnj
Moderator
Programming
 
Markbnj's Avatar
 
Join Date: Sep 2005
Posts: 10,514
Default

Quote:
Originally Posted by GSquadron View Post
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.
__________________
Everytime I try to tell you, the words just come out wrong

**
Some meaningless scribbling of no account

The 4th Realm

Arts and Letters Daily - Get some culture
Markbnj is online now   Reply With Quote
Old 12-23-2012, 01:44 PM   #7
GSquadron
Member
 
GSquadron's Avatar
 
Join Date: Sep 2012
Posts: 162
Default

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.
GSquadron is offline   Reply With Quote
Old 12-23-2012, 05:38 PM   #8
Markbnj
Moderator
Programming
 
Markbnj's Avatar
 
Join Date: Sep 2005
Posts: 10,514
Default

Quote:
Originally Posted by GSquadron View Post
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.
__________________
Everytime I try to tell you, the words just come out wrong

**
Some meaningless scribbling of no account

The 4th Realm

Arts and Letters Daily - Get some culture
Markbnj is online now   Reply With Quote
Old 12-23-2012, 06:42 PM   #9
DaveSimmons
Elite Member
 
Join Date: Aug 2001
Location: Bellevue, WA
Posts: 36,820
Default

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.
DaveSimmons is online now   Reply With Quote
Old 12-24-2012, 02:35 PM   #10
GSquadron
Member
 
GSquadron's Avatar
 
Join Date: Sep 2012
Posts: 162
Default

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.
GSquadron is offline   Reply With Quote
Old 12-24-2012, 02:47 PM   #11
DaveSimmons
Elite Member
 
Join Date: Aug 2001
Location: Bellevue, WA
Posts: 36,820
Default

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.
DaveSimmons is online now   Reply With Quote
Old 12-25-2012, 08:01 AM   #12
GSquadron
Member
 
GSquadron's Avatar
 
Join Date: Sep 2012
Posts: 162
Default

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.....
GSquadron is offline   Reply With Quote
Old 12-25-2012, 10:31 AM   #13
Graze
Senior Member
 
Join Date: Nov 2012
Posts: 233
Default

Most confusing thread ever!
Graze is offline   Reply With Quote
Old 12-25-2012, 11:51 PM   #14
Cerb
Elite Member
 
Cerb's Avatar
 
Join Date: Aug 2000
Posts: 14,634
Default

Quote:
Originally Posted by Graze View Post
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
Cerb is offline   Reply With Quote
Old 12-26-2012, 02:24 AM   #15
beginner99
Platinum Member
 
Join Date: Jun 2009
Posts: 2,072
Default

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 View Post
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...
beginner99 is offline   Reply With Quote
Old 12-26-2012, 02:48 AM   #16
Wyndru
Diamond Member
 
Wyndru's Avatar
 
Join Date: Apr 2009
Location: Upstate NY
Posts: 7,084
Default

He will be fine, we all just set him up for that haha.

That's how I started, constructive criticism.
Wyndru is offline   Reply With Quote
Old 12-26-2012, 12:21 PM   #17
Markbnj
Moderator
Programming
 
Markbnj's Avatar
 
Join Date: Sep 2005
Posts: 10,514
Default

Quote:
Originally Posted by GSquadron View Post
@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 View Post
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."
__________________
Everytime I try to tell you, the words just come out wrong

**
Some meaningless scribbling of no account

The 4th Realm

Arts and Letters Daily - Get some culture
Markbnj is online now   Reply With Quote
Old 12-26-2012, 04:02 PM   #18
clamum
Lifer
 
clamum's Avatar
 
Join Date: Feb 2003
Posts: 21,273
Default

I are confuse.
__________________
\ Battlefield 4 Stats /\ Heat /
clamum is online now   Reply With Quote
Old 12-26-2012, 08:44 PM   #19
GSquadron
Member
 
GSquadron's Avatar
 
Join Date: Sep 2012
Posts: 162
Default

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.
GSquadron is offline   Reply With Quote
Old 12-26-2012, 09:43 PM   #20
Markbnj
Moderator
Programming
 
Markbnj's Avatar
 
Join Date: Sep 2005
Posts: 10,514
Default

Quote:
Originally Posted by GSquadron View Post
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.
__________________
Everytime I try to tell you, the words just come out wrong

**
Some meaningless scribbling of no account

The 4th Realm

Arts and Letters Daily - Get some culture
Markbnj is online now   Reply With Quote
Old 12-27-2012, 02:43 AM   #21
beginner99
Platinum Member
 
Join Date: Jun 2009
Posts: 2,072
Default

The technical term you are looking for is

url rewriting

Use google.
beginner99 is offline   Reply With Quote
Old 12-27-2012, 01:57 PM   #22
GSquadron
Member
 
GSquadron's Avatar
 
Join Date: Sep 2012
Posts: 162
Default

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.
GSquadron is offline   Reply With Quote
Old 12-27-2012, 02:04 PM   #23
Ken g6
Elite Member
 
Ken g6's Avatar
 
Join Date: Dec 1999
Location: Colorado
Posts: 8,308
Default

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.
__________________
Look for really BIG primes with TeAm AnandTech PrimeGrid!
Next race: April 20-23

vBulletin looking run down? Get your script fix here.
Ken g6 is offline   Reply With Quote
Old 12-27-2012, 06:56 PM   #24
GSquadron
Member
 
GSquadron's Avatar
 
Join Date: Sep 2012
Posts: 162
Default

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.
GSquadron is offline   Reply With Quote
Old 12-30-2012, 02:57 PM   #25
cytg111
Golden Member
 
Join Date: Mar 2008
Posts: 1,129
Default

Quote:
Originally Posted by Graze View Post
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.
__________________
404
cytg111 is offline   Reply With Quote
Reply

Tags
editing, learning, php, procedural, programming

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:30 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.