473,324 Members | 2,193 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,324 software developers and data experts.

Forms updating database

I;m having probs with this script. when i
click update form the values from the text boxs that javascript updates
won't be saved in the data base.
Can any1 help?
Thanks
Kat

<script type="text/javascript">
function ptotal(x,z,r,h,g)
{
var y=document.getElementById(x).value
var d=document.getElementById(z).value
var f=document.getElementById(r).value
document.getElementById(h).value=parseFloat(y*3)+p arseFloat(d)
document.getElementById(g).value=parseFloat(y)+par seFloat(d)+parseFloat(f)
}

function gdtotal(x,z,h)
{
var s=document.getElementById(x).value
var k=document.getElementById(z).value

document.getElementById(h).value=parseFloat(s)-parseFloat(k)
}

</script>
*some code"

<form id="form1" action="admin.php?page=leagueedit" method="post"
enctype="multipart/form-data">

<input type="hidden" name="t_day" value="<?php echo date("d");?>">
<input type="hidden" name="t_month" value="<?php echo date("m");?>">
<input type="hidden" name="t_year" value="<?php echo date("Y");?>">

<?php
while ($row = mysql_fetch_array($numresults)) {
?>
<tr>
<td width="150"><? echo $row{'TEAM'};?></td>

<td><input type="text" size="3" id="<? echo "t_played" . $row{'id'};?>"
name="<? echo "t_played" . $row{'id'};?>" value="<? echo $row{'PLAYED'};?>"
disabled></td>
<td><input type="text" size="3" id="<? echo "t_won" . $row{'id'};?>"
name="<? echo "t_won" . $row{'id'};?>" value="<? echo $row{'WIN'};?>"
onchange="ptotal(this.id,'<? echo "t_draw" . $row{'id'};?>','<? echo
"t_lost" . $row{'id'};?>','<? echo "t_pts" . $row{'id'};?>','<? echo
"t_played" . $row{'id'};?>')"></td>
<td><input type="text" size="3" id="<? echo "t_draw" . $row{'id'};?>"
name="<? echo "t_draw" . $row{'id'};?>" value="<? echo $row{'DRAW'};?>"
onchange="ptotal('<? echo "t_won" . $row{'id'};?>',this.id,'<? echo "t_lost"
.. $row{'id'};?>','<? echo "t_pts" . $row{'id'};?>','<? echo "t_played" .
$row{'id'};?>')"></td>
<td><input type="text" size="3" id="<? echo "t_lost" . $row{'id'};?>"
name="<? echo "t_lost" . $row{'id'};?>" value="<? echo $row{'LOST'};?>"
onchange="ptotal('<? echo "t_won" . $row{'id'};?>','<? echo "t_draw" .
$row{'id'};?>',this.id,'<? echo "t_pts" . $row{'id'};?>','<? echo "t_played"
.. $row{'id'};?>')"></td>
<td><input type="text" size="3" id="<? echo "t_for" . $row{'id'};?>"
name="<? echo "t_for" . $row{'id'};?>" value="<? echo $row{'GFOR'};?>"
onchange="gdtotal(this.id,'<? echo "t_against" . $row{'id'};?>','<? echo
"t_gd" . $row{'id'};?>')"></td>
<td><input type="text" size="3" id="<? echo "t_against" . $row{'id'};?>"
name="<? echo "t_against" . $row{'id'};?>" value="<? echo
$row{'AGAINST'};?>" onchange="gdtotal('<? echo "t_for" .
$row{'id'};?>',this.id,'<? echo "t_gd" . $row{'id'};?>')"></td>

<td><input type="text" size="3" id="<? echo "t_gd" . $row{'id'};?>"
type="text" name="<? echo "t_gd" . $row{'id'};?>" value="<? echo
$row{'GD'};?>" disabled></td>
<td><input type="text" size="3" id="<? echo "t_pts" . $row{'id'};?>"
type="text" name="<? echo "t_pts" . $row{'id'};?>" disabled value="<? echo
$row{'PTS'};?>"></td>
</tr>
<? }?>
</table>

<input type="submit" name="submit" value="Update Table">
</form>

Oct 22 '06 #1
3 3563
Kathryn Gill wrote:
I;m having probs with this script. when i
click update form the values from the text boxs that javascript updates
won't be saved in the data base.
Can any1 help?
Make your software to print out the query you are trying to use, then
make sure that your query is having the correct values. If it is, try
using that query from the mysql command line application and provide
here the query and possible error message and we might help.

If the query doesn't look correct, then the problem is not related to
MySQL and we can't help. You would get better help from javascript of
php related newsgroups in that case.
Oct 22 '06 #2
"Kathryn Gill" <fi*************@hotmail.comwrote in
news:Ns*****************@fe1.news.blueyonder.co.uk :

Hi Kathryn

Where is the PHP code which actually does the insert/update ? As Aggro
suggests echo the actual SQL query and post that so we can see if there is
anything wrong in the query.

In PHP try using mysql_query($qry) or die(mysql_error());

That should print the error out to the screen (assuming you ISP doesn't
have PHP configured to supress such errors/warnings)

Otherwise just echo the result -

if (!mysql_query($sql))
echo "Error: ".mysql_error();

I always echo the query and execute it directly against mysql (using
something like PHPmyAdmin or mySQLFront. Then you can fix any syntax in
the query and get the actual query right and then paste it back in to the
PHP code.

Jody

I;m having probs with this script. when i
click update form the values from the text boxs that javascript
updates won't be saved in the data base.
Can any1 help?
Thanks
Kat
Oct 22 '06 #3
Hi,
I don't seem to get an error, so i'll go to the php forum.
Thanks
Kat

"Jody" <jo**@jcsdynamix.com.auwrote in message
news:Xn*********************************@140.99.99 .130...
"Kathryn Gill" <fi*************@hotmail.comwrote in
news:Ns*****************@fe1.news.blueyonder.co.uk :

Hi Kathryn

Where is the PHP code which actually does the insert/update ? As Aggro
suggests echo the actual SQL query and post that so we can see if there is
anything wrong in the query.

In PHP try using mysql_query($qry) or die(mysql_error());

That should print the error out to the screen (assuming you ISP doesn't
have PHP configured to supress such errors/warnings)

Otherwise just echo the result -

if (!mysql_query($sql))
echo "Error: ".mysql_error();

I always echo the query and execute it directly against mysql (using
something like PHPmyAdmin or mySQLFront. Then you can fix any syntax in
the query and get the actual query right and then paste it back in to the
PHP code.

Jody

>I;m having probs with this script. when i
click update form the values from the text boxs that javascript
updates won't be saved in the data base.
Can any1 help?
Thanks
Kat

Oct 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Test Person | last post by:
Hi I'm having trouble with updating my database which is SqlServer. I'm using the update command and only the dataset is being changed not the actual row in the database. Best Regards
1
by: aaj | last post by:
Hi all I have a main form looking at a main table, with a subform looking at a detail table, linked by a key. There are many entries in the sub form bound to the single entry on the main form....
2
by: Commander Ace | last post by:
Hi, I'm having some problems with updating an SQL Database with modified fields from a datatable. I got the code from a Wrox book, 'Professional VB.NET 2003', the same code can be found here:...
2
by: Greg | last post by:
I'm using the Framework 1.1, so I don't have access to the new DataGridView object. What I'm wondering is, is there a really simple way to bind a plain datagrid to a database in such a way that...
5
by: fong.yang | last post by:
I have a database that is being shared on the network. The database it split up into front end and back end. The back end is residing on the shared network drive while the front end is on each...
0
by: OldStd | last post by:
Updating data using 2 data sets I am having some problems in updating the database using two datasets as suggested by someone. 1. Data is displayed in a data grid from a dataset generated using...
0
by: Shogun | last post by:
Hey guys, i'm trying to do a confirmation msgbox asking the user if he's sure about updating his database. The problem is... wathever the answer (Yes/No), the database is updated anyway! My code is...
1
by: joel | last post by:
hi guys... i am a student, i am studying and i am a newbie in VB.net and i am using SQL Server 2000. I have this datatable which i insert rows (may take up to 2 or more rows because i would...
0
by: aRuaL | last post by:
Hi all, i have a problem with updating the junction table. I am doing this access project after learning for 2 weeks so pardon me if what the question im asking is really simple. Firstly i have 3...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.