Added something to the database but not reflecting in wordpress page - php

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

Related

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.

Database Concurrency Problems

I'm currently developing a database/website server interface to facilitate inputting data for a data collection project. There are two types of additions being made to the database: A and B here. Some of the tables in the database that handle these entries are as follows:
dcs_projectname_a
dcs_projectname_b
Each of these have tables for all the required input fields in addition to things like creator, timestamp, etc.
The pages on the website facilitate three different options: add, view, and edit. Each page for each type of entry performs the respective function. That is, the add page adds, view page views, etc.
I am just about done; however, there is a major challenge I haven't really confronted yet: concurrency. There will be multiple users adding content to the database at the same time. Each entry is given its own specific id and there CANNOT be any duplicate id's. That is, the first a entry is A000001, the next is A000002, and so on.
On the add and edit pages, there is a disabled field for the user to view the id for other uses when physically documenting entries.
What I need to figure out is how to implement concurrency management so that when users are concurrently adding a's that they will not be under the same id and row.
The add page automatically generates the id to be used by accessing the database's most recent id and adding one.
My thought was to create a new row in the table every time the add page is opened and give it the calculated id. Then, when information is added it performs a modification to that existing row. This way, if another user opens the add page while another entry is currently being added it will be given the future id, not the same one.
With this method I need a way to delete this entry if the user leaves the add page or closes the browser. Then, I also need other users with open add pages to automatically update their id's to one less when the first user (or any other user less than the most id being used) leaves their add page and cancels the addition.
This is kind of a complicated explanation and if you don't understand let me know and I'll try to answer as best as I can. Any help is much appreciated!
Thanks
There's a number of solutions to your problem, but you seem to have made things harder by having your application generate the record IDs for you.
Instead, you could just be using MySQL's AUTO_INCREMENT functionality to automatically generate/increment the record ID for you (upon insert). MySQL will ensure that there are no duplicates, and you can get rid of the extra database call to retrieve the most recent ID.

WordPress - Update Database Value in real time.

I have a piece of code that counts the lines of code within a wordpress site. I have successfully managed to send that number to the wordpress database so I can call on it in a different location in my theme files (this is because the script needs to be in the root of the install to count the lines of code).
Whilst this works really nicely, the BIG issue I have is that the number won't update itself automatically. i.e. the code for counting lines is www.mysite.com/loc.php and I mus go to this page and let it load before it updates the value in the database.
Is there a way to make it so that the value just automatically updates, so I don't have to navigate to the page for this to happen? i.e. when I add more lines of code, the value in the database updates itself.
Code for sending value to the db is as follows:
$num_of_lines = $folder -> count_lines();
update_option('line_count', $num_of_lines);
look into jquery and ajax call
Wordpress provides for you the framework to call backend functions on the frontend
http://wptheming.com/2013/07/simple-ajax-example/
another example:
http://premium.wpmudev.org/blog/how-to-use-ajax-with-php-on-your-wp-site-without-a-plugin/
You need to create a trigger, in order to update automatically MYSQL database
Look at this, i hope it will help
How to automatically update a MYSQL column value using formula and data from other columns in same row?

Magento query caching

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

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.

Categories