Jump to content

JipThePeople

Members
  • Posts

    51
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

JipThePeople's Achievements

Member

Member (2/5)

0

Reputation

  1. I am running php 5.4, IIS 7.5 on WinServer 2008 R2 box. I want to retrieve all subfolder names in a directory using PHP. I can successfully perform this task IF the target folder exists on the same drive as the php code, which is on c:\. However, I need to retrieve subfolder names from the e:\ drive on the same server. I have the permissions properly set for IUSR and IIS_IUSRS (read & exe, modify) for the target and parent folders but of course I don't have those permissions all the way to the root of e:\ drive. Using scandir(), I get "Access is denied. (code: 5)" but I have tried glob() and RecursiveDirectoryIterator to no avail. I have not been able to find a solution or an example so perhaps it is not possible. Any recommendations are greatly appreciated.
  2. To complete the query I had to add the code: AND `t2`.`userid` = '599zxj' to the WHERE statement or it would retrieve archived projects NOT assigned to user '599zxj'. SELECT `t1`.`id`, `t1`.`name`, `t3`.`status`, `t5`.`access_start_date` FROM `project_info` as `t1` LEFT JOIN `user_assignments` as `t2` ON `t1`.`id` = `t2`.`propid` JOIN `status` AS `t3` ON `t1`.`status` = `t3`.`id` LEFT JOIN `archive_expiration` AS `t5` ON `t1`.`id` = `t5`.`propid` AND `t5`.`userid` = '599zxj' WHERE `t1`.`archived` = '1' AND `t2`.`userid` = '599zxj' GROUP BY `t1`.`id` ORDER BY `t1`.`name`
  3. Thanks so much for the recommendation. The group by t1.id was the solution. Many thanks to you as well as the others who posted a response. SELECT `t1`.`id`, `t1`.`name`, `t3`.`status`, `t5`.`access_start_date` FROM `project_info` as `t1` LEFT JOIN `user_assignments` as `t2` ON `t1`.`id` = `t2`.`propid` JOIN `status` AS `t3` ON `t1`.`status` = `t3`.`id` LEFT JOIN `archive_expiration` AS `t5` ON `t1`.`id` = `t5`.`propid` AND `t5`.`userid` = '599zxj' WHERE `t1`.`archived` = '1' GROUP BY `t1`.`id` ORDER BY `t1`.`name`
  4. Thanks for the response. So integrating your recommendation, the updated query is now: SELECT `t1`.`id`, `t1`.`name`, `t3`.`status`, `t5`.`access_start_date` FROM `project_info` as `t1` LEFT JOIN `user_assignments` as `t2` ON `t1`.`id` = `t2`.`propid` JOIN `status` AS `t3` ON `t1`.`status` = `t3`.`id` LEFT JOIN `archive_expiration` AS `t5` ON `t1`.`id` = `t5`.`propid` AND `t5`.`userid` = '599zxj' WHERE `t1`.`archived` = '1' GROUP BY `t5`.`propid` ORDER BY `t1`.`name` User '599zxj' is assigned to 3 archived projects, one of which has a corresponding record in the archive_expiation table, This revised query will retrieve 2 of the 3 records, but if I remove the corresponding record in the archive_expiation table, it will only retrieve 1 of the 3 records. Any other recommendations are greatly appreciated.
  5. Thanks for the response. The archive_expiration table is required because certain users when added to a project, have their access limited to 180 days, Therefore, an access start time record is inserted into the archive_expiration table and is used when determining project access by comparing the access start date to the current date.
  6. I have the following four tables. The query below is supposed to retrieve all projects and related data in associated tables where the project has been archived (i.e., archive field in project_info table set to '1') and user ID = '599zxj'. While user '599zxj' is assigned to 3 projects that have been archived, only one record is returned and it is the project that has a record in the archive_expiration table for user ID = '599zxj'. SELECT `t1`.`id`, `t1`.`name`, `t3`.`status`, `t5`.`access_start_date` FROM `project_info` as `t1` LEFT JOIN `user_assignments` as `t2` ON `t1`.`id` = `t2`.`propid` JOIN `status` AS `t3` ON `t1`.`status` = `t3`.`id` LEFT JOIN `archive_expiration` AS `t5` ON `t1`.`id` = `t5`.`propid` WHERE `t5`.`userid` = '599zxj' AND `t1`.`archived` = '1' GROUP BY `t5`.`propid` ORDER BY `t1`.`name` project_info table - archived field will be '1' when archived ----------------------------------- id | name | status | archived ----------------------------------- 1 | Proj A | 4 | 1 2 | Proj B | 5 | 1 3 | Proj C | 2 | 1 4 | Proj D | 3 | 0 5 | Proj E | 1 | 0 status table - Provides project status referenced in project_info table --------------------------- id | status | sortorder --------------------------- 1 | prelim | 1 2 | stage 1 | 2 3 | stage 2 | 3 4 | stage 3 | 4 5 | submitted | 5 user_assignments table - Associates a user id with a project id to determine project access ------------------------ id | userid | propid ------------------------ 1 | 599zxj | 1 2 | 599zxj | 2 3 | zrt321 | 2 4 | 599zxj | 3 5 | 765xzg | 3 archive_expiration table - Applies only to archived projects; access can expire for users with records in this table --------------------------------------------- id | userid | propid | access_start_date --------------------------------------------- 1 | zrt321 | 2 | 2014-01-15 09:22:56 2 | 599zxj | 3 | 2014-09-08 15:45:14 Any recommendations will be greatly appreciated.
  7. I have a table with lots of records. My table has the following field, with records containing either NULL or '1' that I need to modify. -- Current `archived` int(1) unsigned DEFAULT NULL But I need to modify it so that it is NOT NULL and defaults to '0'. I have tried the following but it throws an error. -- Error "#1265 - Data truncated for column 'archived' at row 1" ALTER TABLE `proposal_info` MODIFY `archived` INT( 1 ) UNSIGNED NOT NULL DEFAULT '0' -- SAME AS ABOVE EXCEPT NO QUOTES AROUND 0 - Error "#1265 - Data truncated for column 'archived' at row 1" ALTER TABLE `proposal_info` MODIFY `archived` INT( 1 ) UNSIGNED NOT NULL DEFAULT 0 I need to modify the table so that the records that are NULL for that field, will be updated to '0'. I need the records that are currently '1', to retain that value.
  8. Thx for all the replies. I got it worked out. I appreciate the help!
  9. Thanks for your response. I'm not sure a JOIN is required since all the data required is in the user_assignments table. I need a list of propids where user 'abc123' does not have a matching record for that project. All that info is contained in the user_assignments table. Here is the user_assignments table. CREATE TABLE IF NOT EXISTS `user_assignments` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `userid` varchar(100) NOT NULL DEFAULT '', `propid` int(10) unsigned NOT NULL DEFAULT '0', `security_level` int(10) unsigned NOT NULL DEFAULT '0', `role` int(10) unsigned DEFAULT '0', `custom_security` int(10) unsigned DEFAULT '0', PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; I ran the query you suggested and it returned an empty set which is not correct because there are projects not assigned to user 'abc123'. Does this additional information clarify my problem a little more? I really appreciate you taking the time to review my issue.
  10. Server version: 5.5.23 - MySQL Community Server I have a table containing project assignments represented by a projectid column and a user_assignment column which contains the user's unique userid. A user is assigned to a project if they have a record in the user assignment table associated with the project id. I want retrieve all the projects that a specific user is NOT assigned to without getting duplicate records since there are many users assigned to projects. While these examples will retrieve only one record per project, it returns projects that user 'abc123' is and is NOT assigned to. I need to retrieve the project ids that the user is NOT assigned to. SELECT DISTINCT `propid` FROM `user_assignments` WHERE `userid` <> 'abc123' ORDER BY `propid` ASC SELECT DISTINCT `propid` FROM `user_assignments` WHERE (`userid` <> 'abc123') ORDER BY `propid` ASC I also tried a sub-query but it locks up mySQL in phpMyAdmin and never returns any records which is telling me there is something really wrong with this. SELECT DISTINCT `propid` FROM `user_assignments` WHERE `propid` NOT IN (SELECT `propid` FROM `user_assignments` WHERE `userid` = 'abc123') ORDER BY `propid` I have limited experience with writing SQL so I would really appreciate any recommendations. I am sure there is a very simple solution but I am not seeing it.
  11. I can successfully concatenate strings and vars to assemble a php var using an echo statement like this: echo "<input type='radio' id='radio_btn_" . $Row['question_number'] . "_0' name='question[question_" . $Row['question_number'] . "]' value='0' checked='checked' />"; However, when attempting to reference the same var in an IF statement, I can't seem to get the syntax right. I know this syntax is wrong, but I list it for reference to describe the issue I am trying to solve. if ($_POST['radio_btn_' . $Row['question_number'] . '_0'] == '0'){ I also tried curly braces but can't arrive at a solution. Any advise would be appreciated.
  12. Can you please provide one more example since the last one didn't return any records? If you have any other ideas, I would greatly appreciate it.
×
×
  • 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.