
Slowie
Members-
Posts
52 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Slowie's Achievements

Member (2/5)
0
Reputation
-
Ive sorted this problem mind lock released this morning now i have an issue of i currently have and array what looks like this when output Array ( [0] => Array ( [start] => 58 ) [1] => Array ( [start] => 58 ) [2] => Array ( [start] => 57 ) [3] => Array ( [start] => 57 ) ) how would I now using php add the values from this array using only the previous and previous previous keys e.g 0 result would be 0 1 would be 58 2 would be 116 3 would be 173 and so on for a dynamic array thanks in advance
-
Thank you however i changed my code overnight and now its more like this... i need it to divide up 800 into equal or near equal arrays. array(800 values) minarraysize = user submitted max array size = minarraysize+(minarraysize-1) remainder_after_division = count(array) % minarraysize ; arrays to split into = array / min array size if ((remainder_after_division < minarraysize ) || (remainder_after_division != 0)){ its here where i get stuck as if the arrays to split into is 25 i need it to cycle through 26 arrays adding 1 each time untill all of the values have been used so itd look like => Array ( [start] => 0 [split] => 36 ) [1] => Array ( [start] => 36 [split] => 36 ) [2] => Array ( [start] => 72 [split] => 35 ) [3] => Array ( [start] => 107 [split] => 35 ) }
-
hey guys just a quick onei having a blank moment i have an array at themoment pulling from a database. i basically want to split this array based on a min and max value. divide it equally and then give it a value on each smaller array and where each array starts... to make it clearer - say i have an array with 600 values in i want it split up into 8 smaller arrays link so Array ( [0] => Array ( [start] => 0 [split] => 75 ) [1] => Array ( [start] => 75 [split] => 75 ) [2] => Array ( [start] => 150 [split] => 75 ) carrying on till the end ) how would i do this.
-
i solved it in the end the query i was looking for was as below. but thank you for the help everyone SELECT options.optionsid, userlevel.Description, branch.branch, COUNT(*) AS Staff, stafflist.user_level FROM stafflist Left Join userlevel on stafflist.user_level=userlevel.level Left Join branch On stafflist.branch=branch.branchid Left Join options On userlevel.level=options.user_level Where options.branch=stafflist.branch GROUP BY branch, user_level
-
currently with $sql = "select options.company, options.user_level, options.branch, userlevel.Description, branch.branch as branch from options left join branch on options.branch=branch.branchid left join userlevel on options.user_level=userlevel.level where options.user_level != '0' And options.user_level != '2' And options.user_level != '4' AND options.company='".$_SESSION['company']."' " ; i get the branch along with the userlevel so that is 1 - 1 1 - 2 1 - 3 2 - 1 2 - 2 2 - 3 now i know i need to left join in the stafflist table and do a count similar to this one SELECT branch, user_level, COUNT(*) AS staff FROM stafflist GROUP BY branch, user_level this gives me the results i want but i need this in one mysql query for a table i just cant work out how to do it
-
nope this is way out haha just been messing around with it again. i cant get this right
-
ok so going on that my current code is select options.company, options.user_level, options.branch, userlevel.Description, branch.branch as branch from options left join branch on options.branch=branch.branchid left join userlevel on options.user_level=userlevel.level where options.user_level != '0' And options.user_level != '2' And options.user_level != '4' AND options.company='".$_SESSION['company']."' so the code after the changes will be SELECT options.company, options.user_level, options.branch, Count(stafflist.userlevel) AS userlevel userlevel.Description, branch.branch AS branch FROM options LEFT JOIN branch on options.branch=branch.branchid LEFT JOIN userlevel on options.user_level=userlevel.level LEFT JOIN stafflist on stafflist.branch=options.branch WHERE options.user_level != '0' AND options.user_level != '2' AND options.user_level != '4' AND options.company='".$_SESSION['company']."' GROUP BY options.branch, stafflist.userlevel would this be correct?
-
can no one give me a little advice on this?
-
hey guys ive been trying to do this one all night and i dont know if im either approching it wrong or its just not possible. i have tried multiple ways of doing it but havent succeded. basically i have 2 tables one called user level and one called stafflist now in the user level table i have 2 companies with 3 userlevels for each so company userlevel 1 1 1 2 1 3 2 1 2 2 2 3 now in the stafflist table there are lets say 40 staff members and each have a field filled in which is the company with either 1 or 2 they also each have a user level assigned. so 1 , 2 or 3 what i want is for the query to count how many staff are assigned each level for that company so the end result is a table like company userlevel number of staff 1 1 15 1 2 3 1 3 2 2 1 18 2 2 2 2 3 0 could someone explain how i would go about this. ill figure out the exact code but i just need a shove in the right direction
-
im working on that atm but for a quick setup i needed to do this as multiple branches and branch setup wernt asked of originally. my plan for the future is to use a single header file. this was the only copy needed in the future is the css file as each branch will have different colours. thank you for the advice though it is much appreciated
-
ive made a website where the user might want to add a branch. the website has a login and each user has a branch id associated with it. when they log in it loads a specific css file and header file. what ive done is when the admin user wants to add a new brnch i didnt want a phone call saying could you add it in so ive made a page where they enter the branch name and select a colour then upload a banner and the page created everything like the header file the css file and the images for that branch. it means little interaction from the user and little chance for me to miss something.
-
i could kick myself for this but its my error because i was referencing a file what wasnt in that directory. spotted it this morning after i had a few pints last night and a sleep. it now works thank you so much
-
ah thank you ive tried this and yet still im getting the error my code is <?php $banner = "/images/" . $name . "/Banner.png"; $template = fopen("../Header/Template.php", "r"); // with the appropriate checks of course $data = str_replace( '/*-headerbanner-*/', $banner, $template); //etc, str_replace your vars $handle = fopen("../Header/" . $name . ".php", 'w'); // with the appropriate checks of course fwrite($handle, $data); // with the appropriate checks of course print "Data Written"; fclose($handle); ?>
-
ive just noticed that if i add another branch then it dupicates my data onto however many tables e.g. table1 table 2 table 3 if i add 2 more branches what would cause this?
-
on your advice i did this $banner = "/images/" . $name . "/Banner.png"; $data = fopen("../Header/Template.php", "r"); // with the appropriate checks of course str_replace( '/*-headerbanner-*/', $banner, $data); //etc, str_replace your vars $handle = fopen("../Header/" . $name . ".php", 'w'); // with the appropriate checks of course fwrite($handle, $data); // with the appropriate checks of course print "Data Written"; fclose($handle); however the file generated only has "Resource id #12" inside. whats happening with it?