kpetsche20 Posted April 4, 2008 Share Posted April 4, 2008 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 More sharing options...
writer Posted April 4, 2008 Share Posted April 4, 2008 $sql = "SELECT * FROM affiliates ORDER BY name ASC"; Is bluearro_joe the first entry in your affiliates table? Link to comment https://forums.phpfreaks.com/topic/99456-problem-adding-info-into-mysql-database/#findComment-508923 Share on other sites More sharing options...
BobcatM Posted April 4, 2008 Share Posted April 4, 2008 mysql_query("INSERT INTO test (`name`) VALUES('".$_POST['affiliates']."')") or die(mysql_error()); I think (`name`) is messing this up. Not sure why that is even there. Link to comment https://forums.phpfreaks.com/topic/99456-problem-adding-info-into-mysql-database/#findComment-508928 Share on other sites More sharing options...
stuffradio Posted April 4, 2008 Share Posted April 4, 2008 (`name`) is there because you're adding information in to the field named "name". You could try removing the " ` " from there to see if that works. I'm not too sure right now why you're having problems. Link to comment https://forums.phpfreaks.com/topic/99456-problem-adding-info-into-mysql-database/#findComment-508933 Share on other sites More sharing options...
writer Posted April 4, 2008 Share Posted April 4, 2008 Are you putting data into a table named "name" but calling data from a table named "affiliates"? Link to comment https://forums.phpfreaks.com/topic/99456-problem-adding-info-into-mysql-database/#findComment-508959 Share on other sites More sharing options...
kpetsche20 Posted April 4, 2008 Author Share Posted April 4, 2008 I'm putting the data into table affiliates in the field name Link to comment https://forums.phpfreaks.com/topic/99456-problem-adding-info-into-mysql-database/#findComment-508989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.