dbTalk Databases Forums  

Forms updating database

mailing.database.mysql mailing.database.mysql


Discuss Forms updating database in the mailing.database.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kathryn Gill
 
Posts: n/a

Default Forms updating database - 10-22-2006 , 10:52 AM






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>




Reply With Quote
  #2  
Old   
Aggro
 
Posts: n/a

Default Re: Forms updating database - 10-22-2006 , 05:20 PM






Kathryn Gill wrote:
Quote:
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.


Reply With Quote
  #3  
Old   
Jody
 
Posts: n/a

Default Re: Forms updating database - 10-22-2006 , 05:38 PM



"Kathryn Gill" <fire_juggler_03 (AT) hotmail (DOT) com> wrote in
news:NsM_g.6351$3x1.2349 (AT) fe1 (DOT) 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


Quote:
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


Reply With Quote
  #4  
Old   
Kathryn Gill
 
Posts: n/a

Default Re: Forms updating database - 10-23-2006 , 07:55 AM



Hi,
I don't seem to get an error, so i'll go to the php forum.
Thanks
Kat

"Jody" <jody (AT) jcsdynamix (DOT) com.au> wrote

Quote:
"Kathryn Gill" <fire_juggler_03 (AT) hotmail (DOT) com> wrote in
news:NsM_g.6351$3x1.2349 (AT) fe1 (DOT) 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




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.