473,699 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

formula in subtracting a formula in php with mysql

3 New Member
hi all, i have problem in creating a formula of my code. this is all about updating a mysql database in including it in php. I dont know how to generate it. can you please give me some code in a working php with mysql.

This code is to update after clicking the word update and to subtract each time to click by once..

Please help me..

Sample code:
"SELECT * FROM tablename WHERE time = 20";
$time1 = time -1 ;
"UPDATE tablename SET time = $time1";

Is this correct?

What else would i add to make my code complete in updating my mysql database?
Feb 22 '08 #1
1 2093
Nadeem0319
5 New Member
hi all, i have problem in creating a formula of my code. this is all about updating a mysql database in including it in php. I dont know how to generate it. can you please give me some code in a working php with mysql.

This code is to update after clicking the word update and to subtract each time to click by once..

Please help me..

Sample code:
"SELECT * FROM tablename WHERE time = 20";
$time1 = time -1 ;
"UPDATE tablename SET time = $time1";

Is this correct?

What else would i add to make my code complete in updating my mysql database?
that would be something like this if i understood what you mean:

[PHP]
<?php
if($_GET['update'] == 1) {
$sql = mysql_query("UP DATE `tablename` SET time='".$time1. "'");
if(!$sql){die ("Error: ".mysql_error() ."");}
echo "Update successful!";
}

echo "<a href=\"?update= 1\">Update!</a>";
?>
[/PHP]
Feb 22 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
5767
by: Phil Powell | last post by:
The table already has a fulltext index and from there I can use the MySQL fulltext search query to get results as well as the relevancy score. The problem I have is that MySQL has a default setting whereby the minimum amount of characters is 4 for a search. Being that we're government and full of TLA (three-letter acronyms), that is not practical, and furthermore, the app I'm building must be fully portable, so having MySQL tweaked...
2
6898
by: Eddie | last post by:
When I subtract dates, I can't figure out what I get out. I first I thought it was in seconds, but that's not it. Then I figured maybe HHMMSS, but that does not seem to be it too. How can I subtract two dates and get the resualt in HH:MM:SS format? Thanks for any help. -Eddie
2
3152
by: celsius | last post by:
Hi folks, Al Bowers wrote this program on comp.lang.c Date: 2001-07-09 13:41:58 PST #include <stdio.h> int isleap (unsigned yr); static unsigned months_to_days (unsigned month); static long years_to_days (unsigned yr); long ymd_to_scalar (unsigned yr, unsigned mo, unsigned day);
0
1811
by: RJN | last post by:
Hi I have a main report and a sub report. I have a formula field on the main report and one on the sub report. I want the formula in the subreport to be evaluated after the formula in the main report. The sub report is called in the report header of the main report and the formula fields are in the details section of the reports. Main report looks something like this.
0
1617
by: RJN | last post by:
Hi Sorry for posting this message again. I have a main report and a sub report. I have a formula field on the main report and one on the sub report. I want the formula in the subreport to be evaluated after the formula in the main report. The sub report is called in the report header of the main report and the formula fields are in the details section of the reports. Main report looks something like this.
0
2199
by: rjn | last post by:
Hi I have a main report in which I have inserted a sub report. I have a formula field on the main report and one on the sub report. I want the formula in the subreport to be evaluated after the formula in the main report. The sub report is called in the report header of the main report and the formula fields are in the details section of the reports. Main report looks something like this. Report Header
2
3733
by: Kurt Jakobsen | last post by:
Hello, I have a problem getting 'Order By' to work properly on calculated results producing floating point value in MySql. Ordering by single columns seems to work ok (like 'ORDER BY t2.Col4' in the query below). This is a stripped version of my query: SELECT t2.Col4, ROUND(SUM(t1.Col1 * t2.Col3) / SUM(t1.Col2), 2) FROM Table1 AS t1, Table2 AS t2 Where t1.Col4 = t2.Col1 ....
1
5063
by: barnzee | last post by:
Hi all, newbie here, but having a go I am trying to build a stock watchlist in excel 2007 with a dynamic link to a DDE server (paid for from a broker).There is no add-in or plug-in, I just CTL ALT & drag each code from a watchlist in the program I am using and place it in a cell in excel, however can only choose one data field at a time. There are 14 data fields and over 150 codes in my list which makes 2100 cells. (My guess is about 3 days...
1
1380
by: afaircloth | last post by:
I am attempting to build an inventory program for personal use and training. I would like to add a formula to a query that is pulling my table data with which I will populate a form. I need to automatically calculate number of items needed by subtracting number of items desired from number of items onhand. The user will enter the desired and onhand amounts. I have created a table with these three fields included, and have created a query...
0
9172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8908
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.