xoligy Posted June 24, 2008 Share Posted June 24, 2008 Ive been trying to add some info to the db but have been failing misrably this is probably because ive been concentrating with the php rather than the mysql side of things and with no net at home and no books in the libery on php things are going really slow! This is the code ive been trying to use to add to the db: <?php if ($_POST['submit']){ $description = stripslashes($_POST['description']); $query = "UPDATE `UserDetails` SET description = '$description' WHERE ID = '$id'"; $result = @mysql_query($query); } ?> <TD colspan="2" align="center"><B>Profile Description:</B><br> <FORM method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <textarea rows="5" cols="10" name="description" maxlength="500"><?$description?></textarea> <br /><INPUT name="submit" type="submit" value="Update Profile" /> <input type="hidden" name="submitted" value="TRUE" /> As you can see im trying to add the info to userdetails -> description from the above code i have removed maxlength as thats going to be added to another php file, via a function if i can do it lol Also the connection to the db is in another file with all the other functions Link to comment https://forums.phpfreaks.com/topic/111643-solved-adding-something-to-the-db/ Share on other sites More sharing options...
zenag Posted June 24, 2008 Share Posted June 24, 2008 you h've not mentioned $id values??? Link to comment https://forums.phpfreaks.com/topic/111643-solved-adding-something-to-the-db/#findComment-573124 Share on other sites More sharing options...
lonewolf217 Posted June 24, 2008 Share Posted June 24, 2008 one thing I always found helpful would be to comment out the line that commits to the database, and instead do an echo $query then take what it prints out and run it on your database. If it succeeds, you know your query is correct. if it fails, it will tell you why Link to comment https://forums.phpfreaks.com/topic/111643-solved-adding-something-to-the-db/#findComment-573130 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.