Editable list using php mysql [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm a beginner to this whole mySQL thing and I am working on my first website. I understand how to setup the database I would need for this, but am unsure how I would implement it. I want to allow logged-in members to add input into a list such as the following:
First Name | Last Name | Timestamp | Poster
I want this to be saved to the database. Ideally the member will be able to input into the first two columns and the "timestamp" and "poster" will be automatically filled out. I'm not necessarily looking for a full explanation but maybe someone to point me in the right direction.
Thanks a bunch!

For the timestamp field, you can use a default value, although it is usually best to have your application handling such things (say using an ORM).
To default to the current time, in the mysql console, type:
ALTER TABLE myTable CHANGE COLUMN myColumn DEFAULT TIMESTAMP;
For the user, this will need to be inserted by your application unless you only have 1 user. You should really look at using some sort of Framework to handle these tasks.

Related

How do I create and run the custom database? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
When I created my pet site and visiting it. I noticed money systems and pet systems all need database for them. But I'm wondering is there any way to create new rows for money system? I need money system for that to purchase virtual pets and itens.
So is there any codes when i click on a thing in the site that adds or removes from database date? Thank you a lot!
I thought that follows that code before I know DB:
<?php
$coin=50;
?>
There are no 'magic buttons' working out of the box - you can get that kind of button but you need to create DB structure, connection, write proper functions/methods (depends on your coding approach) and then bind it to that button.
Even if you are going to use some package/plugin or whatever you find useful - you need to have configured DB to be able to use that.
It is even hard to send you some links with examples/documentation as you did not give any kind of information regarding what (I guess) CMS or service you are using.
Deliver more info and then there is a chance that someone will be able to help.

Multiple filters on a table with the ability to add more [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am in need of creating a table that will get its data from a database (this is done:) ).
The users must be able to filter the table if they want to find specific rows based on the their input.
The table will have around 33 columns which not all of them will be visible, but the user can drag and drop new columns whenever he likes. and be able to filter the table using values from these columns as well.
The table will look like this and every time the user inputs something on the top of a column then the table will get filtered based on that column. also multiple filters can be placed.
Any suggestions on how to do this? is it even possible?
I would like suggest you to use http://yadcf-showcase.appspot.com/DOM_source_chosen.html jquery plugin for datatable also it works with ajax source

SQL table - Data management [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am creating a website where users can easily calculate the calories they eat and see the repartition in term of fat, carbo, etc.
I want the users to be able to retrieve data from previous days.
I then need to store the data sent by my users everyday (basically, they input how much of each food they have eaten everyday and I am making the calculation then store the results).
The question if the following: what would be the best way to store the data? I have to store the data for each user for each day. I can't think of a simple solution (I think creating a new table for each new day would not be great, would it?).
I'm using PHP and MySQL for now.
Thanks for the help!
It seems that you are a step ahead of your self with the daily breakdown question.
First, you need to decide what you need to store, e.g. fields and normalise the way they are stored.
For example, you would have the following tables:
Users:
Id
..
EatItems:
UserId
ProductId
Calories
Fat
DateTime
Once you have these tables up and running, you can build reporting layer on top of that to breakdown consumption by user / date or anything else you might be interested in.
You could have a table that holds the input/calculated data/date which relates to a user/account.
When the user views previous day's, select the data that relates to that user.
I wouldn't create a table for each day. One table would suffice.
However, I would suggest attempting something and posting the code for specific issues you have if you run into before posting here.

Simple Voting phpmyadmin mysql database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am running an apache2 webserver and want to run a database off of it using phpmyadmin. I am making an android app that needs to connec to make http requests. The app is a simple app where there are 2 buttons and the user can click on the buttons as many times as they want to vote on each person. I was thinking of creating one table with 2 columns in it with the name as "person1" and "perosn2" but according to my research, that won't work. Could anybody give me a simple run through of how i would get this to work. i hve confused myself.
You probably want 2 tables something like this.
People:
id | name
Votes:
id | person_id | timestamp
When someone votes for someone, create a new record on the votes table using the correct person ID. The id could be stored on the android device if it doesn't need to be dynamic.

Best method for storing customizable status flags, and writing customized queries based on said flags. [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Right now, I have an app where theres a sales table.
So far Ive done fine with storing the status of a sale in an ENUM column type.
(APPROVAL, WAITING, PAID, INVOICED, COMPLETED)
However the client keeps wanting to add more statuses.
So I don't want to keep changing the ENUM column.
Id prefer that I just build them a customizable system, where they can create their own flags for rows.
And then the system, creates queries on the fly, based on these flags.
What would be the best method to do this?
Maybe this is too broad a question and not best for StackOverflow?
The best method is to have a reference table for the statuses. You would store the status id in the sales table, and have a foreign key relationship to the status table.
You can then add new statuses quite easily and the rest of the system will just work. You can also rename an existing status, with equal ease.

Categories