dezkit Posted April 13, 2008 Share Posted April 13, 2008 well all i need is so i can insert something into a table with a form. index.php <form action="db.php" method="post"> <table border=0> <tr> <td>Steamid <td><input type="text" name="steamid" id="steamid"> <tr> <td>Access flags <td><input type="text" name="accessflags" id="accessflags"> <tr> <td>Account Flags <td><input type="text" name="accountflags" id="accountflags"> <tr> <td colspan="2" align="right"><input type="submit" value="Submit"> </form> </table> db.php <?php // Make a MySQL Connection mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("1337bunnies") or die(mysql_error()); // Insert a row of information into the table "example" mysql_query("INSERT INTO users (steamid, accessflags, accountflags) VALUES('$steamid', '$accessflags', '$accountflags' ) ") or die(mysql_error()); echo "Data Inserted!"; ?> whenever i fill out the form and i look into phpmyadmin, its blank. i don't know, but i think im doing wrong stuff with the varchar and what not. here is the format. steamid = "STEAM_0:0:123456" accessflags = "abcdefghijklmnopqrstuvwxyz" access = "de" Link to comment https://forums.phpfreaks.com/topic/100864-solved-php-mysql-insert/ Share on other sites More sharing options...
darkfreaks Posted April 13, 2008 Share Posted April 13, 2008 make sure everything isset and not empty <?php if (isset($steamid)||isset($accessflags)||isset($accountflags)|| !empty($steamid))||!empty($accessflags)||!empty($accountflags)) { //insert }?> Link to comment https://forums.phpfreaks.com/topic/100864-solved-php-mysql-insert/#findComment-515812 Share on other sites More sharing options...
mrdamien Posted April 13, 2008 Share Posted April 13, 2008 It looks like your script relies on register_globals (which is normally off for security reasons.) To access the data from your form, make sure you use $_POST['accountflags'] $_POST['accessflags'] and $_POST['steamid']. Link to comment https://forums.phpfreaks.com/topic/100864-solved-php-mysql-insert/#findComment-515817 Share on other sites More sharing options...
dezkit Posted April 13, 2008 Author Share Posted April 13, 2008 i got it, thanks all of yal Link to comment https://forums.phpfreaks.com/topic/100864-solved-php-mysql-insert/#findComment-515829 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.