PhpmyAdmin do not display one table's data - mysql

Sorry if it sounds like a very basic question but I didn't find any thing like this in site and google couldn't show me the answer.
I have a table in my database that have this strucure :
And these indexes :
It seems some thing is wrong in this table because I can't SELECT data from this table, inside some PHP code and even in phpmyAdmin.
There was duplicated indexes in this and I did drop them but still I have problem with it.
I did OPTIMIZEd table but still can't select data.
When I click on the icon to show this table(general)table structure, it's fine or when I try to select another table in the database, it's cool, but this table(general) seems to be locked or do nor work correctly.
Do you know what's wrong and how fix this?
Thanks in Advance

Related

SQL Implementation - Social Media Like Functionality

I am building a full stack app, that is kind of like Pinterest or Instagram.
I've gotten stuck, which is a horrible feeling, and I'd love any help I could get from any kind soul out there! :)
So I'm trying to implement the "like" functionality. As y'all know, you can like an entity once, and only once. What I wonder is how to constrain the database in such a way that a user can't like more than once. The way I thought I'd do this is to have a separate Like table like this:
Now of course, if I UNIQUE the user_id, then users can only like one thing on the website, which obviously would be a disaster, hah. So my question is, how do I kind of make sure there are no duplicate rows with exactly the same information in them? Or make some kind of CHECK condition when creating the table so that there can't be more than one row where the user_id and the artpoem_id match?
Or am I thinking about this the wrong way? Should I have like a separate Like table for each and every ArtPoem-entry, and then UNIQUE the user_id?
I would be SO grateful for any help, as this has been bugging me for days. Thank you kindly!
Problem solved! If anyone else sees this in the future, here's how it happened:
With the help of #Solarflare here who pointed me in the right direction, I did this in my ORM (TypeOrm):
Which yielded this raw SQL:
And now my database gives me this error below when I try to add an additional like-table entry with matching artpoemIds and userIds, which is just what I was looking for! Yippie and onwards!

MySQL read only the table has no unique row identifier (primary key or a NOT NULL unique index)

MySQL 5.7
I know squat about databases but I do have a custom program that uses the databases I have. If I want to use another account (twitter) with my program, I need to make all the datasets. I've done this a few times before. It always takes me a while to figure out, but I get there.
Yet this time I'm stuck with a read-only dataset.
What I usually do is I make a new schema with a proper name.
I then go to one of my other schemas, export what I need ('sources' and 'entries') and import them to my newly made schema.
That should work and it looked like it worked again this time. BUT there is a difference... It's read-only and I am way to green to tackle this on my own. I'll try to investigate a bit more myself, but some help sure would be appreciated : ) The warning is: "read only: the table has no unique row identifier (primary key or a NOT NULL unique index)": I couldn't find any results with this exact warning so I thought to post it here :)
Thank you!
Devvie
See my comments above on how to solve it.
TL;DL - if you are stuck with a read only schema after importing your data, you might want to tick the correct checkboxes for your schemas. Select schema, select Wrench Icon and match the table to be the same as the schema's table you imported from.
Thank you all.

mysql don't return results if not from statement but from INDEX table or something

I think my question was a little confusing.....It confused me :)
Working on a media site as a take-over project and it has a custom CMS. The client wants the ability to activate/deactivate media....sort of like Wordpress's publish/unpublish feature.
Instead of digging through all the code looking for mysql queries (which I'm not opposed to), I was wondering if you can add a sort of INDEX to a table that won't let it return result rows if that rows "active" column = let's say 0.
Just trying to be lazy and learn something at the same time, heh.
I don't need examples of queries to make it happen, btw.
What you describe is called a "view". Here is a page describing how to create them in MySQL: http://dev.mysql.com/doc/refman/5.0/en/create-view.html. However, in most cases you will still have to alter your code to use the view instead of the table.
You can consider create a view (which contains active record only)
AND swap the view name to actual table name instead, so you can achieve the negative filtering without changing any of your source code.

In phpMyAdmin, constraints cause weird dropdowns when editing or inserting

I have added some constraints to some MySQL table fields. This seems to change phpMyAdmin a little bit, including constrained fields being presented as drop down boxes in edit or insert mode:
This looks a bit weird to me, as if phpMyAdmin wants to add titles but doesn't have the correct information. Am I correct in this assumption?
And why do the IDs go from 3 to 1, then back up to 3?
I found a solution to this. I needed to configure phpMyAdmin to display related records' titles/names.
http://thedesignspace.net/MT2archives/000043.html
Now I see that the dropdown is ordering by name, then ordering by ID:

how can I add records through a query in access?

Before I remade this simple database, I was able to perform a query and update and insert new records from that query. I can no longer do this and can't figure out why.
I'm not very knowledgeable with access so any help would be greatly appreciated. I have a feeling that this may have something to do with the auto number column that no longer exists. Basically, it wouldn't allow me to change the data type after I had entered data into the table. I needed to do this to preserve the primary key as they match the client's records and cannot be changed.
If I understand you right you have a query that used to work (and insert records in a table) and now doewsn't work anymore? Can you post the SQL of the query and the structure of the table that you are inserting in? That will make it a lot easier for the rest of the world to help you.