Disappearing files from server and records from database - php

I know that's a silly question, but I've tried everything.
Project that I'm working on was maintained by many people, so it's very buggy.
Once a time, photos with random generated names are disppearing from server. Last days, db records disappear to, but mostly without any relation with other.
I've search in files for commands
unset()
and doctrine
delete()
and nothing strange found. Do you have any ideas how could it happen? Maybe it's the server problem, not the code?

Related

Procedure in handling: Multiuser working on one data set

more an approach question, how to deal with the problem:
What methods, approaches, techniques, ideas or terms can be used for the following problem?
Several users should be able to access (read, write, recreate, edit) a web address book.
How do you handle the case that several users are working on one record at the same time?
E.g. editing or one user reads the record while another user changes it (e.g. phone number), then the reader doesn't even notice that his information is no longer correct and it leads to problems.
Are there any known (even new) approaches here?
Bit researched but many entries in forums are already many years old.
Many thanks.

How bad it is to copy paste my own code blocks?

! Actually, I am learning PHP from last couple of months and now I am in a stage where I can program small things like a simple Login Page in PHP and mySQL or a Contact Form. I have wrote a lot of codeblocks like inserting something into a database or selecting something from a database etc. etc. But, I always copy paste my own code-blocks from previous projects while working on a new one. So, I want to know whether this tendency is unique to me only or each of the beginner passes through the same phase once during their journey of being a developer?
Please bear with me because I know this isn't really a programming question and doesn't worth your time as well. I tried finding out in Google as well but this is a snap of what I found:
I mean to say that most of the search results dealt with copy pasting other's code which is not the case of what I am talking about. In order to save time I do copy paste my own code blocks almost everytime. So, how bad is this behaviour of mine?
I again apologize for not posting a question that is worth your time but I am finding it hard to learn to code by myself without having any mentor nearby ( Actually, I searched for a mentor who could teach PHP before giving it a start all by myself, but I found none in my area ) for clearing my doubts and as such Internet is the thing which I mostly depend upon for learning about anything.
This question probably belongs on https://softwareengineering.stackexchange.com but I'll try to give you a decent answer and some guidance.
People re-use their own code all the time. You do not however want to copy/paste if possible. The issue with copy/paste is when you have something used more than a few times - like a MySQL database connection - and it needs updating. I'd rather modify one file (or one small group of files) and have all of my webapps fixed/updated than having to modify 2 or 3 database calls in 9 different web apps...
For things that I use everywhere/all the time - talking with our course management systems API, authenticating a user against our LDAP server, connecting to a MySQL database and running queries, processing forms that are emailed, etc - I've built up my own (or coworkers have) sets of functions, classes, etc. Which I then keep in a single directory, and can include as needed.
If you do this, you want your functions/object methods to be as generic as possible - for example, my MySQL query function takes several arguments - an associative array with connection info (since we have several DB servers based on purpose), a query, and an array of parameters. It returns an array with a status code, and then appropriate data - the record set result for inserts, the ID of the last insert, the count of rows affected (for delete/update). This one function handles 50+ queries and connects to 4 different MySQL servers.

mysql rows are deleted by themself

I am developing a web application based on php/laravel. It is about to finish and we are testing it nowadays. But there is a problem with mysql table.
I have a table called follows.If someone follows another, I create a record on this table. There is no problem here but periodically records on this table is deleted and it is not triggered by user who doesn't want to follow someone. Or there is no intervention by system admin. Even more, I have 20+ tables and just follows table has this problem.
I checked my codes and I couldn't find any reason what causes this problem. I inspected mysql table on phpmyadmin and again I couldn't see anything wrong. Now Can you say 'there is something like that and causes this problem'? Or how can I debug this problem on mysql? Is it good trying to go for triggers? I need to find what is causing this problem.
There is no more I have to say, and I am about to go crazy..
Please write down what do you need to here extra that I forget to write here..

Drupal / phpMyAdmin Issue

Came across a weird issue today.
Have a Drupal site, been live for a few years now, and this is actually the first time I've had to look at anything with it.
I needed to check out one of the tables in the MySQL database, anything I select for it throws a 500 Server Error popup, but does not do this for all tables.
I thought maybe a repair would do, but of course InnoDB doesn't support that, so I am at a loss to what the issue could be, and how I can get into this table to view/manually modify some records.
Can anyone help?

Optimizing and compressing mysql db with drupal

I have developed a news website in a local language(utf-8) which server average 28k users a day. The site has recently started to show much errors and slow down. I got a call from the host saying that the db is using almost 150GB of space. I believe its way too much for the db and think there something critically wrong however i cannot understand what it could be. The site is in Drupal and the db is Mysql(innoDb). Can any one give directions as to what i should do.
UPDATE: Seems like innoDb dump is using the space. What can be done about it? Whats the standard procedure to deal with this issue.
The question does not have enough info for a specific answer, maybe your code is writing the same data to the DB multiple times, maybe you are logging to the table and the logs have become very big, maybe somebody managed to get access to your site/DB and is misusing it.
You need to login to your database and check which table is taking the most space. Use SHOW TABLE STATUS (link) which will tell you the size of each table. Then manually check the data in the table to figure out what is wrong.

Categories