<?php
	/*
	** File: createShipping
	** Description: function that creates a row in the shipping table
	** Version: 1.0
	** Created: 06/25/1999
	** Author: Leon Atkinson
	** Email: leon@clearink.com
	** CVS Author: $Author: leon $
	** Last Revised: $Date: 1999/10/11 23:04:02 $
	**
	** Log : $Log: createShipping,v $
	** Log : Revision 1.3  1999/10/11 23:04:02  leon
	** Log : Removed all require()'s, added block to stop double include()'s
	** Log :
	** Log : Require wasn't giving any performance advantage because it was always
	** Log : being called with a variable.  Futhermore, using return inside a
	** Log : require()'d file does not work in PHP4.
	** Log :
	** Log : Revision 1.2  1999/08/18 22:32:04  leon
	** Log : Returning opening PHP tag to XML-friendly tag
	** Log :
	** Log : Revision 1.1  1999/07/28 21:18:35  leon
	** Log : New include modules based on code donation from a live project
	** Log :
	**
	** Copyright (c) 1999 Working Dogs.  All rights reserved.
	*/

	/*
	** Ensure that module isn't included twice
	*/

	$included_flag = 'INCLUDE_' . basename(__FILE__);
	
	if(defined($included_flag))
		//if this module has been included already, then the
		//constant will be defined.  Note the unusual use of
		//the return statement here.  Control will return to
		//the file that included it.
		return;
	
	define($included_flag, TRUE);	


	function createShipping($invoice, $address, $method, $message)
	{
		global $DatabaseLink;		
		
		$Query = "INSERT INTO shipping VALUES (0, ";
		$Query .= "$invoice, ";
		$Query .= "$address, ";
		$Query .= "$method, ";
		$Query .= "'" . addslashes(substr($message, 0, 255)) . "' ";
		$Query .= ") ";

		$DatabaseResult = mysql_query($Query, $DatabaseLink);
		if(!$DatabaseResult)
		{
			print("<!--\n");
			print("$Query \n");
			print(mysql_errno() . ": " . mysql_error()) . "\n"; 
			print("-->\n");

			$returnValue = 0;
		}
		else
		{
			$returnValue = mysql_insert_id($DatabaseLink);
		}
	
		//return the ID of the new shipping row
		return($returnValue);
	}

?>