Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. Also utilize the "mysql_error" function in order to get the errors to return. This will help narrow down the problems.
  2. He is right, I was in a hurry. If your trying to add something into a query at a specific location use "Update" command. If you are adding a new record use the "Insert" command.
  3. Rhodesa answered your question, I just want to add some info into this. You have fallen prey to a common problem when dealing with files and directories. Long ago I use to get very confused when it came to directories and how to access certain files in certain places. I use to get confused on using ../ and ../../ and ./ and everything else when I first started working with files and directories. It took me awhile to finally learn exactly how the structure would go in every situation. Basically let's say you are trying to accessing ROOT/tempfolder/tempfolder2/file.php In this situation you are trying to access file.php. The following legend is ALWAYS application "/" before what you are seeking will always start at root directory. So "/tempfolder" will access the tempfolder directory. Not using "/" before hand automatically means you are trying to access whatever is in the DIRECTORY YOU ARE CURRENTLY IN. So..if you are in tempfolder and you do "tempfolder2/file.php" you can access the file.php. However if you do "/tempfolder2/file.php" you cannot access it. You would have to do "/tempfolder/tempfolder2/file.php" instead. The reason being is because if you are in that folder and you use the "/" in front of what you are looking for then that means you are starting your search at the root level. Not putting the "/" is signifying that you want to start your url from the folder you are currently in. So if there was a file under tempfolder that stated "index.php" and you were IN the tempfolder location you could access that file either "/tempfolder/tempfolder2/index.php" or you could simply use "index.php". Again the difference is with the "/" symbol. When you use it you start your search at root and have to specify the exact location of your file..if you are wanting to look in your same folder then do not use that and you can just climb from the one you are in. There are other symbols as well. If you are in tempfolder2 and want to backup just to access something behind you then you can actually use the "/" to put in the full url or you can go ahead and access it via the backup command. So for example you have a file in tempfolder instead called "index.php" and your in tempfolder2. You can either access the full url "/tempfolder/index.php" or you can back up and grab it instead using "../index.php". The ../ will kick you back one folder then you can access whatever is in that folder. The ../ is a repeatable command. Everytime it is used it takes you back one folder. So if you want to go back 2 folders you use ../../ 3 folders would be ../../../ and generally you don't need to go to the trouble when you can access the folder directly using "/" command. But it is nice to know and thinking on this can help solve your directory issues.
  4. Your query is malformed. "INSERT INTO userdata (private_email) VALUES('".$email."') WHERE username = '"$username."'"; That will pretty much be the query youneed. The field/values have to be formatted as above and the where clause has to be added to the "end" of the query in this situation. Also keep in mind about security. You want to secure those variables before putting them into the database. You also want to perform some type of validation before inserting them into the database. http://www.w3schools.com will also list out examples of each type of SQL/Mysql operation that can be performed as well a proper structuring of each query.
  5. I thin you mean "How to use MVC" MVC is just one (of many) framework patterns. So far out of all of the patterns I have used I like MVC the most. The general idea is very basic. There are 3 types of logic. The Model, the View, and the Controller. The Model is where anything related to SQl/platform specific SQL or anything related to database work. This is where your queries will go. Generally you have 1 model for each database table and those models will have configuration options to help you use that model better. Then the Controller is what does all of your "work" and gathering your data and co-ordinating with the Models and gathering everything together. Then finally the View. The Controller takes all of that data and inserts it into the "view" which simply shows that data on the screen and then formats it appropriately (Xhtml/Css would be in the view).
  6. I like the general look and feel of the site. The only thing that I would rather see differently is the yellow headers on the forum for "title, username, & date". That sticks out too much and should be a different color. Other than that it looks like a nice, clean, and simple website/forum.
  7. Basically the following code is suppose to: * Display PDF file into browser * If object is not supported by that specific browser then provide the PDF via download instead. The following code works correctly in Internet Explorer 7 (and 6) but in Firefox it's not showing the PDF. Any advice? <object data="http://www.domainname.com/FamilyChoice/7Mistakes.pdf" type="application/pdf" width="700" height="700"> Your browser does not support live streaming. Download the file directly from the following link: <a href="7Mistakes.pdf" title="Download">Download</a> </object>
  8. I should have..I would have. That's the problem. I was having a minute of absent minded-ness. After fighting with i awhile I remembered how easy it really was.
  9. I think I know what I am going to do. I am just going to continue using cake for the bigger/more professional projects. When I do personal/small sites I am going to use Codeigniter. I am starting to move into Java/C++ a lot and working in those areas. PHP might always be my main language but I intend to slowly shift my primary from Web to Desktop after awhile..and interactive gaming (C++).
  10. Oh and by the way the reason why I was asking about frameworks now in the first place is because I have been using Codeigniter and cake for awhile. I haven't really tried too many others yet...except zend. The thing is now that I understand how they work it's getting to where I kind of want to get one that I can use that matches the way I program...one that I like. Now my "Favorite" so far is Codeigniter. I love it..but there is one thing I don't like. I LOVE cakePHP's templating system. having one file in layouts that can have a template put into it and then it takes form throughout the whole site. It's really convenient and makes it REALLY easy when the time comes to be able to change out layouts or have multiple layouts. That's the thing that code igniter lacks that I really want. I might just keep using codeigniter but take some time to modify it's codebase so it allows it to function that way in regard to Cakephp. After that it'll be exactly what I was looking for. So If I can't find anything I like better then I will just use that..so I get the stuff I like out of code igniter but get the template functionality that I love inside of Cakephp. @Aeglos - I just looked over that framework and to be honest it looks rather nice. It also looks to be rich in helpers, libraries, and add-ons. Thanks for the link I think I will give that a try and see how I like it.
  11. In your experience what is the current best webhost for a "Developer".
  12. This might be a similiar question but in your opinion which one of these "Frameworks" has more "Features". Cake php, Codeigniter, Symphony, or Zend?
  13. It's always good to hear from you. I haven't heard from you in awhile red. Thanks for the feedback. I am just perusing now. I have gained some "Experience time" with various frameworks. I am just in a search to find one that is going to be good for me for general use. Still using Codeigniter on Personal stuff and Cake on others...I guess just getting itchy to try out some new ones here and there and see what some of them have to offer.
  14. That is a thought. I have been looking over both Symphony and Zend. One thing I don't like about zend is no support for PHP 4. I am working in PHP 5 MOST of the time but there are some projects that don't allow that. For those..I don't want to have to change back and forth from framework to framework. It's kind of annoying. I am not sure about symphony. I am still taking a look at it and might end up using it.
  15. For awhile now I have gained some pretty decent experience using various frameworks. I used zend awhile..it's decent but not what I was looking for. The 2 I enjoyed using the most were cakePHP and Codeigniter. I started using CakePHP on my main paying project...and code igniter for pretty much all of my own personal/freelance projects. The thing is I always noticed that cake may take a few more minutes to get setup...I like it a lot more once things get rolling properly. Here is my..problem. I "Like" Code Igniter. But there are some things I don't like about it. I practically Love cakephp. The problem is CakePHP has recently developed a new release that is heavily altered from the original version. I am lost with the new version because of the way it works. Was there any documentation updates. There are things in the cakephp new release that make no sense to me (especially all of the test folders and everything).
  16. "Pre-Compiled Headers"..that was the word I was looking for. Thanks..I had other similiar questions but now that I know what those are called I can answer the rest myself. Thanks.
  17. Why is it that "Visual C++ 2008 Premiere" requires.. #include "stdafx.h" at the top of every page...but no other compiler does..in fact other compilers even throw a compile error because of it. The thing I don't get is what is it including that makes it required to run visual C++.
  18. Not sure but I just got it working. $subarealist = $this->_tpl_vars['subarealist'];
  19. I hav a varible that is passed into the view it's $subarealist. There is something I need to do using {php}{/php} tags but when I try to access it via $subarealist the array is not there. It works in Smarty like normal {$subarealist} but it does not work in php tags like that. I tried {$subarealist}, $subarealist, I tried setting it to global like {php} global $subarealist; echo '<pre>'; print_r($subarealist); echo'</pre>'; {/php} That comes back with nothing. What do I need to do specifically to make php give me access to that variable. Inside of cakes controller that variable is both set to that variale as well as passed into the view (both).
  20. I have done this before without a problem. I need to take an array within PHP and pass it into Javascript. I am using EXTJS library..with it's filter grids. About 3 of my "fields" need a list of selectable items from filtering and those options are dynamically passed via PHP into javascript. As far as I was aware there are 2 ways to do this and I have done both successfully so far on multiple occassions. 1. Get the array ready in PHP. Turn it into JSON and send it to the page. Then grab the JSON string with javascript and decode it. 2. Just simply pass the array into Javascript. I have done both methods but the following code is returning strange results: var subarealist = '{{$subareas}}'; var x; var subareastring = ''; for (x in subarealist) { alert(subarealist[x]); subareastring += subarealist[x] + ', '; } That is just a snippet from my overall code. (I am using a modified version of smarty for this project so you'll notice {{$variable}} instead of {$variable}. In this it's suppos to * Create subarealist var which has the array put into it (I have done it this way before). * Create an empty x variable which will be auto-incrementing in the for/in loop. * Create subareastring variable that's empty to store the final string. * Look through array and grab the data and put it into the string in the required format. After that I try alerting subareastring...instead of returning what I need it ends up returning half written function calls INSIDE of that variable. Also if I alert each time the for/in loop goes through like alert(subarealist[x]) it ends up just alerting parts of function calls (one's I have never seen on top of that). IT's very strange behaviour and any advice would be greatly appreciated.
  21. You misunderstood. Cake handles ALL of that automatically. The coming out of the view is passed into a string...that string is echo'd out in the template file and affectively shown in the page. I am also not sure what version of cake you are using. I have only temporarily messed around with the newest version. In the older version it was /app/views/layouts/default.tpl That is where I generally set mine up at. Now before you do anything else..stop. Go to http://book.cakephp.org/ and read EVERYTHING there. Take notes...read it and re-read it. That'll teach you EVERYTHING you need to know about setting up a basic Cake structure...how the controllers/models/views relate. And everthing about how to setup a bare bones basic app. After you get that under your belt then it's time to take a look at api.cakephp.org for a detailed listing of all there objects/methods for both the models, controllers, views, and speciality classes.
  22. Cake or codeignitor will do everything you need. Also once you learn more you can adjust it to meet your needs and carry your modified version around with you. As far as which one I recommend...neither directly. I have tried them both and like them both. If you like the hands on approach then Cakephp. but it's also harder to getting running on some servers. www.1and1.com for example (very hard to make cake work there) but it can happen. Overall IN MY OPINION i think that CakePHP is a better more refined framework than code ignitor...but I think codeigniter is easier/faster to get setup/started when it's a small project and/or your in a hurry to get something rolled out fast. If you have more time during prep then Cakephp is what I recommend but sometimes time is not an option we have.. File extensions can be what you want them to be. There naming conventions. Views are generally .php, .ctp, .tpl, or .thtml. Pick which one you like and you can alter cake/code igniter to use those extensions for views. Very simple to setup initially. The idea behind it is it's getting the data from the model automatically. YOu need to study there API and docs about there Model setup and how the Controllers relate to the models and they both relate the the view. Basically controller is what is first called it grabs stuff from the Model and puts it together in the controller and passes it into the view. The Model is what you do all of your MYSQL inside of. You still have to write/create the queries (generally using cake builtin methods if you choose) but it just keeps them seperate and makes it faster. It automatically filters them in using the templating model they have. Look for there templating folder and you'll find the header/body of cakes default format. You alter that to the style of your "site" and after that all new pages you create will automaticaly take on the layout without you having to copy/paste layout code for each and every page you try to do. Do some google searches on cakes built in Templating system and you should find everything you need.
  23. A Front Controller is just that. It's what intercepts information about what the person is trying to see...and directs the programming to find it. If you have index.php with a class inside of it which is your front controller. Thetn what happens is when someone is visiting that page it's generally setup with a function/parameter (parameter being the page that needs to be found) then a simple switch statement, or logical control structure can then tell PHP which class we need to go get for that page. Then from there it can call out the index function to gather what is needed and display the first page. THen in the future they can append new things onto the class which will hit the front control and add that into the page that's being called (which will call that class + the function name provided + the parameters. Like CakePHP. You have www.sitename.com/controllername/functionname/param1/param2 Something like that. www.sitename.com tells the browser where we are going to look for the site (the server). Then it finds it and sends out the commands Controllername...which is the name of the controller. This is grabbed by the front controller and that's what tells the front controller which class to call. Then the next one is used which is the functionname...this is the function that is called within the class. Param 1 and 2 would be parameters of that function. Say you have a users class. Your first function is your starting function index() and it's going to be called if no function names are provided via URL. Then if you wanted something for users to logout it's www.sitename.com/users/logout Which will access the users class and logout function which will perform the code to log the person out. Then same with login. YOu would have www.sitename.com/users/login/intensity Say for that example if intensity is 1 then it's a persistent login..it ifs 2 then it's just until the browser closes. Then the username/password would obviously be sent via post. Just a quick example. A front controller simply controls where the user is sent. Based on what URL they are visiting.
  24. "depends" on what you are caching. There are times when you could save data that is accessed a lot into a file...this can save some mysql load. However if you don't do it right it can cause more strain on the server. But if there was for example something you are doing in a webpage that is HEAVILY accessed...and it was causing database crashes. You could start caching certain parts of your data and limiting the amount of times the system had to hit the database. There are other methods for caching. There are "Systems" built for just that. It makes routine copies of the database and when people hit the site it gets the most used content from the "Cache" and only hits the database a couple of seconds to verify the version numerings are the same (kind of like a middle/man database) so the load is split between the cache system and Mysql. Some just have a secondary system on a secondary server to kick in as Cache when the database is overloaded.
  25. Coding with speed and coding with structure are 2 different things. I type 120 words per minute and can knock "Code" out lightning fast. But that does me no good when it comes to organization and correct structure. In order to be able to work code up fast..as well as accurately it requires a certain level of what is called "Re-usability". Needing to do something 10 times but only having to write it once is really good Re-usability. Thus the idea of frameworks come into place. A way for you to have classes that you might end up re-using throughout a given project (and future projects if you carry the framework with you) is very important. Not having a framework requires you to have to redo the initial setup everytime. If you have a good framework then it's simply work up a layout for the site/application..integrate it into your templating system..and your done. Site setup and you can just start filtering in content and thrownig in programming (in an organized manner. Look up Cakephp, Codeigniter, and google some stuff like "PHP, Correct programming structure"...and "Fast PHP development". You'll get enough content to give you reading material for a month but really digging in and breaking some of those programs up and seeing how major companies with giant applications that are years in the making..that's what is going to really sink in what it means to keep code organized, re-usable, and easily accessible.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.