Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 36
  1. #16
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    332
    Thanks
    2
    Thanked 47 Times in 46 Posts
    Quote Originally Posted by tangoforce View Post
    You make it sound oh so easy.

    Hahaha...2 days. Who doesn't understand "UPDATE mytable SET column=$variable" WHERE column2 = $id"...Even a person who isn't a techie will. The complex multiple line queries with JOINS INs etc are the ones that will have you cursing. I understood them but the debugging is the ****!

    "Debugging is a skill" <<--Do I have a quote there?

    It will take you some time to acquire it mate. You will probably have the logic correct, but some small syntax errors will get you.

    It is easy to understand SQL and PHP but it will take you a while to wrap your head around applying both of them together.
    Last edited by Redcoder; 12-28-2012 at 04:31 PM.

  2. #17
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Quote Originally Posted by Redcoder View Post
    Hahaha...2 days. Who doesn't understand "UPDATE mytable SET column=$variable" WHERE column2 = $id"
    Thats easy stuff but you make it sound like thats all there is to it and in reality there is a lot more complex stuff in SQL that will eventually need to be mastered (such as multiple updates without using multiple queries in a loop for one!). Anyway yes the easy basics can be done in a day or three but even then you still have to allow for things like missing ' marks and stuff which can take a learner a while to solve by themselves.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  3. #18
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    For SQL itself, I'd actually recommend the Oracle documentation. They use this graphical guide to constructing DMS statements which you can see here: http://docs.oracle.com/cd/B28359_01/...ents_10002.htm. It takes some practice to get used to that, but its really quite handy to follow the bubbles and arrows compared to SQLServer and MySQL documentation which is textual. Stick to non-proprietary functionality when learning SQL (no LIMIT's, no GROUP_CONCAT's, etc). Add those as you need them. I'm far from a SQL wizard myself and it takes me a long time to design a proper query that's really complex. Although I do have a good understanding of normalization so the designs are usually very flat for easy querying for what I typically need. SQL itself can be seen as a parabolic learning curve. The simple stuff is really quite simple, but it can become massively complex.

    Don't waste the filesystem resources with ~user/user_name. Instead, create a common location (preferably above public_html so it cannot be accessed directly), and use the db to govern it. The filenames can be created with any uniqueness to them; you simply link them to the db to display as you see fit. Case can be controlled with PHP functions such as strtolower/upper, and ucfirst for examples. SQL can also change the case (LOWER and UPPER for examples).

    Grabs yourself a WAMP/LAMP build (or manually install apache, mysql and PHP) on a localmachine for testing. Then you can constantly blow things up all you want. I'm kinetic so I'll only learn it by breaking it and fixing it.

  4. #19
    Regular Coder
    Join Date
    Sep 2012
    Posts
    100
    Thanks
    5
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by tangoforce View Post
    4) Man-up and learn



    Or look at examples on google, go through them line by line until it starts to make sense and then have a go at writing something yourself.



    Rubbish! You've only not got the hang of them because you're too scared to try. To you it all looks complicated and you've no idea where to start. I'll tell you where to start - with the basics. PHP and mysql go hand in hand.

    Let me tell you something.. I first started programming in delphi which is a windows language. I avoided databases like the plague because they seemed boring, overly complicated and frankly I didn't think I needed them when I could just stash all my data and settings into an ini file and be done with it. This went on for years.. avoiding databases thinking they were some sort of black magic and that I didn't need them. Then I switched to PHP years ago and to put it frankly, I was forced to look into it purely because I needed somewhere to store data that was thread safe. In a web environment you could have hundreds of users accessing the same script and overwriting / reading data at the same time and you can't have it stored in a text file using your own basic code because it just won't hack it. I HAD to learn how to use a database. It was all greek to me too but I stuck with it and it started to make sense. Now I couldn't imagine life without one - you can do so many things, pull out data from different tables and join it together in just one query, cross reference things, update multiple tables in one query (and multiple records) etc. It's also thread safe (assuming you're using a database server which mysql is) and frankly, it takes a lot of hard work out of writing your own data storage code. All you do is tell it what it must do and it does it

    You may think you have a long hard haul ahead of you to learn all of that but the thing is.. you haven't really. It's actually pretty easy when you set your mind to it and it takes less time than you think. Ok, you're not going to learn it overnight but you can do it in a few months with ease. The key skill you MUST LEARN is to debug code and be able to follow other peoples code. When you can do that, you're half way there and just need to become better at writing the code yourself. Half of the time you can recycle code from one project to the next too!
    I have tried learning MySQL from books, but never found one that explained things well enough to know with any ease. PHP while very basic I was able to pick up quite a bit (some I still haven't got the have of).

    looking at scripts that others write is all well and good but it's not really doing any good sine there is security stuff to consider that is not being addressed in the samples, unless its mentioned outside the code. At least with tweaking code I can interact with the code thus learning what works and what doesn't. That's what I was doing in the phpBB2 stuff was tweaking somebody elses code to some extent.

    As far as "being scared".. More just sheer frustration not having the right learning tools to grasp things.

    I have created a database for a page and it worked out but if a more knowledgeable person was to look at it, they would probably say "What the hell were you thinking there?".

  5. #20
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    332
    Thanks
    2
    Thanked 47 Times in 46 Posts
    PHP is interesting because there are multiple ways to kill the same bird. I have many times written an answer with well flowing logic but multiple lines on this Forums only for a guy like FouLu(CURSE you for not letting me shine! ) to write code using a simple 5 line elegant code using a function I did not know even existed in PHP. PHP is wide and i'll probably never want be able to know every little function, but I can learn new ones every day.


    W3schools and programming books only scratch the surface...I still refer to php.net every day probably due to the inconsistent nature of PHP functions and the fact that I sometimes forget that my IDE displays the format hehe.

    All those teach you only Syntax, for the Logic - only your brain can do that(thinking).
    Last edited by Redcoder; 12-28-2012 at 04:50 PM. Reason: To curse Foulu

  6. #21
    Regular Coder
    Join Date
    Sep 2012
    Posts
    100
    Thanks
    5
    Thanked 3 Times in 3 Posts
    Grabs yourself a WAMP/LAMP build (or manually install apache, mysql and PHP) on a localmachine for testing. Then you can constantly blow things up all you want. I'm kinetic so I'll only learn it by breaking it and fixing it.
    Actually I have XAMMP for Windows installed and do do the bulk of testing on it, but since the live server runs different software things tend to react differently.. Ever since Apache 2.2 came out and various issues with Windows 7 dumped using the individual programs and went soley with XAMMP.

    And I am pretty much the same way blow it up and hope I can fix it..

  7. #22
    Regular Coder
    Join Date
    Sep 2012
    Posts
    100
    Thanks
    5
    Thanked 3 Times in 3 Posts
    Don't waste the filesystem resources with ~user/user_name. Instead, create a common location (preferably above public_html so it cannot be accessed directly), and use the db to govern it. The filenames can be created with any uniqueness to them; you simply link them to the db to display as you see fit. Case can be controlled with PHP functions such as strtolower/upper, and ucfirst for examples. SQL can also change the case (LOWER and UPPER for examples).
    The only problem I forsee in that is on my live server I could make the common uploads folder outside the public_html folder. On their server, I know its godaddy, but don't know the specifics so I cant assume it operates the same as my live server. The only workaround to solve the accessability would be a .htaccess file to shut off indexes.

    just tried acessing /uploads/ on my server and even within the public_html folder it comes up forbidden. but I still think the .htaccess file is the option.
    Last edited by Ctechinfo; 12-28-2012 at 05:06 PM.

  8. #23
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    332
    Thanks
    2
    Thanked 47 Times in 46 Posts
    Yes. You will encounter problems when you move stuff from a windows server to a Unix one.

    For starters, Windows filesystems(FAT, NTFS) are case insensitive while Unix is case sensitive. Moving code from Windows and files to case sensitive Unix will lead to a lot of errors. The possible solution to this is to use a case sensitive coding policy or just use a virtual Machine coding environment.

    That is just one of the numerous inconsistencies that will arise when moving code from Windows to Unix. But for the standard stuff like arrays, database connections etc, everything should work well across them.

  9. #24
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Quote Originally Posted by Fou-Lu View Post
    Grabs yourself a WAMP/LAMP build (or manually install apache, mysql and PHP) on a localmachine for testing. Then you can constantly blow things up all you want. I'm kinetic so I'll only learn it by breaking it and fixing it.
    Lol, me too! I can look at examples for hours and still not understand things but by trying it out, breaking it, fixing it, modding it etc it sinks in.

    As for a wamp system, I'd recommend uniformserver. It's smaller than xamp, does the same thing and imo is easier to setup and use.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  10. #25
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Lowercase any scriptname. Found out the hardway that PHAR only seems to like itself as lower regardless of the OS. T'was pretty choked on that one (not as choked by the use of the require on a mounted file though), but taught me a good lesson (I much prefer camel casing). So now my new standard is always to use lowercase in case I use a phar with a mounted file to register load paths (for the spl_autoload_register with extensions and use in particular).

    You should always be able to get above public_html when navigating. You should have a profile under something like /users/yourusernameordomain for example, and under there is public_html. You can create a subdirectory manually to dump what you want, but apache will only go into the public_html for files to serve. PHP can go wherever it wants so long as permissions are allowed. Windows and Linux machines use different paths, but will always serve from a subdirectory within it, so you should be able to find the root path for the files that the webserver actually serves from, and you should be able to get above it while still being within your profile.

    Edit:
    ^
    Yeah I can't really recommend any specific type of software bundles for this. I've always configured each component manually instead of taking a bundle.

  11. #26
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    I recommend PHP & MySQL for Dynamic Web Sites by Larry Ullman. Excellent book
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  12. #27
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    332
    Thanks
    2
    Thanked 47 Times in 46 Posts
    I personally don't do a lot of local testing. Many IDEs and Notepad++ have automatic FTP saving which works just as local usage. I use Windows and therefore don't like the inconsistencies that arise when moving code. So I use a Live Server all the time for testing. Its not really live because people don't have its address as i have not connected it to a domain and I actually use an IP to access it, something like 80.67.91.23/testing_folder/myfile.php But thats just because I am a programmer so Ihaving my own live server is not overkill- this may not be recommended for hobbyists- its unnecessary if you don't have enough funds.

  13. #28
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Quote Originally Posted by Ctechinfo View Post
    I have tried learning MySQL from books, but never found one that explained things well enough to know with any ease. PHP while very basic I was able to pick up quite a bit (some I still haven't got the have of).
    Thats because they just try to teach you how to do stuff but never really explain it. In your xamp, turn on logging for mysql. When you run a query, go into the log, copy it, go into phpmyadmin, select your database and then paste the query in on the sql page. It will make things a bit clearer for you because not only can you see what data it's selected, you can modify the query and play with it to test out different things. Phpmyadmin is in essence, your sql debugger and experimentation tool

    Quote Originally Posted by Ctechinfo View Post
    looking at scripts that others write is all well and good but it's not really doing any good sine there is security stuff to consider that is not being addressed in the samples
    That depends on what samples you look at. Most of the time you want to look up one specific way of doing something and so that is the aspect that code snippet will show you. You then lookup other things (such as security) seperately. To be honest, security in PHP is one of those things everyone screams and shouts about but its become less and less of an issue over the years. Mysql will now not allow multiple queries to be executed at a time which was one of the biggest flaws years ago and aslong as you either escape the data OR use prepared statements there isn't a great deal of other things to worry about really. The biggest thing is to not trust user input - always check its the correct type (eg a phone number should be numerical, an email shouldn't contain more than one email address etc) and you're half way there.

    Quote Originally Posted by Ctechinfo View Post
    unless its mentioned outside the code. At least with tweaking code I can interact with the code thus learning what works and what doesn't. That's what I was doing in the phpBB2 stuff was tweaking somebody elses code to some extent.
    Yes but you'll always be a bodger like that. Someone who *thinks* they can do it but will always come unstuck somewhere along the line. Trust me, you really are better off just learning how to do stuff yourself.

    Quote Originally Posted by Ctechinfo View Post
    As far as "being scared".. More just sheer frustration not having the right learning tools to grasp things.

    I have created a database for a page and it worked out but if a more knowledgeable person was to look at it, they would probably say "What the hell were you thinking there?".
    So you're not scared of trying but you're scared of a knowledgable person criticising your efforts?

    Thats how we've all learned. You think I've not come here sometimes, given advice and been corrected by someone like FouLu? - It happens all the time. Here is one example from yesterday where FouLu picked up on a blunder I made:
    Parse error- can anyone find the issue?

    Stuff like that happens. Coders do slate other coders efforts and point out their errors and how to do things better. You just accept it and learn from it. It's nothing personal, it's often more of a courtesy to be honest so you can learn from it.

    Now with all of that said, why are you worried about another coders thoughts on your code? Just get on with learning and you'll be fine
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  14. #29
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    Quote Originally Posted by AndrewGSW View Post
    I recommend PHP & MySQL for Dynamic Web Sites by Larry Ullman. Excellent book
    This is the one I bought years ago:


    If I'm honest, i thought it was questionable

    I've no idea about his later books but the one I bought covered nothing about security, debugging, testing sql statements in phpmyadmin etc. Utter rubbish IMO as it didn't teach me anything for real world php programming. It didn't even bother to explain about the extra parameters you might need when using mail() and thats pretty basic. He even teaches you to use the isset($_POST['submit']) method which is absolutely stupid. His books may have got a lot better since then but the one I had didn't do me any favours.
    Last edited by tangoforce; 12-28-2012 at 06:19 PM.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  15. #30
    Regular Coder
    Join Date
    Sep 2012
    Posts
    100
    Thanks
    5
    Thanked 3 Times in 3 Posts
    @RedCoder - I use Windows as well. Windows 7 to be exact, only cause I lost my XP Pro disc/key in a move. I have tried Linux before but never stuck with it through the learning curve. I do the bulk of my testing locally so I can just upload completed files and go, although there are times I use /my_test_file or /test_folder/my_file to varify the code works publically as it does locally.

    What I did through Apache was setup custom localhost domains that follow the same path as my public stuff thus not having to fret over path names.

    @tango force - Thanks for the advice and book suggestion. Unfortunately being unemployed for just over a month now I am running on financial fumes so buying a book is not an option right now.

    As far as criticism, I don't mind helpful criticism infact I welcome it. I have my share of good and bad when dealing with computer repair stuff. Computers I understand the fundamentals, but still have to ask questions at somepoint (and I know I explain things poorly). As far as coding, there are aspects that are over my head so I tend to tweak code til it breaks and I fix it or replace it. The absolute basics of PHP I have picked up along the way (i.e. basic echos, file includes, if/else/elseif statements). Arrays I have a concept what they are and what they do but setting them up myself I am lost.

    As far as PHP/MySQL integration I understand the absolute basics in that I know there are different options for the database fields but as far as out puting to pages if I can manage to get it to work it does so pretty half assed.


 
Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •