<?
// scoreinput.php - input a match score when match selected from list
?>
<html>
<head>
<basefont face="Verdana">
</head>
<body>
<!-- standard page header begins -->
<p> <p>
<table width="100%" cellspacing="0" cellpadding="5" >
<tr>
<td></td>
</tr>
<tr>
<td bgcolor="Red">< font size="-1" color="White">< b>Cornwall County
Short Mat Bowling Association : Administration :
League Results : Edit</b></font></td>
</tr>
</table>
<!-- standard page header ends -->
<p>
<?
// includes
include("../conf.php");
include("../functions.php") ;
// form not yet submitted
// display initial form with values pre-filled
if (!$submit)
{
// open database connection
$connection = mysql_connect($ host, $user, $pass) or die ("Unable to
connect!");
// select database
mysql_select_db ($db) or die ("Unable to select database!");
// generate and execute query
$query = "SELECT * FROM matches WHERE id = '$id'";
$result = mysql_query($qu ery) or die ("Error in query: $query. " .
mysql_error());
// if a result is returned
if (mysql_num_rows ($result) > 0)
{
// turn it into an object
$row = mysql_fetch_obj ect($result);
// print form with values pre-filled
?>
<table cellspacing="5" cellpadding="5" >
<form action="<? echo $PHP_SELF; ?>" method="POST">
<input type="hidden" name="id" value="<? echo $row->id; ?>">
<tr>
<td valign="top"><b >Date<b></td>
<td><? echo $row->date; ?></td>
</tr>
<tr>
<td valign="top"><b ><? echo $row->home_team; ?></b></td>
<td><input size="5" name="home_shot s" value="<? echo
$row->home_shots; ?>"></td>
</tr>
<tr>
<td valign="top"><b ><? echo $row->away_team; ?></b></td>
<td><input size="5" name="away_shot s" value="<? echo
$row->away_shots; ?>"></td>
</tr>
<tr>
<td valign="top"><b >Match Completed</b></td>
<td><input type="checkbox" name="completed " value="Y"></td>
</tr>
<tr>
<td colspan=2><inpu t type="Submit" name="submit" value="Update"> </td>
</tr>
</form>
</table>
<?
}
// no result returned
// print graceful error message
else
{
echo "<font size=-1>That match could not be located in our
database.</font>";
}
}
// form submitted
// start processing it
else
{
// set up error list array
$errorList = array();
$count = 0;
// check for errors
// if none found...
if (sizeof($errorL ist) == 0)
{
// open database connection
$connection = mysql_connect($ host, $user, $pass) or die ("Unable to
connect!");
// select database
mysql_select_db ($db) or die ("Unable to select database!");
// generate and execute query
if ($home_shots > $away_shots) {
$querymatches = "UPDATE matches
SET home_shots = '$home_shots',
away_shots = '$away_shots',
completed = '$completed' WHERE id = '$id'";
$queryhome = "UPDATE teams
SET played = played + 1,
won = won + 1,
sf = sf + '$home_shots',
sa = sa + '$away_shots',
points = points + 2 WHERE team = '$home_team'";
$queryaway = "UPDATE teams
SET played = played + 1,
lost = lost + 1,
sa = sa + '$home_shots',
sf = sf + '$away_shots' WHERE team = '$away_team'";
} elseif ($home_shots < $away_shots) {
$querymatches = "UPDATE matches
SET home_shots = '$home_shots',
away_shots = '$away_shots',
completed = '$completed' WHERE id = '$id'";
$queryaway = "UPDATE teams
SET played = played + 1,
won = won + 1,
sa = sa + '$home_shots',
sf = sf + '$away_shots',
points = points + 2 WHERE team = '$away_team'";
$queryhome = "UPDATE teams
SET played = played + 1,
lost = lost + 1,
sf = sf + '$home_shots',
sa = sa + '$away_shots' WHERE team = '$home_team'";
} else {
$querymatches = "UPDATE matches
SET home_shots = '$home_shots',
away_shots = '$away_shots',
completed = '$completed' WHERE id = '$id'";
$queryhome = "UPDATE teams
SET played = played + 1,
drawn = drawn + 1,
sf = sf + '$home_shots',
sa = sa + '$away_shots',
points = points + 1 WHERE team = '$home_team'";
$queryaway = "UPDATE teams
SET played = played + 1,
drawn = drawn + 1,
sa = sa + '$home_shots',
sf = sf + '$away_shots',
points = points + 1 WHERE team = '$away_team'";
}
$result1 = mysql_query($qu erymatches) or die ("Error in query:
$query. " . mysql_error());
$result2 = mysql_query($qu eryhome) or die ("Error in query: $query.
" . mysql_error());
$result3 = mysql_query($qu eryaway) or die ("Error in query: $query.
" . mysql_error());
// print result
echo "<font size=-1>Update successful. <a href=list.php>G o back to
the main menu</a>.</font>";
// close database connection
mysql_close($co nnection);
}
else
{
// errors occurred
// print as list
echo "<font size=-1>The following errors were encountered: <br>";
echo "<ul>";
for ($x=0; $x<sizeof($erro rList); $x++)
{
echo "<li>$error List[$x]";
}
echo "</ul></font>";
}
}
?>
<!-- standard page footer begins -->
<p>
<table width="100%" cellspacing="0" cellpadding="5" >
<tr>
<td align="center"> </td>
</tr>
</table>
<!-- standard page footer ends -->
</body>
</html> 3 1954
Nick Truscott wrote: // scoreinput.php - input a match score when match selected from list
Echo your queries to screen and copy-paste them to mysql client. Then
copy-paste the queries, error messages from MySQL and table structure
for tables that are used in queries, here and it will make it a lot
easier for us to help you. Also tell what version of MySQL you are
using. We might see the errors directly from the queries, so it might be
enough if you copy-paste those here. But it is easier if you show it all
at once.
Here is the table structure, I do not get an error message, just the
2nd and 3rd queries do not run.
CREATE TABLE `matches` (
`id` int(11) NOT NULL auto_increment,
`date` date NOT NULL default '0000-00-00',
`time` time NOT NULL default '00:00:00',
`home_team` text NOT NULL,
`away_team` text NOT NULL,
`home_shots` int(11) NOT NULL default '0',
`away_shots` int(11) NOT NULL default '0',
`league` text NOT NULL,
`completed` text,
PRIMARY KEY (`id`)
) TYPE=MyISAM;
CREATE TABLE `teams` (
`id` int(11) NOT NULL auto_increment,
`league` text NOT NULL,
`team` text NOT NULL,
`played` int(11) NOT NULL default '0',
`won` int(11) NOT NULL default '0',
`drawn` int(11) NOT NULL default '0',
`lost` int(11) NOT NULL default '0',
`sf` int(11) NOT NULL default '0',
`sa` int(11) NOT NULL default '0',
`bonus` int(11) NOT NULL default '0',
`points` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
Aggro <sp**********@y ahoo.com> wrote in message news:<SY******* ******@read3.in et.fi>... Nick Truscott wrote:
// scoreinput.php - input a match score when match selected from list
Echo your queries to screen and copy-paste them to mysql client. Then copy-paste the queries, error messages from MySQL and table structure for tables that are used in queries, here and it will make it a lot easier for us to help you. Also tell what version of MySQL you are using. We might see the errors directly from the queries, so it might be enough if you copy-paste those here. But it is easier if you show it all at once.
Nick Truscott wrote: Here is the table structure, I do not get an error message, just the 2nd and 3rd queries do not run.
What do you mean they don't run? Don't they do the result you are
expecting or are they not called and executed at all?
If the query returns 0 rows, could you echo it on the screen and
copy-paste here? You have only shown us the php code which is used to
generate the queries. It is very very very common that programmer makes
a mistake while generating the query, for example some value is
incorrect. That's why it is important that you echo the real query you
are trying to use to see what the query really looks like. It is also a
lot easier to see from there what the problem might be.
If they are not called at all, it is a problem with your php code and
questions about php should be asked in a different group, like
comp.lang.php for example. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ChaosKCW |
last post by:
Hi
Using Python 2.4 I am trying to procduce a generator which will return
the results of dbi SQL statement using fetchmany for performance.
So instead of fetching one record for each call, I will fetch batches
of X (eg 100) and yeild each record in turn.
For reasons of pure asthetics and my own learning I wanted it to look
like this:
|
by: Brian Piotrowski |
last post by:
Hi All,
I'm trying to run a simple query from an ASP page. I want the query to
select each individual field in a table and compare it to another table. If
the value doesn't exist, I want it reported. Here's the code I have to do
this check:
'Check to see if there are any assemblies not in the database!
strSQL = "select substring(mtoc,2,6) as deadmodel from bos_data where
substring(bos_data.mtoc,2,6) not in (select code from...
|
by: ????? |
last post by:
I have an access query which gets data from a number of different
tables. Although the tables have primary key fields, the order in which
the records are returned means that none of these are in ascending
order in the query result set. I need to include in the query a field
that numbers the records in the order that they are returned. The
numbers must be unique and ascending but do not necessarily have to be
consecutive.
For Example:
|
by: hazz |
last post by:
before I start filling up the first page of perhaps many pages of code with
if/then or switch:case buckets, I wanted to step back and see if there is a
better way...
I will have a table with up to 300 rules in it. Maybe more... In each Score
table there is a column which will refer to a domain specific table and
another table column that contains the property of that domain specific
object. IceCream is a domain and scoops is a property I...
|
by: Brian Piotrowski |
last post by:
Hi All,
I'm trying to run a simple query from an ASP page. I want the query to
select each individual field in a table and compare it to another table. If
the value doesn't exist, I want it reported. Here's the code I have to do
this check:
'Check to see if there are any assemblies not in the database!
strSQL = "select substring(mtoc,2,6) as deadmodel from bos_data where
substring(bos_data.mtoc,2,6) not in (select code from...
| |
by: hazz |
last post by:
This is what Nick Malik suggested from the c# newsgroup. Now that the hectic
workweek is over, I can begin to appreciate what he said and break it down
into constituent elements to solve. If anyone has any implementation
examples related to what Nick describes below, they would be
ppreciated. -hazz
One thing you could do is to place your rules in a database. Each rule
consists of an XPath expression for the operand, and operator, the...
|
by: Hefestus |
last post by:
Hey everyone,
I have never really used access before and i now find myself knee deep
in it trying to solve a problem. Hopefully someone has an idea.
Anything would be great. Here's the problem:
I am working on a network invrntory solution for my department.
We're using a great little utility to audit each machine on the
network, storing all kinds of information about hardware and software
in an access database on one of the public...
|
by: pitachu |
last post by:
hi all,
I need some high level and efficient ideas on how caching should be
designed in the scenario below. The application and the cache will most
likely be in VB.NET.
I have a central interface (does not necessarily have to be a website)
that customers will access. This interface would connect to a load
balancer, which would then randomly choose one of N servers. Those
servers would run the same exact copy of an application (not yet
|
by: Charles |
last post by:
I have this .NET web project that I will need to create web forms that will
allow employees to request personnel actions (for example, request for
vacation time). Depending on what department the employee is in determines
who approvals the vacation time and what paths it follows to get approved.
It could go up to three levels before the vacation time is finally approved.
I guess my problem is that I do not really know where to start with...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |