Jump to content

Select in database


mus

Recommended Posts

can you tell me why 2 rows of the same name appears in the database instead of one

 

1:form


<!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>
<script type="text/javascript" src="util-functions.js"></script>
<script type="text/javascript" src="clear-default-text.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>update</title>
</head>
<body>
<table width="1280px" height="100%" cellpadding="0" cellspacing="0" border="0">
    	<tr>
        	<td width="1280px" height="40px" valign="top">
            	<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
                	<tr>
                        <form action="updatedb.php" method="post">
                            <td width="82" height="100%" valign="top"><input name="raekke" type="text" size="7" value="Row:" class="cleardefault"/></td>
                            <td width="110" height="100%"  valign="top"><input name="modelnr" type="text" size="12" value="Model Nr:" class="cleardefault" /> </td>
                            <td width="293" height="100%"  valign="top"><input name="navn" type="text" size="40" value="Name:" class="cleardefault" /></td>                      		 <td width="93" height="100%"  valign="top"><input name="priser" type="text" size="10" value="Price:" class="cleardefault" /></td>
                            <td width="123" height="100%"  valign="top"><input name="display" type="text" size="12" value="Display:" class="cleardefault" /></td>
                            <td width="104" height="100%" valign="top"><input name="bruger" type="text" size="10" value="Using:" class="cleardefault" /></td>
                            <td width="104" height="100%" valign="top"><input name="salg" type="text" size="10" value="Sall:" class="cleardefault" /></td>
                            <td width="101" height="100%" valign="top"><input name="usedup" type="text" size="10" value="Use Up:" class="cleardefault"/></td>
                            <td width="107" height="100%"  valign="top"><input name="instock" type="text" size="12" value="In Stock:" class="cleardefault" /></td>
                            <td width="128" height="100%" valign="top"><input name="totaltstock" type="text" size="15" value="Totalt Stock:" class="cleardefault"/></td>
                            <td width="139" height="100%"  valign="top"><input type="submit" value="Update Polish"/></td>
                         
                      </form>                       
                    </tr>
                </table>
            </td>
       	</tr>
        <tr>
        	<td width="1280px" height="100%" valign="top">
            	
                	

            </table>
                
               
            </td>
       	</tr>
    </table>
</body>
</html>

 

2:select

<?
                    	                                                                $raekke = $_POST['raekke'];
					$modelnr = $_POST['modelnr'];
					$navn = $_POST['navn'];
					$priser = $_POST['priser'];
					$display = $_POST['display'];
					$bruger = $_POST['bruger'];
					$salg = $_POST['salg'];
					$usedup = $_POST['usedup'];
					$instock = $_POST['instock'];
					$totaltstock = $_POST['totaltstock'];
					$username=""; // Mysql username 
					$password=""; // Mysql password 


					mysql_connect ("localhost", "root","$username", "$password") or die ("cannot connect");
					mysql_select_db("polish") or die ("cannot select DB");
					$query="INSERT INTO `polish`.`opi`(id, raekke, modelnr, navn, priser, display, bruger, salg, usedup, instock, totaltstock) VALUES ('NULL', '".$raekke."', '".$modelnr."','".$navn."', '".$priser."', '".$display."','".$bruger."','".$salg."','".$usedup."','".$instock."','".$totaltstock."')";
					mysql_query($query) or die ('error updating databasen');
					$result = mysql_query($query);
					mysql_close($query);
					if ($result)
						{
							header("location:polish.php");	
						}


?>

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/243023-select-in-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.