0

Okay, I used a tutorial from nettuts to create a log in form, so that's done.
However, I would now like to create a form to update a scoreboard powered by a database (unless there is another method that may be more efficient.

I have four teams and thus four scoreboards that I will write over each week.

i.e., one board will also have the score of the latest game for the same team. Another board for another team, etc.

I have a table set up with six rows. ID, Away, Ascore, Home, Hscore, status
INT is the primary key and is set to auto increment.

Away is a varchar 40 chars
Ascore is a three digit int
Home is a 40 varchar
Hscore is a three digit int
status is a 40 varchar...will either have "Final" or the date of the upcoming game.

The only thing is, I have no idea how to go about this.

Maybe the best/easier would be to have four forms on the page...have one set up to call game id 1, another for id 2, etc. Then have the field information there and update.

The reason I am doing this is because I want to be able to update the form from my blackberry...it's for a new football website so I would need to update it from the sidelines.

We are not doing live scoring with this, just final scores. But we have score reporters are different games so I need to be able to update as those reports come in as I stand field side at another game.

2
Contributors
3
Replies
6
Views
6 Years
Discussion Span
Last Post by rv1990
0

For those going "Didn't you do a search?" I did...and while I found some things like this...I wasn't able to get anything to work...plus they were mostly small errors in existing code.

If I could get a mobile-type version of PHP MyAdmin I would be set, really...

Okay, I used a tutorial from nettuts to create a log in form, so that's done.
However, I would now like to create a form to update a scoreboard powered by a database (unless there is another method that may be more efficient.

I have four teams and thus four scoreboards that I will write over each week.

i.e., one board will also have the score of the latest game for the same team. Another board for another team, etc.

I have a table set up with six rows. ID, Away, Ascore, Home, Hscore, status
INT is the primary key and is set to auto increment.

Away is a varchar 40 chars
Ascore is a three digit int
Home is a 40 varchar
Hscore is a three digit int
status is a 40 varchar...will either have "Final" or the date of the upcoming game.

The only thing is, I have no idea how to go about this.

Maybe the best/easier would be to have four forms on the page...have one set up to call game id 1, another for id 2, etc. Then have the field information there and update.

The reason I am doing this is because I want to be able to update the form from my blackberry...it's for a new football website so I would need to update it from the sidelines.

We are not doing live scoring with this, just final scores. But we have score reporters are different games so I need to be able to update as those reports come in as I stand field side at another game.

0

I'm still searching the internet...found this tutorial: http://www.php.happycodings.com/Databases/code14.html

No clue if it does what I want...but I keep getting this error:

Parse error: syntax error, unexpected $end in /home/******/public_html/***/*****/index.php on line 176

FYI: Line 176 is that </html>

ANY help is appreciated!

<?php

require_once 'classes/Membership.php';
$membership = New Membership();

$membership->confirm_Member();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/default.css" />

<!--[if lt IE 7]>
<script type="text/javascript" src="js/DD_belatedPNG_0.0.7a-min.js"></script>
<![endif]-->


<title>FNE Update Scores</title>



</head>

<body>

<div id="container">
<p align="right"><a href="login.php?status=loggedout">Log Out</a></p>
<hr>
<?php 
/* control code for application */ 

//submit button was pressed so call the process form function 
if (isset($_POST['submit'])) 
{ 
  process_form(); 
  die(); 
}//end if 


//call the get_data function 
if (isset($_GET['id'])) 
{ 
  get_data(); 
}//endif 


//nothing chosen so list the kids 
if ((empty($_POST))&&(empty($_GET))) 
{ 
  list_users(); 
  die(); 
}//end if 


//request to add a new contact so call the show_form function 
if ((isset($_GET['action']))&&($_GET['action']=='add')) 
{ 
  show_form(); 
}//endif 



/* get the data for an individual contact */ 

function get_data() 
{ 
    //validate the id has been passed at that it is a number 
    if ((empty($_GET['id']))||(is_nan($_GET['id']))) 
    { 
        //there was a problem so list the users again 
      list_users(); 
      //kill the script 
      die(); 
    }else{ 
      //all is ok and assign the data to a local variable 
      $id = $_GET['id']; 
    }//end if 
    $sql = "select * from scoreboard where id = $id"; 
    $result = conn($sql); 
    if (mysql_num_rows($result)==1){ 
      //call the form and pass it the handle to the resultset 
      show_form($result); 
    }else{ 
      $msg = "No data found for selected contact"; 
      confirm($msg); 
      //call the list users function 
      list_users(); 
    }//end if   
}//end function 


/* show the input / edit form*/ 
function show_form($handle='',$data='') 
{ 
  //$handle is the link to the resultset, the ='' means that the handle can be empty / null so if nothing is picked it won't blow up 
   
  //set default values 
  $id = ''; 
  $Away  = ''; 
  $Ascore      = ''; 
  $Home     = ''; 
  $Hscore         = ''; 
  $status         = ''; 
  $value      = 'Add';  //submit button value 
  $action     = 'add';  //default form action is to add a new kid to db 

  //set the action based on what the user wants to do 
  if ($handle) 
  { 
    //set form values for button and action 
    $action = "edit"; 
    $value  = "Update"; 
     
    //get the values from the db resultset 
    $row = mysql_fetch_array($handle); 
    $id = $row['id']; 
$Away = $row['Away']; 
$Ascore = $row['Ascore'];
$Home = $row['Home']; 
$Hscore = $row['Hscore'];
$status = $row['status'];    
   
  }//end if 
   

?> 
     
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php echo $action?>"> 
    <table width="400" align="center" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
          <td colspan="2" align="center" style="font-size:18px; font-weight:bold;">Manage Contact's Data Form</td> 
          <input type="hidden" value="<?php echo $id?>" name="id"> 
      </tr> 
      <tr> 
        <td> </td> 
        <td> </td> 
      </tr> 
      <tr> 
        <td align="right">Away: </td> 
        <td><input name="Away" type="text" value="<?php echo $Away?>"> </td> 
      </tr> 
      <tr> 
       <td align="right">Away Score: </td> 
       <td><input name="Ascore" type="text" value="<?php echo $Ascore?>"> </td> 
      </tr> 
      <tr> 
        <td align="right">Home: </td> 
        <td><input name="Home" type="text" value="<?php echo $Home?>"> </td> 
      </tr> 
      <tr> 
        <td align="right">Home Score: </td> 
        <td><input name="Hscore" type="text" value="<?php echo $Hscore?>"> </td> 
      </tr> 
      <tr> 
        <td align="right">Status: </td> 
        <td><input name="status" type="text" value="<?php echo $status?>"> </td> 
      </tr> 
     
      <tr> 
        <td> </td> 
        <td> </td> 
      </tr> 
      <tr> 
        <td colspan="2" align="center"><input name="submit" type="submit" value="<?php echo $value?>"> <input name="reset" type="reset" value="Clear Form"></td> 
      </tr> 
    </table> 
     
    </form>
    
    </div>
    </body>
    </html>
1

check line no. 135
You have to use escape character to display single quote on the screen
Repleace line 135 with this

<td colspan="2" align="center" style="font-size:18px; font-weight:bold;">Manage Contact\'s Data Form</td>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.