Magento query caching - php

How to cache the query result in magento if I am creating some module.
Basically I am creating one module for the announcement in which admin will add some announcement from the admin and it will be displayed on the front end(live website)
Now if the information entered though the admin is not dynamic so I want to cache the information while modifying(add, edit delete ) and show in front end. it will save my database query time

If you only cache the query result your block is still going to be generated every time. (Besides, MySQL already has a query cache)
It is better to cache the block output which saves even more effort for the server.
http://www.magentocommerce.com/wiki/5_-_modules_and_development/block_cache_and_html_ouput

Related

Reflecting data change (CRUD) in all other places in the flutter application

I am working on an application using flutter and Mysql DB with PHP Laravel , I have the same post on two different pages (posts come from view in DB).
when I delete or add or edit (do CRUD functionality) that post on the first page the effect does not reflect on the other page in the application (inconsistency), so I must refresh the other page (call API) to show the effect in it.
I try to get all lists that contain posts and search on them to see if a post exists there and do they reflect on it, but there are 3 or 4 lists I need to check every time and this makes the process complex on RAM as a phone application. I also search for something like ajax on the web but I found nothing.
what I need is when I delete or edit the post on the first page this post is also deleted or edited on the second page without doing a refresh.

Added something to the database but not reflecting in wordpress page

there is this wordpress plugin, the main functions of that plugin is to take data from the user and write that data to the database, it also Update data and Delete data, then display the changes to the page that the plugin provides.
Now, I want to add thousands of items, but I cannot manually add each items using the plug-ins interface because that would take so long, so what I did is I head over to phpmyadmin locate the tables of the plug-in and I use sql Insert to add data to the database, after trial and error, I SUCCESSFULLY inserted all of the data in all of the tables that is relevant to the plug-in, no errors!.. I analyzed it carefully. but when I head over to the page, and to the live site, the items that I inserted is not showing up. not even one. the items that is only showing is the items that I added using the plug-ins interface, what should I do?
Good job by the way, but make sure that
1. You're inserting data to the correct schematic & table.
2. You didn't insert a null or invalid data (like floats in int data type)
3. try refreshing the page if that's a cache problem, clear the cache and try again

How to add only one data in database table in laravel

I am creating a site and i am making a general option page for the site that include the site name, logo, social links so that i can manage them dynamically from one place without changing the links and text in all pages where i called them.
What I want is that the table i created in database, i want to have only one row in it. If someone try to add other row of data it should not be added because i have to call only one data for the site.
I hope the query is clear to all.
Thanks for your support. Help me if u can. please :)
By,
if someone try to add other row of data it should not be added
what do you mean? Are you trying to avoid unauthorized access? If yes, then you need to implement roles https://laracasts.com/discuss/channels/general-discussion/roles-and-permissions-in-laravel-5
To manage your site information, I'm sure you set a form that will be used to update the site info. And from the look of things you will only be updating that row when you hit save or update button. I don't think you will be doing full CRUD here just updating so there'll be no chance of inserting a new row of data in the db.
So three things:
you want to create a migration, seed the table with the site details accordingly. run the migration
you want to make sure the user trying to access this route is authorized to do so
you want to pre populate the site info in the form fields when the edit site info page loads and you want to save the form when the authorized user changes any of the site info
This way, there'll be no question of stopping further insertions into the db.

Why is the record not showing up in the DB

i am trying to create a custom solution for a client using their prior system. The client is using Miva which is a user friendly CMS type system to manage their store. The problem is prior to yesterday everytime i entered a record in the miva site it would show up in PHPmyadmin and I could query it and use the Custom solution. FOr some reason now when I create products in the admin I get no records in the DB.
The product is clearly there
but not stored in the db, any ideas on how and where is stored
Logic dictates that either:
Your query was wrong
You're querying the wrong database
The website does not relate to the database you're querying
You're asleep and none of this is real.
Are you able to do a wildcard search for something specific like a piece of text or file location? If no errors are being thrown when you're adding items then it should be there.

How to create igoogle layout(drag & drop & store) using PHP and AJAX?

In igoogle, we can drag & drop the modules and then if we quit the browser and open it again, the position of each module still the same. I have tested couple of things:
When not logged in, igoogle store the modules position in my cookies(cache). Because if I clear cache, it goes back to original position.
When I logged in, after positioning the modules, even I logout and clear my cache, if I login again, the modules still the same, not back to original position.
What i want to ask:
How to store the modules position for logged and not logged in user?
Whar are the required skills? (I use php, mysql and jquery)
Is there any good tutorials I can reference to?
There is a very good tutorial here:
http://nettuts.com/tutorials/javascript-ajax/inettuts/
You will have to store the users data in a mysql table. Maybe set up a "column / row" column in your mysql table with a linked content id. If you do not have any knowledge of relational databases, it would be a good idea to start there. If you do understand the db fundamentals, then it would be a simple update query to store the users info based on a cookie that is set to expire far into the future.
If you allow users to log in (like google), then the use of cookies is not necessary (but can still be useful), as you can use the div position data that is stored in your mysql table.
Logic behind drag and drop
use http://jqueryui.com/demos/sortable/ to enable a sortable list of divs
process the sortable("toArray") to the database
load it in order from db to get them in place

Categories