How do I reset a column in my database every x days?


HOME ยป Databases

I am a PHP beginner.
Every x days (every 7 days for example), I would like all the values in a certain column in my MySQL database to reset back to '1'. How do I do this?
Please note: My web host does NOT have the MySQL event scheduler enabled so that is not an option. Also, my web hosting plan does not allow me to do cronjobs so that is not option either. Any other ideas?
Thanks!

Related to : How do I reset a column in my database every x days?
Add Column Of Days From Date
Databases
I have a column in my DB entitled 'Date'. I'd like to add another column that contains the day of the week (Monday, Tuesday etc.) generated from the date as the DB has 40,000~ entries, but I'm not quite sure how to go about it?
edit: The date column is in MySQL's date format, YYYY-MM-DD.
How do I reset a column in my database every x days?
Databases
I am a PHP beginner.
Every x days (every 7 days for example), I would like all the values in a certain column in my MySQL database to reset back to '1'. How do I do this?
Please note: My web host does NOT have the MySQL event scheduler enabled so that is not an option. Also, my web hosting plan does not allow me to do cronjobs so that is not option either. Any other ideas?
Thanks!
ASP NET MVC 3 - How to reset database in code first, with two tables and Database.Setinitializer?
Databases

My problem lies in the lack of experience in MVC. Basically, I have two tables in DB -Person -Offer

For each I have created a model and a controller and a model, so the structure looks like that:

public class Offer
{
    public int OfferID { get; set; }
    public string OfferTitle { get; set; }
    public string State { get; set; }
    public string Description { get; set; }
}

public class OfferDBContext : DbContext
{
    public DbSet<Offer> Offers { get; set; }
}

This is the Offer model.

public class Person
{
    public int PersonID { get; set; }
    public string Username { get; set; }
    public DateTime Birthday { get; set; }
    public string Education { get; set; }
    public string Email { get; set; }
}

public class PersonDBContext : DbContext
{
    public DbSet<Person> Persons { get; set; }
}

This is the Person model.

Firstly I created the Person model, that added itself to db without any problems. Then I wanted to add Offer table, and I had to use the DropCreateDatabaseIfModelChanges method. I used it for OfferInitializer and PersonInitializer and then there is the Global.asax.cs file

protected void Application_Start()
{
    Database.SetInitializer<OfferDBContext>(new
OfferInitializer());
    Database.SetInitializer<PersonDBContext>(new
PersonInitializer());

    //Database.SetInitializer<PersonDBContext>(new
PersonInitializer());

    AreaRegistration.RegisterAllAreas();

    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);
}

From what I understand, I cant do that simply because I am dropping database 2 times, each time populating only one table at a time. How do I reorganize it all, so that I can populate both or more tables at a time, or the whole database?


Adding days to date column and result in new column?
Databases

I need to add 40 days to a column , which contains date in d-m-y format, and insert result into new column . eg

 $querydate="UPDATE services SET
paymentdue_date=payment_date+30 DAY WHERE my condition ";

and i tried

 $querydate="SELECT
up_id=".$up_id.",DATE_ADD(payment_date,INTERVAL 30 DAY) AS
paymentdue_date FROM     up_services";

Column structure for payment_date and paymentdue_date is varchar10 utf8_unicode_ci any suggestions?


How to insert bind column and unbind column datagridview values in database
Databases

I am inserting datagirdview column values into database. Datagridview has 4 columns 1st column is bind to a table of database. I have written this query to insert all this data to my table but I am getting error "invalid column name 'w'". Somebody help me to figure it out. In the database table I have these columns: SupplierId, Item, Quantity, PricePerItem,Total,BillNo ..The Query I used is :

string q = @" INSERT INTO
PurchaseInvo(SupplierId,Item,Quantity,PricePerItem,Total,BillNo)
VALUES (" + comboBox1.Text + ", " +
dataGridView1.Rows[i].Cells["Item"].Value + ", " +
dataGridView1.Rows[i].Cells["Quantity"].Value + ", " +
dataGridView1.Rows[i].Cells["PricePerItem"].Value + ", " +
dataGridView1.Rows[i].Cells["Total"].Value + ", " + bill + ")";

php fetch column values from database and display in html table column
Databases

I have a table in database name Accounts in which i have many rows and many columns, i want to show a column Account (all values) in my html table. I have tried many method to show a specific column values of database in html using php and I am using MySql.



Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .