PHP MYSQL fejl:
JEg har en side der ser såden ud:<?php require_once('../inc/authCheck.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO sortingreportline (srId, productNumber, productName, format, amount, location, productType) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['srId'], "int"),
GetSQLValueString($_POST['productNumber'], "text"),
GetSQLValueString($_POST['productName'], "text"),
GetSQLValueString($_POST['format'], "int"),
GetSQLValueString($_POST['amount'], "int"),
GetSQLValueString($_POST['location'], "text"),
GetSQLValueString($_POST['productType'], "text"));
mysql_select_db($database_mysqlCon, $mysqlCon);
$Result1 = mysql_query($insertSQL, $mysqlCon) or die(mysql_error());
}
?>
<?php require_once('../Connections/mysqlCon.php'); ?>
<?php
mysql_select_db($database_mysqlCon, $mysqlCon);
$query_format = "SELECT formatId, text FROM format";
$format = mysql_query($query_format, $mysqlCon) or die(mysql_error());
$row_format = mysql_fetch_assoc($format);
$totalRows_format = mysql_num_rows($format);
?>
<html><!-- InstanceBegin template="/Templates/newReport.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<!-- InstanceEndEditable --><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../css/site.css" rel="stylesheet" type="text/css">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr align="left" valign="top">
<td width="700"></td>
<td width="700">
<table width="100%" height="450" >
<tr align="left" valign="top">
<td height="70" class="mainTable"><img src="../images/logo.gif" width="300" height="50"></td>
</tr>
<tr>
<td class="tableHeight">
<table width="100%" height="450">
<tr>
<td width="100" valign="top" class="mainTable"><p>
<?php
$thisUserName= $_SESSION['MM_userFullName'];
echo $thisUserName;
?><br><?php echo date('d, m, Y'); ?></p>
<p><a href="reportNew.php">Ny rapport</a></p>
<p><a href="reportList.php">Find rapport</a></p>
<p>Statestik</p>
<p>Log</p>
<p>Bruger</p>
<p> </p>
<p> <a href="../logout.php">- log ud - </a></p></td>
<td valign="top"><!-- InstanceBeginEditable name="main" -->
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline" class="srTable">
<td nowrap align="right">Varenummer:</td>
<td><input type="text" name="productNumber" value="" size="32"></td>
</tr>
<tr valign="baseline" class="srTable">
<td nowrap align="right">Varenavn:</td>
<td><input type="text" name="productName" value="" size="32"></td>
</tr>
<tr valign="baseline" class="srTable">
<td nowrap align="right">Format:</td>
<td><select name="format">
<?php
do {
?>
<option value="<?php echo $row_format['formatId']?>" ><?php echo $row_format['text']?></option>
<?php
} while ($row_format = mysql_fetch_assoc($format));
?>
</select>
</td>
<tr>
<tr valign="baseline" class="srTable">
<td nowrap align="right">Antal:</td>
<td><input type="text" name="amount" value="" size="32"></td>
</tr>
<tr valign="baseline" class="srTable">
<td nowrap align="right">Lokation:</td>
<td><input type="text" name="location" value="" size="32"></td>
</tr>
<tr valign="baseline" class="srTable">
<td nowrap align="right">ProductType:</td>
<td><select name="productType">
<option value="Standard" <?php if (!(strcmp("Standard", ""))) {echo "SELECTED";} ?>>Standard</option>
<option value="Variant" <?php if (!(strcmp("Variant", ""))) {echo "SELECTED";} ?>>Variant</option>
<option value="Svind" <?php if (!(strcmp("Svind", ""))) {echo "SELECTED";} ?>>Svind</option>
<option value="" >item1</option>
</select>
</td>
</tr>
<tr valign="baseline" class="srTable">
<td nowrap align="right"> </td>
<td><input type="submit" value="Tilføje"></td>
</tr>
</table>
<input type="hidden" name="srId" value="<?php echo $_GET['srId']; ?>">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p> </p>
<!-- InstanceEndEditable --></td>
<td width="100" valign="top" class="mainTable">
<p> </p>
<!-- InstanceBeginRepeat name="RepeatRegion1" --><!-- InstanceBeginRepeatEntry --><p><a href="reportAddLine.php">Tilføje produktion</a></p>
<p>Print Raport</p>
<p>Slet Raport </p>
<!-- InstanceEndRepeatEntry --><!-- InstanceEndRepeat --></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="700"></td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($format);
?>
**********************************************************
og får følgende fejl:
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/httpd/vhosts/ptsr.dk/httpdocs/report/reportAddLine.php on line 43
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/httpd/vhosts/ptsr.dk/httpdocs/report/reportAddLine.php on line 44