The Barbados Yachting Association
Database Add: Results
/* input is $race_id, $race_name $race_date $race_type*/
$race_id = strtoupper($race_id);
$race_name = strtoupper($race_name);
$race_type = strtoupper($race_type);
$database="boats"; $table="races";
$calling_url = "http://localhost/~rhill/yachts/addrace.phtml";
$start_url = "http://localhost/~rhill/yachts/index.phtml";
$next_url = "http://localhost/~rhill/yachts/adddetails.phtml";
if ($calling_url);
>
Return to database input form
Return to database home page
endif;
echo "
\n";
SetType($query, "string"); /* force string for overloaded ops */
$query = "id=" + "'"+ $race_id + "'";
/* Check for existence */
$result = mysql($database,"select * from $table where $query");
$num = mysql_numrows($result);
if ( $num != 0);
echo "Already exists!
\n";
$i=0;
while ($i < $num);
$RID = mysql_result($result,$i,"Id");
$RNAME = mysql_result($result,$i,"Description");
$RDATE = mysql_result($result,$i,"Rdate");
$RTYPE = mysql_result($result,$i,"Type");
echo "$RID is $RNAME dated $RDATE of type $RTYPE
\n";
$i++
endwhile;
mysql_FreeResult($result);
>
Add Race Results
else;
SetType($query, "string"); /* force string for overloaded ops */
$query ="insert into $table values ";
$query=$query + "('$race_id', '$race_name','$race_date','$race_type')";
$result = mysql($database,$query);
if ( $result == 0 );
echo "Successfully added $race_name with identifier $race_id
";
mysql_FreeResult($result);
>
Add Race Results
else;
echo "Add failed
";
endif;
endif;
>