Jump to content

ajlisowski

Members
  • Posts

    114
  • Joined

  • Last visited

    Never

Everything posted by ajlisowski

  1. The issue with joining that I see is that if I join I will have two results, one for each table. And in the end i need to sort by and paginate based on the results. So lets say I want to sort by price, id have a.price and b.price, one of which would be null, the other a value, how would I sort by both of them?
  2. I am simplifying a much larger issue to hopefully be able to get some insight on how best to accomplish my bigger task. Basically I have two tables, they are identical. We will call them table A and table B. All Primary keys in table B exist in table A, but not all keys in A exist in B. Data associated with the keys of B will be slightly different then that of A. I want to grab one set of data from A and B where if a key exists in B we use that, otherwise we use A. In case your wondering why. Basically I have a system where users can modify data but it has to be approved before it can go live. And when said users view the data I want them to see their modified data if it exists, otherwise they see the default data.
  3. Are you doing a lot of session management? Or any at all, within the ajax calls? What I have noticed is that if you open a session with an ajax call sometimes said call will nab up all the write permissions to that session and never free it up. Then any future PHP files will lock up waiting to grab said session for reading or writing. It is best to close the write permissions when you are done writing to a session, to avoid this. session_write_close(); will do the trick. If you are opening the session just to read from it, follow it up with a write_close immediately. If not, close as soon as you are done writing.
  4. Im confused...I am not using PHP. Lets say I have an jquery object that has a function submit. I want that function to be able to use a variable to call another function. $obj.submit=function (callfunc){ eval(callfunc+'();'); } this would call the given function. I want to do so better, where perhaps I pass the function itself and not a string containing the function name. And I dont use eval.
  5. Hey all, lets say I have a variable that contains a function name. How can I call that function without using eval? More specifically, I have created a grid jquery object. I want to use this on multiple pages to display different data. Depending on the page I want to have certain actions do different things. So right now I pass in an option containing the name of the function I want to call. I then have a function within the jqeury object that runs when the action occurs that evals that option. I dont want to use eval. How do I do this another way?
  6. For the sake of knowledge I was looking into how to pass an xml object from JS to PHP. I know that you can set your header to txt/xml in the httprequest object before sending it. I monitored my progress in firebug and can see that the POST successfully contains the xml object, but how do I actually access that in the php file? $_REQUEST is empty, which makes sense since I didnt send it as a post param.
  7. SELECT LEFT(UCASE(`title`), 1) AS `letter`, count(`title`) AS `count` FROM `lunapp_project_note` GROUP BY `letter` I think this should do what you want unless I misunderstood.
  8. What would be the harm in combining the tables, having category be 0 if a user submitted it, and have userid be 0 if it was not user submitted? Does that break normalization? They wouldnt be null values, just 0.
  9. is there an index on jobs.date? I just discovered that if you order by an index DESC will not reverse. If this is the case, try to ORDER BY jobs.date, 1
  10. Well the problem appears to be related to the fact that its using the index for the order by. I simply changed the order by to `owner`,1 and not it can not use the index and it works fine. It would have been nice to be able to index the order by to speed things up, but oh well. Solved I suppose. Thanks for the help.
  11. Hey everybody, Ive been messing around with ajax for a year or so now. However, one thing I feel like I am always sort of "hacking" together is the way I pass data back to javascript. A lot of times I will simply pass back a string with some custom deliminator (ex: ** or ||) however this does not seem to be the most effecient or "correct" way of doing things. Ive reused a ton of code, so a lot of my projects all run off the same basic handlers which explode the deliminator, check the first result for a success or error code and then handle the rest of the array as data. Is this wrong? Should I switch to using JSON or XML? Or is what I am doing acceptable?
  12. I simply have a primary key index on id and a non-unique index on owner Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment lunapr_custom_grid 0 PRIMARY 1 id A 3 NULL NULL BTREE lunapr_custom_grid 1 owner 1 owner A NULL NULL NULL BTREE Is the index on owner messing things up? I dont see how it could be. EDIT: Removing the index on order fixes the issue. However I do want that column indexed because in the future I will be running queries pulling rows based on the owner. so WHERE `owner`='whoever' Any idea why my index is causing this to occur?
  13. Im not sure how MySql orders the results beyond the defined ORDER BY, but it does. It does not simply take a random value. If I have 1000 rows with the same 'owner' field and I run a query with ORDER BY `owner` and no limits, it will return the exact same order every time, despite the fact they have the same order by value. Heck, if I run a query with no ORDER BY, it will return the same ordering every time. Thus, when grabbing portions of that query using a limit, I should be able to parse through the results.
  14. MySQL client version: 5.0.77 It appears as though this bug was fixed in 5.1.24 so it is probably what is causing it. I will check with my system admin to see if updating mysql is possible.
  15. Hi all, I am having a very odd issue with a pagination script I am running. Basically I have php code which calls the following mysql query SELECT g.`owner`, g.`name`, g.`id` AS `default_index` FROM `lunapr_custom_grid` AS `g` ORDER BY g.`owner` DESC LIMIT 0,1 It correctly returns the result. And as I go through the pages the limit changes to 1,1 and 2,1. 1,1 correctly returns the middle result. However 2,1 incorrectly returns the 1st result again. If I query the database with a limit of 0,3 I get the following: public Basic Grid 10 public test3 22 public test2 23 0,1 returns: public test2 23 1,1 returns: public test3 22 2,1 returns: public test2 23 If I do not include desc it works fine. ASC 0,3 returns the following: public Basic Grid 10 public test3 22 public test2 23 ASC 0,1- public Basic Grid 10 ASC 1,1-public test3 22 ASC 2,1- public test2 23 So how come DESC 0,1 and 2,1 return the same result? Any ideas?
  16. The posts in question appear that way to everyone, but it seems to just be some of his posts. I believe it may have to do with him pasting from word.
  17. Hey all I have a discussion system. In it, all members of the discussion get emailed upon a new reply. You can reply directly to the email, above the "do not edit" line to create a response in the thread. Everything works great, except my boss recently started seeing this character à all over the place. Any idea what is causing it?
  18. Yes sir. I used the zend tools command to create a default controller /view for the module. I made sure it had the correct prefix. I tried the entire thing again from scratch and somehow, someway, after some messing around I got it working. The sad part is, it worked how it should. I simply created the module, created the default controller and then added in the following code to my ini resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.modules[] = "" Worked like a charm this time. I swear, I spent maybe 6 hours messing around, finding other guides, asking for help and then one time it just worked. Didnt really do anything different. Oh well, Im sure Ill break something soon. Thanks a ton for taking the time to help.
  19. Hey all, I am not sure if anyone here has any experience with Zend Framework. I am trying to get modules working correctly and am struggling. Basically I have used zend tools to create a project and then create some modules. I have set up my module directory in the config file but when I go to localhost/mysite/public/modulename it says page not found. Any idea what I am doing wrong?
  20. Yeah, I was just experimenting a bit with our network and mounting on my VM. I think the best solution would be to simply create a fileshare, or a folder within an existing share, and have the server admin have the apache server mount to it. This way I dont have to have shell access for the PHP scripts to mount, and I dont have to worry about trying to mount to someone a folder which may not be shared, and may not even be there.
  21. I was not the one who set up the set up the web server. Im relatively inexperienced with linux and apache, though Im learning. I assume the mounting would have to be done on the server itself, I couldnt run PHP code which mounts to a drive could I? I suppose I could run shell commands via php to mount to the drive then go from there. However, is there anyway to have PHP get the IP address of the user and then grab shared data from there? Everyone would be on the same network...but it just doesnt seem like it would be possible.
  22. So I am working on an intranet application for a company and right now one can upload files to share with other users. The following request was just submitted by my boss... "Marketing would like to use the project system to attach media files for unified storage. The linux box is not a good place for holding that amount of data. Need to add an option to document function to choose a storage folder. The folder could be a physical drive on the machine running the browser or a network share the user has access to. If this option is chosen, then instead of uploading the files, it would display the contents of the selected folder." So basically, he wants instead of uploading, to allow users to select a folder locally and have the intranet system somehow display this to other members. I am 90 percent sure this is not possible with PHP. I dont see how it would be. Unless I could grab the users IP and then connect to that IP somehow and crawl for folders if its shared. I have no idea how I would do this though, and I still doubt its possible. Any advice? Any alternative ideas if this isnt possible? Also what is a good way to explain to my boss this is not possible without sounding like I dont know what Im talking about? Since, really I dont know much about networks so I dont know if theres some fancy way I can grab said information. Any help would be grand.
  23. The problem is he wants it to NOT order by...which, off the top of my head I have no idea how to accomplish that...
  24. it would depend on whether or not there is a need for those tables to be split. Basically, if all your media tables are going to contain the same fields, theres no need to have multiple. If they are going to have their own individual fields, (like caption for an image, or description for a video) then seperate tables would make sense. Another thing to consider is how you plan on using the data. In your case, you plan on querying all 3 formats at once. If this wasnt the case, and a majority of the queries were going to be just for a specific type, it may make sense to keep them seperate to keep the table size down by about a third when you query them.
×
×
  • 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.