Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Yes, looks like safe mode is turned out on your server. Is this shared hosting?
  2. How do you know it's not going to be a help? If the script is sitting there waiting on something that it doesn't need to wait on, then you solve your problem entirely by making it asynchronous. The task will get done, and the user will have the responsiveness desired.
  3. gizmola

    mvc .

    You should also take a look at zend_view from the zend framework. Even if you don't end up using one of them, you can see how the approached the problem, which will help you better understand what would be involved in rolling your own soluiton ala xyph's suggestion. Many people don't realize that while ZF includes a full mvc, you can use many pieces including the zend_view by itself.
  4. gizmola

    mvc .

    There are plenty of 3rd party template class libraries you can find. This list is a little old but it gives you a starting point: http://www.livexp.net/technology/php/top-25-php-template-engines.html
  5. So all you need look at is" php image upload".
  6. You might consider trying the technique used by this guy to make it asynchronous: http://robert.accettura.com/blog/2006/09/14/asynchronous-processing-with-php/
  7. The include family of functions (include/require/require_once) all work with file system paths. So you have the option of doing one of 3 things: -Use the full path to the file (as xyph suggested) -Use a relative path (for example, you had a lib directory where the file was, you could specify 'lib/Mail.php' -Or there is the php include path. If your script is in a directory in the include path php will find it there. Typically scripts that are obtained through pear will be in the include path, so if this is where you got the Mail library, that is something you might want to check in your configuration.
  8. Seems pretty odd behavior. What is the the script doing?
  9. I understood your structure when I answered the question. You are right that your syntax is wrong. Please google or read http://dev.mysql.com/doc/refman/5.0/en/join.html Something close to this should work SELECT p.* FROM Friends f JOIN (Post p) ON (p.user_id = f.friend_id AND f.user_id = $userid OR p.user_id = $userid) You also need phpMyadmin or command line mysql access to be able to test out queries in advance. Obviously you replace where you're going to have variables with a literal id# that you have in your test data so you can have a reasonable expectation that the query will work once it's coded in your php script.
  10. You join from friends to posts on posts.user_id = friends.user_id AND friends.friend_id = {id of current user} OR posts.user_id = {id of current user} . I don't know if you omitted it in your description but posts certainly needs a datetime or timestamp so you can order the posts in some fashion -- most recent first being the typical approach.
  11. You should start with a LiveCD and see how that works on your machine. A liveCD boots up Linux off the CD and will attempt to recognize the hardware you have. If that runs and you can get a GUI up, you have a pretty good idea that the hardware in your machine will be found by the Ubuntu installer, since both have a common heritage in Debian.
  12. If you look at the url you are outputing you'll not that it literally contains the variable names, rather than the contents of the variables at runtime. When you use single quotes you get that behavior, as single quotes create a "string constant". What you want is either a string concatenated together in pieces or to use double quotes so that you get variable interpolation. In this case, all the double quotes are a problem but there are various ways around this. One technique you can use is to drop out of php where the interpreter then considers your code to be html. //your script ?> " alt="Ad" width="100%" /> You might also find it useful to use a "heredoc" but I'll leave that to you to lookup if you're interested. You can also escape all the internal double quotes and still have that work, but I personally find that tedious, error prone and hard to maintain when you have html with a lot of double quotes around attributes.
  13. What I already explained in the prior post, that I guess you skimmed to the bottom of, so that you could take umbrage rather than analyzing what I was showing you, is that this script depends on the other script working right, and that script did not work right for the reasons I took great pains to explain. Whatever family baggage you have, please don't bring that into it. You came here for help and I tried to provide it to you, but ultimately you have to help yourself. You have a funny way of looking at things, considering that I've answered thousands upon thousands of questions for people like yourself for no other reason than to try and help them learn how to program. You are right I don't know you, and I don't need to know you to go through this thread and revisit all the times that you were provided a reference to something you needed to read, only to have you follow up almost immediately with a post demonstrating you decided not to take the time. Pasting another reply with more of the code you don't understand, along with another error message, that you wouldn't even have if you'd corrected the other problem, is exactly what I was referring to, and all you've done is proven me right. Either you want to learn how to program, and succeed at developing your system, or you don't, but trust me when I tell you that when other people seem to care more about trying to help you learn this than you do, there's something wrong with your approach.
  14. Seems pretty clear that the script needs to include Mail.php, but can not find it for some reason. Is there a script named Mail.php in the same directory as this script?
  15. No. $query = ("SELECT id FROM users"); // Perform Query $current_id = mysql_query($query); $user_current_id = mysql_fetch_assoc($current_id) $_SESSION['current_id']=$user_current_id; The way you learn is to read the manual page for the functions you don't understand. Otherwise you will continue to blunder from mistake to mistake like this. First a note: You changed what was in the manual in term of variable naming for no good reason that I can see. When you do a query you get a resource back -- in this case it's a result set resource. Resource variables are special variables that exist only during runtime of a script -- things like file handles, or database connections, or a handle to a result set. You chose to do this: // Perform Query $current_id = mysql_query($query); Why? Is it wrong to name your variable $current_id? You can name a variable anything you want, but why name it $current_id when it has nothing to do with the $current_id. It's a database result set. Choosing that name just made you have to come up with other bizarre variable names further in your script. Just use $result!!!!! Your main issue however is that you have not picked up on what mysql_fetch_assoc() does. $user_current_id = mysql_fetch_assoc($current_id) $_SESSION['current_id']=$user_current_id; So what you do here is fetch one row (you omitted any error checking of course even though the manual example showed you how to check it). But the main problem is that mysql_fetch_assoc returns an ARRAY!!!! In this case it's an associative array where the keys of the array match the column names from the result set. So when you saved it into the session variable, you are saving an array, and when you try and use it later, it doesn't work in your queries, and they bomb out, causing you more confusion, and chasing your tail further. Here's the code you SHOULD have used: $query = "SELECT id FROM users"; // Perform Query $result = mysql_query($query); $row = mysql_fetch_assoc($result); $_SESSION['current_id'] = $row['id']; This unfortunately is an approach that makes little sense in this context. You are doing a SELECT * FROM user, which ostensibly is a table with many users in it as time goes on. But this code, fetches the first row in the table and that is the basis driving other scripts? Something is missing. I've corrected this so you can understand the mechanics involved. Hopefully for your own sake you'll learn enough about how these things work to be able to accomplish your goals, because cutting and pasting and attempting to modify scripts you don't understand adequately in the first place is a recipe for nothing but continued failure and flailing. This may seem harsh, but from my point of view, looking at the fact that you have 548 posts, and yet are copying and pasting what is the most basic and trivial code, while at the same time seeming to have no idea what the simple functions do or how to use them properly, just indicates to me that you're putting in no effort. You need to try harder.
  16. Yes and right below that code there is this code: if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } // Use result // Attempting to print $result won't allow access to information in the resource // One of the mysql result functions must be used // See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while ($row = mysql_fetch_assoc($result)) { echo $row['firstname']; echo $row['lastname']; echo $row['address']; echo $row['age']; }
  17. silverglade you need to read some basic information when it's posted to you. Session variables don't work until you start the session. You have to session_start() first always. You also did not read about mysql_query. mysql_query returns a resource to a result set, when the query succeeds. You then need to fetch the results, so no your code will not work. I'm not going to rewrite what is already written in crystal clear fashion in examples they provide in the manual pages I linked for you.
  18. The setting you want: error_reporting(E_ALL & ~E_NOTICE); For a production server, you want your php.ini (depending on the php version) to set this either to be off, or to send to stderr. You don't want to have to set this in your scripts.
  19. Yes, they are called kernel modules. A subset of kernel modules are device drivers. This provides you some information about key commands like modprobe and lsmod. There is no universal source for device drivers, and often, because linux device drivers are written by people other than the hardware manufacturers themselves, you have to understand what the underlying hardware components are. This site has links to a lot of resources you can read about: http://www.linux-drivers.org/
  20. Ok, well, as I stated previously it's not an error. You can control the "level" of error reporting your site provides, and furthermore it should be logged and not displayed on a production site. Really these notices exist to help you write really clean code, but in many cases, even if you don't write the cleanest level of code, you will not have issues. See error_reporting
  21. Look at the link I posted. Also read mysql_query so you actually understand how to use it.
  22. Not going to help you strip out the copyright notice of a site you are scraping. Sorry but no.
  23. You might be able to accommplish this with mod_rewrite and the use of setEnv. I don't see what analytics has to do with search engine ranking however. I have a high bounce rate and it has no effect whatsoever on the articles that people bounce from, many of which are first page google results for one or more of the most relevant keyword searches for that material.
  24. Well the problem exists in the code, whether you happen to stumble upon it in testing or not. If you try and access an element of an array that doesn't exist you'll get a notice, unless you either insure that it exists, or check using isset() to short circuit the access as I showed you.
×
×
  • 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.