Jump to content

PHP Newbie trying to update existing database with web form


bretthexum

Recommended Posts

Hi guys,

 

I've spent quite a bit of time searching the site and have a good start - hoping for some help.  I run a hockey league and have a database that keeps our stats.  Regular stats page is here - http://okchockey.com/stats/stats.php

 

I need a web form that can update existing records in the database.  Maybe I am going thru this the wrong way - please let me know.  I know there's a better way than my current version. 

 

Basically I have a table that has fields of Week, Jersey, Name, Goals, Assists, Points, and Penatly_Min.  Again - excuse the newbie-ness - what I did is have a record for each player for each week.  I already pre-created a record for each player for each week.

 

I just need a web form that will update these existing records.  I already created one that can add new records but I am having a tough time creating one to update existing ones. 

 

I'd like to be able to select the week (week 1-10) then select a player and update his stats for that particular week.  Hopefully this makes sense. 

 

If anyone has some sample code I can look at I'd sure appreciate it.  Really struggling trying to teach myself PHP

Have you thought about copying the form over and trying to use it without the insert sql statement?

 

Using an UPDATE WHERE statement instead of INSERT since you're updating an existing row should get you headed in the right thought process.

 

http://www.w3schools.com/sql/sql_update.asp

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.