Jump to content

Problem adding info into MySQL Database.


kpetsche20

Recommended Posts

I'm trying to add values to a database, but whenever I update the form, I get this error.

 

Table 'bluearro_joe.test' doesn't exist

 

I tried creating an identical table with a different name, but I still get the same error.

 

 

<td width="625" valign="top" class="mainbody">
     
    <div class="welcometo">add user to affiliate</div>

    <?
if (isset($_POST['addmemberbt']))
{

	mysql_query("INSERT INTO test (`name`) VALUES('".$_POST['affiliates']."')") or die(mysql_error());
       
    		echo "
<META http-equiv='refresh' content='10;URL=index.php?p=listusers'>
Account was successfully added.. Redirection in 10 sec... or click <a href='index.php?p=listusers'>here</a> to continue <br /><br />";
    
}
else
{
?>
    <form action="index.php?p=adduser" method="post" name="addmember">
      <p>Affiliate Name<br>
        <select name="affiliates">
	<?
   	$sql = "SELECT * FROM affiliates ORDER BY name ASC";
    	$result = mysql_query($sql);
    	while($data = mysql_fetch_array($result))
    	{
    		$country = $data['name'];
		echo "<option value='$country'>$country</option>";
	}
    	?>
    </select>
        </p>
      <p>Username<br />
        <select name="username" id="username">
	<?
   	$sql2 = "SELECT * FROM users";
    	$result3 = mysql_query($sql2);
    	while($data2 = mysql_fetch_array($result3))
    	{
    		$country2 = $data2['login'];
		echo "<option value='$country2'>$country2</option>";
	}
    	?>
        </select><br />
      </p>
      <p>Affiliate ID<br />
        <input type="text" name="affiliateid" id="affiliateid" />
      </p>
      <p><br>
    <br>
    <input type="submit" value="Add Affiliate" name="addmemberbt">
      </p>
  </p>
  </form>
<?
}
?> 
    </td>
    <td width="11" valign="top" class="mainbody"> </td>

Link to comment
https://forums.phpfreaks.com/topic/99456-problem-adding-info-into-mysql-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.