Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. $result = mysql_query.... $category_id = ''; while ($row = mysqlf_fetch_assoc($result)) { if ($row['category_id'] != $category_id) { //Output the markup for a new category here. $category_id = $row['category_id']; } // Output comment markup here }
  2. Did you restart mysql and apache? Please provide the full current source of the script(s) you have right now.
  3. Historically, PHP lagged behind ASP and Java developers for a long time, but as it has hit critical mass in the last few year, PHP salaries have gained parity as demand has skyrocketed. Unfortunately the IT industry in the country in which you live is predicated on low pay in comparison to western countries, as a way to attract out sourcing dollars from European and US companies. I can assure you that top notch PHP skills are in high demand, however, PHP also suffers somewhat of the same issue that visual basic use to suffer, which is that there is a low barrier to entry, since it's such an easy language to pick up the basics in, and there are is subsequently a glut of entry level developers. It has taken time for companies to learn that these developers often can not transition to senior level skills, and require a lot of senior level mentoring. You can differentiate yourself by earning certifications from Zend, MySQL and some of the big frameworks like ZF or Symfony. Purely chasing dollars, Java with Oracle is a lucrative market, but of course you are going to need to develop significant skills. Not unlike PHP, often the thing that will get you a job is your expertise in a particular niche, and java is no different. For example, if they are using Spring, and you don't have spring experience, you're not going to get the job. In PHP if the shop is using Zend Framework and you don't know it, you probably also will not be considered. If you are otherwise happy, gaining certifications and approaching them about promotion to a more senior level is one way to attack the problem of a low salary. If your company simply is not interested in your advancement you may have to leave, but that is simply a reality of the modern world.
  4. You can't judge the age of a Pokemon on the same scale as that of humans. For Pokemon 10 human years is like 1 Pokemon year, so Pik2k is really only like 10.
  5. This is not a forum for bringing in 3rd party scripts you don't understand and asking people to do free modifications for you. It's a place for people to learn PHP.
  6. In SQL when you inner join 2 tables you will get a row every time the joined columns match. In your case, order by catagory, comment_date or whatever the appropriate column name is. As you fetch the rows in a loop, use a variable to hold the category_id. Anytime this changes you should output a new category section and set the variable. There's not much more to it than that.
  7. Mysql has an extremely lightweight connection mechanism. Unfortunately pconnect is prone to causing mysql to run out of connections, and the best practice in my experience is just to use mysql_connect.
  8. I don't see anything that is obviously wrong. First thing I would try is restarting mysql and apache. If that does not solve your problem, I would question the user you are using in the script and its permissions. How were permissions granted and can it see the pages table.
  9. wildteen88 is correct that I think it's cleaner to have your dev server configuration set the document root to be the '00_MyWebsite' directory, however, what you did will also work fine.
  10. Are you saying that everything could be done with pure PHP too, but cURL (as a library) makes life much easier similar how jQuery makes life easier? Yes exactly.
  11. It does work. The problem is that you are not sure what your webroot is. On your development machine, which is where you are doing your development your webroot is / but you are running all your scripts from /00_MyWebsite/. You can either set the webroot to reflect this (although I would not) or you can adjust your httpd.conf for apache so that the webroot reflects that you're running from /00_MyWebsite/.
  12. In terms of the webroot, i personally wouldn't use that nor set it, because it's easier to specify the webroot path. The problem you had with the image is that: images/logo.jpeg Is a relative url, because you did not specify the leading '/' for the webroot. Change that to: /images/logo.jpeg And you've made it an absolute path. The webserver will automatically append on the hostname so you can omit the use of the WEBROOT constant if you'd prefer to apply KISS.
  13. I think it's fair to say that many people use IDE's that have a project concept built into them. All the files for a particular project are organized, and there are typically inspection and class hierarchy views that can be of great benefit. Netbeans and Eclipse w/PDT are 2 excellent free java based editors with an amazing number of features in each.
  14. Most of us experience these types of things at one time or another. I've said this many times over the years, but I don't mind admitting that despite having been a professional programmer at numerous software companies, and having worked on the development of hundreds of websites used by millions of people I still learn something new about web development on weekly if not daily basis. For me it's part of the fun that it continues to offer a challenge, but people regularly underestimate how complicated it is thanks to books that claim it's "easy". If you go back in the thread and look at my earlier reply, I did point out that the includes deal with files and are relative to the filesystem of the server, while url's inside html are relative to the webroot. Maybe that is not as clear as I think it is, but getting clarity on that will save you a lot of banging your head against the wall. The webroot is webserver magic. I often call this "webspace". If something is in webspace you can type in a url like "http://www.mysite.com/something" and it will return that to you, whether it be an image, .css, .js, .html or .php. Deconstructing that, the webroot is "/". So when you're dealing with things that are sent in html, it's always relative to the webroot. It doesn't matter that the real path on the server (or your workstation with WAMP) is /user/me/documents/00_site/ because the webserver takes care of that, so inside your html the only thing that is ever important is where that exists BELOW the webroot. Since php includes are files from the filesystem, those functions, along with any of the file reading or writing functions, ALWAYS are relative to the filesystem. They don't know or care about the webroot or webspace. They need to know where is that file inside the filesystem on this machine that is running apache/php. If you can keep those two separate systems clear in your mind, you'll be breezing through includes and urls.
  15. Try ON SCHEDULE EVERY 1 DAY START NOW() Did you turn the event scheduler on? SET GLOBAL event_scheduler = ON In doing a show processlist; you should see it. Otherwise the events will never fire. Assuming everything is working, you can do this: SELECT LAST_EXECUTED FROM INFORMATION_SCHEMA.EVENTS; If null, the event hasn't run, otherwise you should get a timestamp.
  16. First a tip. You will save yourself a lot of time and trouble in realizing that you do not need to concatenate just because you want to have a newline in your string. This is the same as what you have. $query = "INSERT INTO aliens_abduction (first_name, last_name, when_it_happened, how_long, how_many, alien_description, what_they_did, fang_spotted, other, email) VALUES ('Sally', 'Jones', '3 days ago', '1 day', 'four', green with six tentacles', 'We just talked and played with a dog', 'yes', 'I may have seen your dog. Contact me.', 'sally@gregs-list.net')"; If you could not connect to the db you'd be getting the first error, so there's a problem in your query. Try returning the actual error message. $result = mysqli_query($dbc, $query) or die(mysqli_error($dbc));
  17. There is no reason for you not to include the config file first, and not using it everywhere defeats the purpose. As for what you accomplished -- would you rather manually type in the full path to every included script you need in every script? Along with all the extra work, you open up the possibility that you'll make a mistake and have to debug why something that works in several scripts doesn't work in a 3rd. In software engineering there's a term for this idea: DRY At some point let's assume that you move your files from one host to another. Do you think going through every file and looking for/changing several include paths is a good way to go? Web development is difficult and there's a lot to learn. Just putting things in perspective for a minute, what you describe as taking a day and a half would take an experienced php developer literally 5 minutes. Please don't misinterpret my meaning -- most of the people who have been answering your questions are professional web developers who studied computer science, or have spent literally years working with php. It would be unreasonable to expect that you're going to be either proficient or efficient when you're just learning the basics. In my opinion, you seem overly concerned with these questions -- as if you're expecting to at any minute stumble across some secret that reveals to you that everyone here is an idiot, and there's actually a magic button you can push and websites pop out.
  18. Yes MVC requires oop but a simple controller only requires a switch statement and typically reads one or 2 parameters total. I'm not going to twist your arm, but you did ask for a solution to the problem of having multiple different files. Here is what I'd suggest. Use the technique I just described inside a file in the root (where your index.php file is) in a script you call config.php. Notice that the special property of http://php.net/manual/en/language.constants.predefined.php __FILE__ is that it will provide the path of the file that contains it, no matter where that file on the file system. In your scheme you know that this file will always be in your root directory, so anything you use it for will always be relative to it. You can then specify include($basepath . '/components/body_header.inc.php'); And know that no matter what script your talking about you will have the right include. The only fly in the ointment is that you need to know for any script where to get the config.php from, in a relative sense. For index.php it's simple: require_once('config.php'); For your checkout.php script: require_once('../config.php');
  19. What you could try instead is inner joining by user id a query for each word in the list. The result set would only be the users who had all 3 words.. the logical equivalent of intersect of 3 seperate queries each for one of the 3 words.
  20. Just now seeing your last post, it might help you to have it stated that the php include/require functions are all file system based. They are rely on knowing where the other files are on the server. This allows you to do things like include files from directories that aren't accessible via a url (they are outside of webspace). Url's are all based on webspace ... so they are all relative to the home directory for your website. So an is always going to be relative to your website. Typically people have static directories for images, javascript and .css so that you can always specify an absolute/relative url for them like:
  21. Hey Debbie, PHP has page scope. People either love that or hate it, but it's a basic principle of the language in web application use. Variables exist for the lifetime of the script and not beyond. I think I probably alluded to this a while back, in a reply to one of your earlier posts, but this is why it is good to have a controller script that is the basis of your site, and through which everything runs, rather than having many individual independent scripts. This allows your controller script to include things that might otherwise be constants. PHP constants have some things about that that are pretty annoying, and they aren't highly used. The main argument in favor of their use is that they can't be changed once they are defined (with the define() function) but when you have a page scope language, the concern about someone changing a variable like that isn't that great, and instead the OOP data structure that most people favor these days is to instead use a config class that loads configuration variables and makes them available throughout the application. One example of this idea is the zend framework config class which supports a bunch of different file formats where you can setup what would otherwise be constants. http://framework.zend.com/manual/en/zend.config.html Something like a base path is often derived from having the controller or bootstrap run some variation of: $basepath = dirname(__FILE__);
  22. There is not much to using php's curl api, and many many curl questions have been answered on this forum in the past. Did you try a forum search? Curl can be used for a variety of different purposes, however for the most part, it's simply a protocol library that talks http, ftp, imap, smtp and a laundry list of other common internet protocols, allowing you to automate activities that you might otherwise do manually via a client, be that browser, email, ftp, telnet etc. Most of the time it's used to do things like fetch data from a server that typically expects a browser -- as in submitting a form and then looking at the results. Curl has lots of built in capabilities that might otherwise require a lot of code, allowing it to handle things like redirects, cookies, and authentication. If you have a specific question feel free to follow up. It's the kind of thing that is quite frankly, so easy to use, you will be far better off spending your time doing a quick curl based script than you will be scouring the internet looking for a video on how to use it.
  23. Do you have a test url I can look at?
  24. karker, UTF-8 is basically compatible with 8859-1. I would suggest that you keep everything UTF-8 across the board, so the problems would most likely be solved by not trying to use 8859-9, and instead store the characters as UTF-8 and use UTF-8 as your charset.
×
×
  • 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.