increase performance with often used queries
Hi people :) I've been working on my cakephp project for some time now and now i start to realize that I must be able to do something with the performance. I've read alot of tutorials and I will for sure use them later on but now I have a different concern. Lets say for example I have a Car model a car has a user, speed, name etc. Every user who is logged in has a certain car like User id 4 has car id 4 User id 5 has car id 5 You get the idea. Now what my problem: I have to use this 1 car belonging to the user in many different controllers. The result is I use something like $this->Car->findById(5); very often creating maybe 5-6 times the same query on 1 page! Is there a way to reduce this somehow? Like fetching the model data once and use it for all controllers or cache it somewhere for that 1 user? I really appreciate any help. Regards Alex Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using "remove me" as the subject.
CakePHP Ajax drop with multiple parameters
Hi all, I've searched the google group and unfortunately cant find any info on this (or anywhere for that matter).. I'm trying to send PHP variables over an ajax dropRemote request but the action thats meant to be recieving the parameters is not picking it up. Basically I am trying to drag people that are trying to book a seat at a dinner dance, you have a pool of names of your guests and you drop them onto the table position, in turn i'm trying to get a hidden field using a mix of id's from the given table position and the guest id. The guest id is the same as the element.id from the dragged element. The hidden field id is the id of the hidden form element that will store the guests table position data. Div Id is the div that will show the guests name I'm trying to send the hidden field along with the dragged element id in the ajax request but it wont work.. i've tried the following: //First try: echo $ajax->dropRemote($divId,null,array('url' => '/purchases/ addGuestToTable/', 'with'=>'{draggedid:element.id, hiddenField:'.$hiddenFieldId.'}', 'update'=>$divId)); //Second try: echo $ajax->dropRemote($divId,null,array('url' => '/purchases/ addGuestToTable/'.$hiddenFieldId, 'with'=>'{draggedid:element.id}', 'update'=>$divId)); //Third try: echo $ajax->dropRemote($divId,null,array('url' => '/purchases/ addGuestToTable/'?var1='.$hiddenFieldId, 'with'=>'{draggedid:element.id}', 'update'=>$divId)); I've tried a mix of combinations but it just doesnt want to send a php variable over my parameters.. i'm using print_r($this->params) to see what the methods getting as well but the only one it finds is draggedid... Can anyone help on this? Kind regards, Bailey Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: repeatedly call controller action through ajax
´I think I've got it to work by doing as you said with a few compromises here and there : ) Big thanks I really appreciate your help. Regards Alex On 24 Mrz., 11:29, John Andersen wrote: > Ok, if your page is loading normaly, then pass the information to the > view/layout and in there, make the decision to activate or not, the > ajax request to the bar action. > How you are going to do it is up to you, I have no idea :) of what > information you use and how you have chosen to implement your solution > to your web site! > Enjoy, > John > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: repeatedly call controller action through ajax
Hi John, thanks for your answer could you explain a bit further how to retrieve the condition and return it with the result? I've worked with php a long time now but i just recently delved into ajax so I still have to find my way around. And btw my normal page loading works without ajax I only want a action which reacts to specified events (like a change in the database) to be executed over and over again and "do something" if that certain event happens. Regards Alex On 24 Mrz., 08:09, John Andersen wrote: > I am not sure how your page loading is working - with ajax or without > - so here is what I would do based on your information: > > In the first ajax call to the bar action, retrieve the dynamic > condition and return it together with the ajax result. Then act upon > it as you want. > > Enjoy, > John > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
repeatedly call controller action through ajax
Hi guys, I'm having a problem with my project where I could freak out about. The situation is the following: I have a controller foo which has an action bar. Now the thing i want to get going: have the bar action running all the time while your on the page by a fixed interval with a condition if a certain entry is made in the database. I got it to work by using ajax and the remoteTimer method. But now I have the following problem: I can't figure out how I can have a "dynamic condition" like: Only run the ajax event if a certain field in database is set to 0 or 1 I know I can control the execution by the condition param and using a javascript If() (Like: 'condition' => '10 == 90' which will prevent it from running) in there but is it possible to populate this condition dynamically from the database or is there even a better way to handle this whole situation? Big thanks in advance. Regards Alex Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Using ajax in a layout
Hi Lucca, Thanks for your replies, Could you advise me how I could use it in the layout file? Is it acceptable to do: App::import('Ajax'); then $ajax->remoteFunction() ? Cheers, Bailey On Mar 18, 4:15 pm, Lucca Mordente wrote: > and yes, you can use the ajax helper inside a layout file! > > On 18 mar, 13:12, Lucca Mordente wrote: > > > Do you want to show news updated via Ajax every time interval? > > > to simply call an ajax function on page load, this might be > > useful:http://book.cakephp.org/view/626/remoteFunction > > > to call it within a time interval you must wrap the php code in a > > javascript function and use javascript setInterval function. > > > On 18 mar, 09:44, Bailey wrote: > > > > Hi all, > > > > I have a question surrounding embedding ajax results inside the > > > layout. > > > > Everywhere you go on my cake site i want the user to always see in the > > > footer of my layout file a dynamic set of results, such as a news feed > > > that'll i'll implement using ajax. > > > > so in my layout.ctp file i have (simplified): > > > > Welcome to my site.. > > > > > > > > //ajax results > > > > So i want to write an ajax function that will always be updating the > > > footer div with a list of results, but the question is how would i set > > > up the ajax in a similar manner to how i'd set it up in a view.. > > > obviously i can't use the ajax helper in the layout file (or can i?) > > > or in say an element.. > > > > Could anyone give some advice? > > > > Kind regards, > > > Bailey Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Using ajax in a layout
Hi all, I have a question surrounding embedding ajax results inside the layout. Everywhere you go on my cake site i want the user to always see in the footer of my layout file a dynamic set of results, such as a news feed that'll i'll implement using ajax. so in my layout.ctp file i have (simplified): Welcome to my site.. //ajax results So i want to write an ajax function that will always be updating the footer div with a list of results, but the question is how would i set up the ajax in a similar manner to how i'd set it up in a view.. obviously i can't use the ajax helper in the layout file (or can i?) or in say an element.. Could anyone give some advice? Kind regards, Bailey Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Un expected Logout in cakephp session
Hi Malu, I had exactly the same issue, i kept on loosing the session (which was causing the logout) every few minutes... i found that this was only happening in Internet Explorer though and not when using Firefox. Is this the same case as you? I seem to remember by commenting out the check on the browser type (or something similar.. cant remember exactly but its in the core.php file) stopped the session being kill as often as it did... maybe that might work for you? Regards, Bailey On Mar 13, 5:43 pm, malu star wrote: > Hi, > > I have used cakephp Auth for Login purpose. But the user is logout > every 2 minutes. I have set the security level low in config/ > core.php(ie Configure::write('Security.level', 'low'). But the user is > logout every 2 minutes. Also i have increased Session.timeout . But > there is no result. Please help me to solve this issue.Expecting your > reply soon. > > Regards, > Malu Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Ajax observe field not picking up javascript field value changes
I've got round this now but im not sure if its a clean way... Instead of observing one field i observe the whole form and have added a checkbox. I populate the hidden field with the form date and force a .click() on the check box which triggers the ajax and i get my results. Does anyone know a better way of triggering ajax from javascript rather than through php $ajax->observeForm? Cheers, Chris On Mar 12, 3:44 pm, Bailey wrote: > I've done some further research on this... > > I don't think the ajax->observeField method is picking up the change > because when my javascript is changing the DOM its not registering > that change.. even though its happened. > > I've looked at other various ajax methods like remoteTimer but not > sure how i could get the value out of a form element to send to the > ajax update function.. > > any ideas? > > Cheers, > Chris > > On Mar 12, 1:57 pm, Bailey wrote: > > > Hi all, > > > Sorry for the longwinded subject header :-) wasn't sure how else i > > could sum up my issue. > > > I'm trying to run some ajax that will update a div and the way I am > > doing this is with observe field. > > > Heres how i'm trying to do it: > > > 1. Javascript function is called which updates a hidden form element > > with a date > > 2. Form element is being observed using $ajax->observeField('fieldID') > > which updates a div > > 3. The observe field calls a function in my controller that echo's out > > new information based on the date to that div. > > > Now, my form field is being populated from a 'null value to a text > > value (i.e. "21,03,2010"), and this is happening fine, its occuring > > when i click on elements of a calander i have. I've used javascript to > > send the 'date' to this hidden field as i thought it would be better > > to observer only 1 field, rather than hundreds of elements that > > represent days in a calendar. > > > My problem is that although the form field updates just fine to the > > correct date it doesnt initialise the observeField function.. rather, > > ajax doesn't recognise the change. > > > I'm relatively new to ajax and enjoying it but this is becoming a bit > > frustrating.. i don't like the idea of trying to 'trick' the ajax into > > working so i'd be very appreciative if someone could guide me to a > > better means of what im trying to accomplish here. > > > Many thanks for all your advice, > > Chris Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: access global inputfields in multiple controller
Hi Baeckeriehrling, You could store the values in the Cake session? I'm guessing you've got your menu bar as an element? I'm not entirely sure if this is the 'cake' way of doing things but you could initialise the session component in cake by doing: App:init('Session'); in your element Then using: $Session->write('dateValue',$date); and to read: $date = $Session->read('dateValue'); Probably not the best way of doing so and not entirely sure that my codes 100% there but hopefully will give you a couple of ideas :-) Regards, Bailey On Mar 12, 4:38 pm, Baeckerlehrling wrote: > hello! > > 1) I'm brand new to cakePHP, this group and web-application > development > 2) my english isn't good, so ask me to specify details, if you think > my question is useless > > what I want? > > I'd like to have two date-input fields in my application-global- > navigation bar (as far as I know this will be realizied as > a cakephp-element in the default page template) - and regardless of > which controller and action, I'd like to access these input values, > beside the url/action-parameter in every controller of my application. > is there a solution to post the values of the inputfields along with > any action and without a submit-button? > > thank you for useful hints Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: (View) How to check a fields value in a foreach loop?
Not sure what your after here.. but if your doing this in the controller then try using foreach($rows as $row) { if ($row['Model']['field'] == 0) { //do stuf... } } Is that any help? Chris On Mar 12, 4:07 pm, sebb86 wrote: > Hello, > in a foreach-loop to retrieve my data, i want to check a value from a > field. So i can retrieve only the data, i want. > > I tryed: > [code] > foreach ($rows as $row => 'Model.field' => 0): > [/code] > In this example, i only want to retrieve all data-rows from model > "Model", which has value 0 in the database field "field". > > This don't works. > Can someone help me? > > (I want to to it that way. It's for an Excel output..., so i can't do > that in my controller) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Ajax observe field not picking up javascript field value changes
I've done some further research on this... I don't think the ajax->observeField method is picking up the change because when my javascript is changing the DOM its not registering that change.. even though its happened. I've looked at other various ajax methods like remoteTimer but not sure how i could get the value out of a form element to send to the ajax update function.. any ideas? Cheers, Chris On Mar 12, 1:57 pm, Bailey wrote: > Hi all, > > Sorry for the longwinded subject header :-) wasn't sure how else i > could sum up my issue. > > I'm trying to run some ajax that will update a div and the way I am > doing this is with observe field. > > Heres how i'm trying to do it: > > 1. Javascript function is called which updates a hidden form element > with a date > 2. Form element is being observed using $ajax->observeField('fieldID') > which updates a div > 3. The observe field calls a function in my controller that echo's out > new information based on the date to that div. > > Now, my form field is being populated from a 'null value to a text > value (i.e. "21,03,2010"), and this is happening fine, its occuring > when i click on elements of a calander i have. I've used javascript to > send the 'date' to this hidden field as i thought it would be better > to observer only 1 field, rather than hundreds of elements that > represent days in a calendar. > > My problem is that although the form field updates just fine to the > correct date it doesnt initialise the observeField function.. rather, > ajax doesn't recognise the change. > > I'm relatively new to ajax and enjoying it but this is becoming a bit > frustrating.. i don't like the idea of trying to 'trick' the ajax into > working so i'd be very appreciative if someone could guide me to a > better means of what im trying to accomplish here. > > Many thanks for all your advice, > Chris Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Odd error: Database table names for model Name was not found.
Hi Vadim.. i'm still learning cake and have had a similar error to this.. some things to do / check: *Permissions on the user to those database tables / database (does it have create / read access) *Tables following cake naming format, i.e. Model = Test, Table = Tests *Try clearing the cache in /app/tmp/cache/ for the specific tables Do you get this error with an unbaked model? be interesting to know.. personally i've never used the bakery facility so i'm not entirely sure if theres any differences.. Hope this helps a bit, Chris On Mar 12, 2:05 pm, Vadim Frolov wrote: > Hi there! > > I am stuck with this strange problem. I installed CakePHP 1.2.6, database > connection is OK. I baked some models, controllers, view, e.t.c. Then I go > tohttp://localhost/cake/usersand get the error "Database table names for > model Name was not found.". I get this error with any baked model. > > If I change database.php and broke the MySQL connection, then I get the > error with the correct model and table name. > > Maybe someone had such a problem before? > > Thanks, > Vadim Frolov. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Ajax observe field not picking up javascript field value changes
Hi all, Sorry for the longwinded subject header :-) wasn't sure how else i could sum up my issue. I'm trying to run some ajax that will update a div and the way I am doing this is with observe field. Heres how i'm trying to do it: 1. Javascript function is called which updates a hidden form element with a date 2. Form element is being observed using $ajax->observeField('fieldID') which updates a div 3. The observe field calls a function in my controller that echo's out new information based on the date to that div. Now, my form field is being populated from a 'null value to a text value (i.e. "21,03,2010"), and this is happening fine, its occuring when i click on elements of a calander i have. I've used javascript to send the 'date' to this hidden field as i thought it would be better to observer only 1 field, rather than hundreds of elements that represent days in a calendar. My problem is that although the form field updates just fine to the correct date it doesnt initialise the observeField function.. rather, ajax doesn't recognise the change. I'm relatively new to ajax and enjoying it but this is becoming a bit frustrating.. i don't like the idea of trying to 'trick' the ajax into working so i'd be very appreciative if someone could guide me to a better means of what im trying to accomplish here. Many thanks for all your advice, Chris Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Get table missing error yet table exists - after porting from dev to production
Thanks very much for your help everyone :-) I should have been a bit more clear with the header information... i've gone through all my php files now and checked for whitespace, removed it all but still getting the header error... however this time its caused by something in the cake library: Cannot modify header information - headers already sent by (output started at /././cake/basics.php:108) [CORE/cake/libs/controller/ controller.php, line 644] Now what i can only think is that this is something to do with the debugger.. strangely it was just down to the fact i had the debugger in the core file set to 1... to show these header errors in the first place :p Is it weird that this happens on a live web server and not on an internal one? i cant think why it would freak out like this... Chris On Mar 4, 6:33 am, Walther wrote: > CakePHP caches your table information. If you change hosts then some > of the information changes and CakePHP assumes that the table isn't > their because it is not cached (Or something like that). Of course you > never see this issue if you are running with debug > 0 because CakePHP > doesn't cache anything then. Basically, whenever moving a Cake app > between servers always clear the cache. > > As for your 'header' error there is most likely stray whitespace in > one of your files which could be due to line ending changes or > different coding of files. Basically do a search for any > tags that have whitespace before/after them (In your *.php files). It > is for this reason that I never put the ?> tag in my php only files. > > On Mar 3, 8:11 pm, Bailey wrote: > > > Clearing out cache appeared to work... maybe there was something > > getting mixed up with the old environment. > > > It now accesses the table but i'm now getting an error: > > > "Cannot modify header information - headers already sent by" then > > gives me a model that is used to store login attempts > > > I've looked it up and apparently its to do with whitespace but this > > doesnt happen on my local dev environment... could anyone explain what > > this may mean and how I'm meant to get rid of it? > > > ...and i thought i was doing so well with cake :P > > > Kind regards > > Chris :-) > > > On Mar 3, 6:07 pm, scs wrote: > > > > I would check the following issue: > > > Is the host setting correct in the database.php file for the new > > > server? > > > Is the login/password setting correct in the database.php file for the > > > new server? > > > If you are using a share cake core is the version same as dev server? > > > Is tmp folder writable? > > > Clear out all cache folders? > > > Is there a different version of MySQL on prod from dev that could be > > > causing other issues with database naming? > > > > On Mar 3, 12:59 pm, Bailey wrote: > > > > > Hi anl, > > > > > I checked with a couple of controllers without a table with $useTable > > > > = false in place on the model and they load up fine.. > > > > > its just when it tries to access anything with the database, its > > > > difficult to check else where as the authentication i've put in place > > > > prevents me from access the rest of the site until i've logged in ;-) > > > > > Any ideas? > > > > > i thought at first it was the permissions on the postgress database > > > > for the particular user i'm using but it states all privledges been > > > > given... its very strange, > > > > > Chris > > > > > On Mar 3, 5:36 pm, anl hp wrote: > > > > > > start checking if any of your models do not use a database table? > > > > > > -- > > > > > anl > > > > > > On Wed, Mar 3, 2010 at 6:31 PM, Bailey wrote: > > > > > > Hi everyone, > > > > > > > I've finished my cake site in a dev local environment and now i'm > > > > > > trying to move it across to the production web server with is > > > > > > commercial host, theres no ssh so i'm doing everything through sftp. > > > > > > > I moved my app folder across and cake folder across behind the > > > > > > webroot, set up the paths in the index.php in the public html > > > > > > > (for ref my public html dir is outside the app folder) > > > > > > > Yet when i go to the web address it states: > > > > > > > Missing Database Table > > > > > > Error: Database table tables
Re: Get table missing error yet table exists - after porting from dev to production
Clearing out cache appeared to work... maybe there was something getting mixed up with the old environment. It now accesses the table but i'm now getting an error: "Cannot modify header information - headers already sent by" then gives me a model that is used to store login attempts I've looked it up and apparently its to do with whitespace but this doesnt happen on my local dev environment... could anyone explain what this may mean and how I'm meant to get rid of it? ...and i thought i was doing so well with cake :P Kind regards Chris :-) On Mar 3, 6:07 pm, scs wrote: > I would check the following issue: > Is the host setting correct in the database.php file for the new > server? > Is the login/password setting correct in the database.php file for the > new server? > If you are using a share cake core is the version same as dev server? > Is tmp folder writable? > Clear out all cache folders? > Is there a different version of MySQL on prod from dev that could be > causing other issues with database naming? > > On Mar 3, 12:59 pm, Bailey wrote: > > > Hi anl, > > > I checked with a couple of controllers without a table with $useTable > > = false in place on the model and they load up fine.. > > > its just when it tries to access anything with the database, its > > difficult to check else where as the authentication i've put in place > > prevents me from access the rest of the site until i've logged in ;-) > > > Any ideas? > > > i thought at first it was the permissions on the postgress database > > for the particular user i'm using but it states all privledges been > > given... its very strange, > > > Chris > > > On Mar 3, 5:36 pm, anl hp wrote: > > > > start checking if any of your models do not use a database table? > > > > -- > > > anl > > > > On Wed, Mar 3, 2010 at 6:31 PM, Bailey wrote: > > > > Hi everyone, > > > > > I've finished my cake site in a dev local environment and now i'm > > > > trying to move it across to the production web server with is > > > > commercial host, theres no ssh so i'm doing everything through sftp. > > > > > I moved my app folder across and cake folder across behind the > > > > webroot, set up the paths in the index.php in the public html > > > > > (for ref my public html dir is outside the app folder) > > > > > Yet when i go to the web address it states: > > > > > Missing Database Table > > > > Error: Database table tables for model table was not found. > > > > > I've set up the database exactly the same way from dev, in fact its > > > > just a database dump with some tweaks. > > > > > It's reconising the correct controller to load up first but it cant > > > > find the table for it, yet the table exists in the db and the db > > > > connection is connecting to it. > > > > > Can anyone understand why this might be happening? > > > > > Appreciate your help! > > > > Chris > > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers > > > > with their CakePHP related questions. > > > > > You received this message because you are subscribed to the Google > > > > Groups > > > > "CakePHP" group. > > > > To post to this group, send email to cake-php@googlegroups.com > > > > To unsubscribe from this group, send email to > > > > cake-php+unsubscr...@googlegroups.comFor > > > > more options, visit this group at > > > >http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Get table missing error yet table exists - after porting from dev to production
Hi anl, I checked with a couple of controllers without a table with $useTable = false in place on the model and they load up fine.. its just when it tries to access anything with the database, its difficult to check else where as the authentication i've put in place prevents me from access the rest of the site until i've logged in ;-) Any ideas? i thought at first it was the permissions on the postgress database for the particular user i'm using but it states all privledges been given... its very strange, Chris On Mar 3, 5:36 pm, anl hp wrote: > start checking if any of your models do not use a database table? > > -- > anl > > On Wed, Mar 3, 2010 at 6:31 PM, Bailey wrote: > > Hi everyone, > > > I've finished my cake site in a dev local environment and now i'm > > trying to move it across to the production web server with is > > commercial host, theres no ssh so i'm doing everything through sftp. > > > I moved my app folder across and cake folder across behind the > > webroot, set up the paths in the index.php in the public html > > > (for ref my public html dir is outside the app folder) > > > Yet when i go to the web address it states: > > > Missing Database Table > > Error: Database table tables for model table was not found. > > > I've set up the database exactly the same way from dev, in fact its > > just a database dump with some tweaks. > > > It's reconising the correct controller to load up first but it cant > > find the table for it, yet the table exists in the db and the db > > connection is connecting to it. > > > Can anyone understand why this might be happening? > > > Appreciate your help! > > Chris > > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others > > with their CakePHP related questions. > > > You received this message because you are subscribed to the Google Groups > > "CakePHP" group. > > To post to this group, send email to cake-php@googlegroups.com > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.comFor > > more options, visit this group at > >http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Get table missing error yet table exists - after porting from dev to production
Hi everyone, I've finished my cake site in a dev local environment and now i'm trying to move it across to the production web server with is commercial host, theres no ssh so i'm doing everything through sftp. I moved my app folder across and cake folder across behind the webroot, set up the paths in the index.php in the public html (for ref my public html dir is outside the app folder) Yet when i go to the web address it states: Missing Database Table Error: Database table tables for model table was not found. I've set up the database exactly the same way from dev, in fact its just a database dump with some tweaks. It's reconising the correct controller to load up first but it cant find the table for it, yet the table exists in the db and the db connection is connecting to it. Can anyone understand why this might be happening? Appreciate your help! Chris Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Auto create new entry in database wenn model is saved
Hi folks, I recently started using cakephp for one of my projects and I already really like it, now I have a problem which I worked on for a while but couldnt solve it yet... Lets say I have a User model and a user has a related table like Car: User 1 -- 1 Car Now by using a Form I want to save the user and the car to the database but now comes my problem: Car also has relations to 3 other tables which must be also created when a new car is created for example: 1 Carmodel table User1 -- 1 Car -- 1Attribute table 1 Misc table Is there a way I can also create those 3 related tables for car when I save User and Car? Thanks in advance regards Alex Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Getting distinct data from a psql function in a cake query
Hi all, Have a question surrounding cakephp database queries. I'm querying a psql database and the idea is I have a set of records with a date. I'm trying to provide a search option that allows you to select from a drop down lists on months and then a drop down list of years. In the drop down lists I only want to display a list of where a year is present in a record, and the same applies for months. So i have a record: ID=1,date="2010-02-01", data="blah blah blah"; ID=2,date="2010-03-01", data="blah blah blah"; ID=3,date="2017-04-01", data="blah blah blah"; ID=1,date="2018-02-01", data="blah blah blah"; So I want to produce two drop downlists that show: Years: 2010, 2017, 2018 And when a year is selected: 2010=>(February, March), 2017=>(April) and 2018 =>(February). My query SQL is: SELECT DISTINCT extract(year from record_date) from table where user_id = 1; This works and brings up the exact list of years but it when I'd call the value from the drop downlist of years i would get the associated id and not the value... so i re-worked it like: $years = $this->Model->query('SELECT DISTINCT extract(year from record_date) AS "year" from table where user_id = '.$user1.';'); $rYears = array(); foreach ($dYears AS $dYear) { $year= $dYear[0]['year']; array_push($rYears ,array($dYear[0]['year']=>$year)); } $this->set('years',$dutyYears); I can't quite model the 'DISTINCT extract(year from record_date)' which I think is causing me the problem when i try to use: $this->Model->findByuser_id($userID, 'DISTINCT extract(year from record_date')); Does anyknow know: a) how to switch from a query statement to a cake findBy statement? as i cant see if its possible to select a Distinct on the extract function... cake keeps trying to put: 'Duty.extract(year.)'; b) How i could build an options list for a form that works on the year with taking the months of each year... i've figured out the sql so far as: SELECT DISTINCT extract(month from record_date) from tablewhere extract(year from record_date) = YEAR AND user_id = 1; Many thanks for any help :-) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Form helper causing unwanted html to appear in IE but not firefox
Ah many thanks John :-) This works perfectly, although still a little bit messy in IE but i think thats an issue with the image we've used as the form button. Cheers! ~Bailey On Jan 14, 10:38 am, John Andersen wrote: > I am sure that this is not a good idea! > You are creating 7 forms with the same id-name! Suggest you move the > form creation outside the loop and make your submit button provide the > correct duty id. > > [code] > create('Duty', array('action' => > 'displayDutyDetails')); ?> > > > > > > > > > > > submit('../img/icons/view.png', > array('label'=>'View', 'duty_id' => $duty['Duty']['duty_id'], > 'width' => '40px', 'height' =>'25px', > 'onmouseover' => 'javascript:this.src="../img/icons/ > view_over.png"', > 'onmouseout' => 'javascript:this.src="../img/icons/view.png"'));? > > > > > > end();?> > [/code] > > Observe that the table is inside the form. You had a mixup with the > sequence of the table and the form tags. > Enjoy, > John > > On Jan 14, 11:57 am, Bailey wrote: > > > Hi all, > > > I'm trying to display data in a html table from a database query. > > > The data appears but I want to be able to provide an option from each > > record shown in the html table, i.e. (view more details button). > > > I do this by creating a form inside the php loop that generates the > > table data. The form holds a hidden field that stores the record id i > > want to look up further with another function in the controller. In > > firefox this works perfectly but in IE it screws up, the button's dont > > appear and I get extra tables appearing above the results table that > > matches the same number of records in that table. > > > (i.e. loop goes through 7 times, prints out 7 lots of data, but prints > > out 7 extra tables above). > > > I'm sure theres a simple fix to this but i'm having real difficulty > > finding it. Does anyone know of anything i can do to fix this (or if > > theres another means that I can achieve the same result)? my table > > code is below, i'm not using any other styling at the moment apart > > from the cakephp default one. > > > Many thanks! > > > Code - View.ctp > > == > > > > > > echo $form->create('Duty', array('action' => 'displayDutyDetails')); > > echo $form->hidden('duty_id',array('value' => $duty['Duty'] > > ['duty_id']));?> > > > > > > > > > > > > > > > > > > > > > > submit('../img/icons/view.png', > > array('label'=>'View', 'width' => '40px', 'height' > > =>'25px', > > 'onmouseover' => 'javascript:this.src="../img/icons/ > > view_over.png"', > > 'onmouseout' => > > 'javascript:this.src="../img/icons/view.png"'));?> > > > > end();?> > > > > > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Form helper causing unwanted html to appear in IE but not firefox
Hi all, I'm trying to display data in a html table from a database query. The data appears but I want to be able to provide an option from each record shown in the html table, i.e. (view more details button). I do this by creating a form inside the php loop that generates the table data. The form holds a hidden field that stores the record id i want to look up further with another function in the controller. In firefox this works perfectly but in IE it screws up, the button's dont appear and I get extra tables appearing above the results table that matches the same number of records in that table. (i.e. loop goes through 7 times, prints out 7 lots of data, but prints out 7 extra tables above). I'm sure theres a simple fix to this but i'm having real difficulty finding it. Does anyone know of anything i can do to fix this (or if theres another means that I can achieve the same result)? my table code is below, i'm not using any other styling at the moment apart from the cakephp default one. Many thanks! Code - View.ctp == create('Duty', array('action' => 'displayDutyDetails')); echo $form->hidden('duty_id',array('value' => $duty['Duty'] ['duty_id']));?> submit('../img/icons/view.png', array('label'=>'View', 'width' => '40px', 'height' =>'25px', 'onmouseover' => 'javascript:this.src="../img/icons/ view_over.png"', 'onmouseout' => 'javascript:this.src="../img/icons/view.png"'));?> end();?> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Displaying data from mutliple tables / models
Hi all, I am new to cake within the last couple of months but I am a experienced PHP programmer. I've made a few basic applications in practice to building my own time and event management system. I have a question regarding how to pull data from multiple tables... I have a user profile table and a 'duties' table, a user can have many duties and each record in duties counts as one duty. In the duties_controller i create a function that requires input from the user: (first name, last name, month and year). I take the first name and last name and pass it to the user_profile model to find a valid user id. I then use this user id to display all duties for that user within the last month, but the duties tables relys on relations as well as specific values. In my displayDuty() in the duties_controller i set a variable which is then used in the display_duty.ctp view to loop over all the user duties and echo them to a table. duties_controller display method: $conditions = array("month(Duty.duty_date)" => $monthNo); $this->set('duties', $this->Duty->findByuser_id($user), array ('conditions' => $conditions)); My question... (and sorry for the long build up :p): Is there an easy way to pull out data from relationship tables from duties using the value given in the view, so I do a foreach loop in the view and could do: $duty['Duty']['station_id']; But what i really want is the station name from the Station table, similary how would I pull out data not in the duty table but related to the user id, such as user_role from Usr_roles table.. I might be making this too complicated but would appreciate any advice :-) could i just do a simple sql lookup? i wasnt sure if its right to do this within a view and not the controller. Many thanks for any info, Bailey Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en