Jump to content

Zane

Administrators
  • Posts

    4,362
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Zane

  1. Hmm.. well I guess you dont need to use is_null...it seems that when you put just the variable in the condition is checks for a non-null value or a true value. Though I do still think you should implode with OR rather than AND, but you can figure that out on your own...
  2. In the code your posted earlier, you have your variables defaulting to null if they are not set, so it is null you should check for when you a creating your conditions.. It also wouldn't hurt to just put all of your condition strings into an array and then implode them with AND... so you don't end up with a trailing AND. Actually, I think it would be better if you used OR, then again I am just writing this to be writing it.... You would use the triple equals sign to check for true like that $search === 1 But like I said earlier, you defaulted all of your variables to null if they are not set so none of them will ever be "true". You need to use if(!is_null($variable)) Here is how you would do it with an array // Create variable for your WHERE conditions $where = array(); if(!is_null($search)) $where[] = "CDTitle LIKE '%$search%'"; if(!is_null($searchCDID)) $where[] = "CDID LIKE '%$searchCDID%'"; if(!is_null($searchPubID)) $where[] = "pubID LIKE '%$searchPubID%'"; // etcetera etcetera $sql = "SELECT nmc_cd.CDID, nmc_cd.CDTitle, nmc_cd.CDYear, nmc_cd.CDPrice, nmc_cd.pubID, nmc_cd.catID, nmc_publisher.pubName, nmc_publisher.location, nmc_category.catDesc FROM nmc_cd INNER JOIN nmc_publisher ON nmc_cd.pubID = nmc_publisher.pubID INNER JOIN nmc_category ON nmc_cd.catID = nmc_category.catID"; $sql .= " WHERE " . implode(" OR ", $where); mysql_query($sql) or die(mysql_error() . "\r\n" . $sql); It will also be important to check the size of the $where array before you even run the query, otherwise, you will get ALL the records.... or actually you will get an SQL error for the empty WHERE clause.
  3. Have you tried adding the http protocol to it? header("Location: http://www.example.com");
  4. In case you didn't know what to Google for before you ask this question.. it is known as a tiled layout or grid layout like you already mentioed as grid pattern. I simply googled CSS tile layout and this was the first result http://stackoverflow.com/questions/8470070/how-to-create-grid-tile-view-with-css
  5. I cannot understand your response. Are you trying to say that simply checking the Session variable is sufficient to determine logged in or logged out? I am lost in what you are trying to tell me..it is most definitely a language barrier problem.
  6. Exactly. after so many minutes you can consider a user inactive and at that point you can do a number of things. You could - destroy their session ... logging them out completely - keep their session allowing them to stay online but appear offline - create some sort of popup telling the user they have been logged out for inactivity like most bank portals do - well, I suppose that is about the most you could do...without redirecting them to google or something.
  7. The error means exactly what is says it means.. Call to a function of a non-object A non-object indicates that there is no object to be pulling a function from. I willing to bet that it has to do with you using globals,...incorrectly That quote is from the manual. Also, you shouldn't even be using globals. You have already included the file with the $db declaration...ie pdo_conn.php, Making it global is redundant. You might also want to check whether or not your pdo_conn.php file is actually being included
  8. Yeah the "flag" isn't really necessary. I just put that there to explain how to record a description of the activity. Like in IPB when you post a reply it grabs a certain script and appends something like do=postreply which is then sent to a switch I am assuming and an activity description is created.... $username . "is posting a reply in " . $topic.. But yea... the flag isn't necessary if you aren't recording such things.
  9. Let's say you have a link somewhere for say... reports. In the href of this link, you would add a flag variable to it like Reports Then on your reports.php page, you would check for that flag, create a timestamp if it is there and then update the database. You could roll all of that up into a single function Of course, you can only run this function if a user is logged in. So do that check first. When they log out, you can update that column to NULL. All you are doing is taking the exact time of when they click a link or something else and putting that time into the database. You would also put this time into the SESSION variable for quicker access. Once you have that, you find your existing queries and while loops for getting the info about your users. If the time in the activity column is older than 15, 20, 30 ..whatever minutes you feel like using, then they are offline. You can have your SQL return you a boolean for online. SELECT *, CASE WHEN TIMESTAMPDIFF(MINUTE , activity, NOW()) > 15 THEN 0 ELSE 1 END AS isOnline Then, in your PHP script you can use a simple ternary statement to display Online or Offline $onlineStatus = $row['isOnline'] ? "Online" : "Offline"
  10. Like Jessica said, you will have to keep track of everything they do. Simply storing the timestamp of when they logged in will not cut it. In a forum like this, every thing is registered and logged.. simply clicking this reply box counts as me being online. What you will have to do in the long run is restructure your current system to log everything and anything... the more you log the more accurate your online/offline status will be. And no, I am not suggesting that you create a table for all of these logs. You simply need two extra columns in your table. One to describe the action and the other to hold the timestamp... or DATETIME format which would be a lot more efficient.
  11. ....status....

  12. Fingers and toes!
  13. http://www.freshdesignweb.com/35-useful-jquery-javascript-popup-window-dialog-box.html
  14. google jquery notification or jquery alerts, jQuery will be what you use, unless of course you just happen to find someone that wrote the entire thing in pure Javascript.
  15. Unless you are still using PHP4, there is no need to use the POSIX regular expression engine. ..aka ereg. You are much better off using PCRE aka... preg to validate. I especially do not understand the use of the multibyte function mainly because I have never used it myself... and I have been able to validate phone numbers just fine without it Something like this should work just fine for a phone number if(preg_match("#[0-9{3}-[0-9]{3}-[0-9]{4}#", $phoneNumber)) echo "valid phone number" Although it isnt the most common and popular way of doing, it should get you on the right track.
  16. And what happens when you simply do this echo "<pre>", print_r($resmilestones['body']->milestone[0]), "</pre>";
  17. If you read the manual it will all become clear to you http://php.net/isset isset does exactly what it says it does.. check if a variable is set... and returns true or false.
  18. <a href="article.php/<?php $news->Title()?>"> According to your code, the method Title() does the echo. Using OOP, you do not echo data inside the class. You strictly return data. This way, you can do something like this <a href="article.php/<?php echo str_replace(' ', '-', $news->Title()) ?>"> So, go into your class file and change your Title method to return $variable instead of echo $variable.
  19. Using a left float works fine for me. Not sure why it doesnt work in the ID style. Then again, you are going about this all wrong. You are created the exact same styles for different IDs. IDs are meant to be unique, distinct, different. You need to be using classes for your pictures. Add a classname to your dynamic divs and create ONE style tag for that. echo "<style type=\"text/css\"> $div { width: 162px; height: 121px; display: inline; margin-top: 10px; margin-left: 10px; } </style>"; // creates a div names $div The above should be regular raw HTML, not echoed with PHP. Also, it should look something like this <style type="text/css"> div.imageClass { width: 162px; height: 121px; display: inline; margin-top: 10px; margin-left: 10px; float:left; } </style>; Then, in your loop, all you need to do is this echo "<div class='imageClass'>"; //display div named $div
  20. -They should change to caligraphy in my opinion
  21. Look, it is literally this simple $query="INSERT INTO boxesTable (boxes) VALUES ('" . implode("','", $_POST['box']) . "')"; No foreach needed.
  22. Since you want to capture the input of a dot (period) on-the-fly / live it is not considered a server side script. In other words.. PHP would have nothing to do with capturing the dot character as they type. Javascript is what you are looking for ... and jQuery is the best possible framework that I know of to implement your Javascript. Here is an example to get you started http://api.jquery.com/keypress/
  23. http://php.net/implode implode is what you are looking for, but like you've been advised on plenty of times so far, it is not the correct way to go and you will ultimately end up with deeper problems if you persist with the implode method. But like I have already learned from trial and error. You cannot teach trial and error, so go crazy and figure out the reason behind our advise yourself. Then you can come back and tell us, "You were right"
  24. It most likely has to do with the fact that you have spaces before and after the username WHERE username = ' " . $username. " ' "
  25. There are few episodes in Workaholics.. that mention web design and even though the show has nothing to do with programming, it is totally worth a watch. In fact, I think I will watch an episode right now. -- "It isn't very often that you get a second chance at third love"
×
×
  • 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.