473,327 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

formula in subtracting a formula in php with mysql

3
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 2075
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("UPDATE `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
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...
2
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...
2
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...
0
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...
0
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...
0
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...
2
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...
1
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...
1
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.