master123467 Posted December 7, 2005 Share Posted December 7, 2005 heres my cms.php im making click [a href=\"http://www.freepgs.com/fireballos/\" target=\"_blank\"].php file[/a] in the same link there should be my .html file i tried to right click and save as on the cms.php plz help me plz Quote Link to comment https://forums.phpfreaks.com/topic/2995-i-cant-get-this-writing-to-a-table-in-a-db-thing/ Share on other sites More sharing options...
Zup Posted December 7, 2005 Share Posted December 7, 2005 Paste your cms.php file here, I'll edit this and help you when you do. Quote Link to comment https://forums.phpfreaks.com/topic/2995-i-cant-get-this-writing-to-a-table-in-a-db-thing/#findComment-10047 Share on other sites More sharing options...
master123467 Posted December 7, 2005 Author Share Posted December 7, 2005 changed the code check 3 posts down for the new code Quote Link to comment https://forums.phpfreaks.com/topic/2995-i-cant-get-this-writing-to-a-table-in-a-db-thing/#findComment-10067 Share on other sites More sharing options...
master123467 Posted December 7, 2005 Author Share Posted December 7, 2005 ok i posted my cms.php code so do u think theres a way to fix it Quote Link to comment https://forums.phpfreaks.com/topic/2995-i-cant-get-this-writing-to-a-table-in-a-db-thing/#findComment-10070 Share on other sites More sharing options...
master123467 Posted December 8, 2005 Author Share Posted December 8, 2005 plz i really need help Quote Link to comment https://forums.phpfreaks.com/topic/2995-i-cant-get-this-writing-to-a-table-in-a-db-thing/#findComment-10075 Share on other sites More sharing options...
master123467 Posted December 8, 2005 Author Share Posted December 8, 2005 ok heres the new code <?php echo "<html>\n"; echo "<center>\n"; echo "<form name='CMS' method='post' action='cms.php'>\n"; echo "<textarea cols='50' rows='4' name='CMS'></textarea>\n"; echo "<br>\n"; echo "<input type='submit' value='Submit' action=''>\n"; echo "<input type='reset'>\n"; echo "</center>\n"; echo "</form>\n"; echo "</html>"; $dbhost = 'localhost:'; $dbuser = 'root'; $dbpass = 'master'; $table ='announcements'; $column ='text'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('connection not made'); $dbname = 'rockledge'; mysql_select_db($dbname); $query = "INSERT INTO $table ($column) VALUES ( 1,$CMS)"; mysql_query($query); mysql_close($conn) ?> hope u can help me fix it well i no it connects but it wont write to the announcements table and the text (LONGTEXT) column and $CMS well $CMS i want to be the text tht is in the textbox but i cant figure out how to do tht so i dont no if its working or not Quote Link to comment https://forums.phpfreaks.com/topic/2995-i-cant-get-this-writing-to-a-table-in-a-db-thing/#findComment-10078 Share on other sites More sharing options...
Zup Posted December 8, 2005 Share Posted December 8, 2005 Be careful when you post scripts on here because often they will contain your password, like yours did. Now the line: $query = "INSERT INTO $table ($column) VALUES ( 1,$CMS)"; will produce an error. You have to get rid of ($column). Next, you're inputting values (1, $CMS). I don't see anywhere in your code where $CMS is given a value. You're going to have to add this line before your query line somewhere in your code: $CMS = $_POST['CMS']; Now your 1 in there seems weird. I'm guessing that's a mistake too but since I can't see what your table structure is I can't be sure. Usually the first column in a table like this is your auto-increment variable, so replace 1 with '' (two single-quotes). You also have a ton of unneccessary variables in there but that won't stop the script from working. Post here when you have tried this. Quote Link to comment https://forums.phpfreaks.com/topic/2995-i-cant-get-this-writing-to-a-table-in-a-db-thing/#findComment-10079 Share on other sites More sharing options...
master123467 Posted December 8, 2005 Author Share Posted December 8, 2005 nope didnt work heres my code so far and master isnt my password all tht username and pass arent the really thing <?php echo "<html>\n"; echo "<center>\n"; echo "<form name='insert' method='post' action=''>\n"; echo "<textarea cols='70' rows='12' name='CMS'></textarea>\n"; echo "<br>\n"; echo "<input type='submit' value='Submit'>\n"; echo "<input type='reset'>\n"; echo "</center>\n"; echo "</form>\n"; echo "</html>"; $CMS = $_POST['CMS']; $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'master'; $table ='announcements'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('connection not made'); $dbname = 'rockledge'; mysql_select_db($dbname); $query = "INSERT INTO $table VALUES ( '',$CMS)"; mysql_query($query); mysql_close($conn) ?> maybe if u would test out the code like make a database named rockledge with the pass of master and then a table named announcements with a column in that table named text and that column should be LONGTEXT Quote Link to comment https://forums.phpfreaks.com/topic/2995-i-cant-get-this-writing-to-a-table-in-a-db-thing/#findComment-10088 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.