Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Code looks alright to me. Alternatively you can use curl, but if your code works, I don't see any reason to change. Don't know why you plan to use pclzip when you can use the http://us3.php.net/zip extension.
  2. No. An active directory user is a microsoft operating system specific function that exists at an entirely different network layer and protocol from the WWW. There's a couple of techniques that *might* work for you in this thread: http://stackoverflow.com/questions/168610/can-you-get-a-windows-ad-username-in-php
  3. First off don't use right join. It's the same as a left join and is non-standard. Even MySQL tells you not to use it. Left join your larger table to your smaller one, and even for rows in the left table where there is no corresponding match, you'll get a row. If this is not what you're trying to do, please explain further.
  4. Your problem is that you are not having your inner group by include both the apn and the bid. You also want to eliminate cancelled bids in the group by query. select p.* from prop p inner join (select apn, max(bid) as bid from prop WHERE bidstatus = 'ACTIVE' GROUP BY apn) m on p.bid = m.bid AND p.apn = m.apn;
  5. No, the backticks have nothing to do with sql injections. They simply insure that mysql doesn't confuse table or column names with reserved words, allowing you to do things like name columns "order" or a table "select". Not that these are good ideas by any means, but it does allow you to get away with those types of things.
  6. If they used an activex control that might be possible. It is not part of ldap.
  7. I don't see anything wrong, but I'd try: 1. Removing the width= for the table. 2. Changing all the single quotes to double quotes around the attributes.
  8. I don't have a clue what you're talking about, sorry. Maybe try with some pictures? Posting a directory with a bunch of scripts is really not very helpful. JQuery's entire reason for being, is that it's cross-browser, so when you say that you tried to use it and it "failed to work correctly" I have to question how much effort you put into that before you dismissed what is easily the most heavily used and tested javascript library in the world.
  9. Ok, adapt what he provided by removing the setInterval() wrapper. Then specify this as the onClick() for your button.
  10. You aren't checking for return values, so either the mysql_connect or the mysql_select_db could have failed.
  11. That is not possible. You can pull information from AD via ldap but there is no magical association that will occur that tells you a particular user who is browsing a page is even logged in. There is no intrinsic connection between the OS user and browser instance.
  12. I wrote about this long long ago http://www.gizmola.com/blog/archives/51-Exploring-Mysql-CURDATE-and-NOW.-The-same-but-different..html
  13. That's a good point. Add some code to the addToLastViewed() function that will strip out prior occurrences of the same id in the queue. This can be easily done using array_diff. function addTolastViewed($id) { $maxcount = 10; $r = array(); if (is_array($_SESSION['lastViewed'])) $r = $_SESSION['lastViewed']; // Check if we've recently viewed this same picture if (count($r) > 0) { $r = array_diff($r, array($id)); } array_unshift($r, $id); if (count($r) > $maxcount) array_pop($r); $_SESSION['lastViewed'] = $r; }
  14. I don't know what these id#'s refer to, but in general , you can foreach through an array() foreach($_SESSION['lastViewed'] as $id) { // use $id to lookup image info and display it? }
  15. You need the function to be available in the script where you call it. So if you have it in a functions.php file you'd need to include or require it, or just have it defined somewhere in the script. If you copied and pasted my code into your own, your error could reflect the fact that php is case sensitive. Would need to be addTolastViewed($id) Notice the "camel" casing I used.
  16. Here's a test program to show you: function addTolastViewed($id) { $maxcount = 10; $r = array(); if (is_array($_SESSION['lastViewed'])) $r = $_SESSION['lastViewed']; array_unshift($r, $id); if (count($r) > $maxcount) array_pop($r); $_SESSION['lastViewed'] = $r; } session_start(); $avalue = rand(1, 1000); addTolastViewed($avalue); echo "This id: $avalue "; echo ''; var_dump($_SESSION['lastViewed']); echo '';
  17. What you describe is called a Many - to - Many relationship. A customer can "be a part of" 1 to many projects. A Project can have 1 to many Customers. You need a table that sits between the 2 tables to resolve the many to many relationship. I usually will call a table like this projectcustomers or customerprojects. It will often only require the primary keys from each table: customerprojects ----------------- customer_id (pk) project_id (pk) When you create your form with the list of customers and the accompanying checkboxes, give them a name like cb_customer_{customer_id}, so if you looked at the raw html you might see something like: With PHP, when you process the form, you will only get the name of the checkbox in the $_POST[] if it was checked, so all you need to do is go through the $_POST looking for variables that start with 'cb_customer' and parse the customer id off the end. Then build an INSERT statement and create all the rows you need in the customerprojects table. Frequently if I do something like this, I'll DELETE FROM customerprojects WHERE project = $projectid first, to clear out any existing rows, so that if people uncheck a row that was previously checked it gets removed.
  18. Session variables can store arrays. For something like this I would probably use array_unshift() and array_pop() to create a lifo queue. Something like this would work: function addTolastViewed($id) { $maxcount = 10; array_unshift($_SESSION['lastViewed'], $id); if (count($_SESSION['lastViewed']) > $maxcount) array_pop($_SESSION['lastViewed']); } Now whenever someone views a picture, you simply have to call that function and pass it the picture id, and you have a session variable with up to 10 pictures in it.
  19. Yes, it should retain it's "string" type when you render the xml.
  20. One of the tags needs to include the selected attribute. I'm not sure how you're planning to use this but it is not a question of javascript, since you're submitting the form anytime this is changed. Instead, it's a question of examining the $_GET[] for the current value and setting the selected to be that value in your php script. This is because you specified the method of the form to be get, but if it was a "post" method as most forms are, you'd look at $_POST. $timeoptions = array(1 => 'New', 2 => 'Old'); if (isset($_GET['Time'])) { $selectoption = ($_GET['Time'] == 'Old') ? 'Old' : 'New'; } ?> </pre> <form action="<?php%20%24_SERVER%5B'self'%5D;%20?>" method="get"> foreach ($timeoptions as $id => $value) { $selected = ($selectoption == $value) ? ' selected' : ''; echo "$value"; } ?> </form
  21. Not really. Why would a page that allows you to edit the source of another page, be rendering it?
  22. PHP is loosely typed, meaning that it typecasts on the fly depending on how you are using a variable. If it's already in a string format, it won't typecast to a numeric form unless you attempt to do arithmetic on it. You can always use printf() to format a number in a particular manner if you are starting with an integer, and need to add a leading zero.
×
×
  • 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.