Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.