skyer2000 Posted February 15, 2007 Share Posted February 15, 2007 I was working on my site at www.domain.com/temp/site/admin and decided to move it to a subdomain dev.domain.com All of my query functions work when pulling data from the database, however, all of the forms used to update data have stopped working. I can't even begin to figure out what the problem is. I copy/pasted the EXACT code from one site to the other, and everything works (adding, deleting, and listing work) ... everything except for updating What can be possible causes of this? I kept the other site live and it still works perfectly, however, the new subdomain's php forms will not update the database. I tried putting an echo "$sql"; after the update process, but that wouldn't even show up. It seems that there is something wrong with submit? I have no idea (NOTE: This is the exact same pageedit.php code that works in the other folder) <?php require_once ('../library/sql_connect.php'); $editortype=$_GET['editortype']; if ($editortype == '1') { require_once ('templates/editorheader.php'); } else { require_once ('templates/adminheader.php'); } $id=$_GET['id']; if ($submit) { $id = $_POST['id']; $title = $_POST['title']; $urlrewrite = $_POST['urlrewrite']; $category = $_POST['category']; $editortype = $_POST['editortype']; $content = $_POST['content']; $date = $_POST['date']; if(!get_magic_quotes_gpc()) { $title = addslashes($title); $content = addslashes($content); } $sql = "UPDATE content SET title='$title',urlrewrite='$urlrewrite',category='$category',editortype='$editortype',content='$content',date='$date' WHERE id='$id'"; $result = mysql_query($sql) or die ('Error in query: $sql. ' . mysql_error()); printf("Records Updated: %d\n <p>", mysql_affected_rows()); } $sql = "SELECT * FROM content WHERE id='$id'"; $result = mysql_query($sql); $page_info = mysql_fetch_array($result); ?> <h1>Edit <?php echo $page_info['title']; ?></h1> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> <input type="hidden" name="id" value="<?php echo $id; ?>"> <p> Title:<br /> <input type="text" name="title" size="40" maxlength="40" value="<?php echo $page_info['title']; ?>" /> </p> <p> URL Rewrite:<br /> <input type="text" name="urlrewrite" size="40" maxlength="40" value="<?php echo $page_info['urlrewrite']; ?>" /> </p> <p> Category:<br /> <input type="text" name="category" size="40" maxlength="40" value="<?php echo $page_info['category']; ?>" /> </p> <p> Editor Type:<br /> <select name="editortype"> <?php if ($editortype == '1') { ?> <option name="1">HTML</option> <option name="0">PHP</option> <?php } else { ?> <option name="0">PHP</option> <option name="1">HTML</option> <?php } ?> </select> </p> <p> Content:<br /> <textarea name="content" rows="20" cols="80"><?php echo $page_info['content']; ?></textarea> </p> <p> Date:<br /> <input type="text" name="date" size="40" maxlength="40" value="<?php echo $page_info['date']; ?>" /> </p> <p> <input type="submit" name="submit" value="Submit!" /> </p> </form> <?php require_once ('templates/adminfooter.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/38652-solved-mysql-update-working-in-one-folder-but-not-another/ Share on other sites More sharing options...
fenway Posted February 15, 2007 Share Posted February 15, 2007 Are you sure you can even connect to the database? Quote Link to comment https://forums.phpfreaks.com/topic/38652-solved-mysql-update-working-in-one-folder-but-not-another/#findComment-185578 Share on other sites More sharing options...
skyer2000 Posted February 15, 2007 Author Share Posted February 15, 2007 Are you sure you can even connect to the database? Yes, this page pulls the information from the database to fill out the form to edit. Everything works up until the update process. Quote Link to comment https://forums.phpfreaks.com/topic/38652-solved-mysql-update-working-in-one-folder-but-not-another/#findComment-185580 Share on other sites More sharing options...
skyer2000 Posted February 15, 2007 Author Share Posted February 15, 2007 Some more information, when the Submit button is pressed, anything under if($submit) does not run, I've tried throwing an echo "hey"; in there but it didn't show up. That would explain why it is not updating, because its not even getting to that point to run the code. I hope that generates some ideas in your heads, mine is stumped Quote Link to comment https://forums.phpfreaks.com/topic/38652-solved-mysql-update-working-in-one-folder-but-not-another/#findComment-185713 Share on other sites More sharing options...
fenway Posted February 15, 2007 Share Posted February 15, 2007 And where does $submit come from? Quote Link to comment https://forums.phpfreaks.com/topic/38652-solved-mysql-update-working-in-one-folder-but-not-another/#findComment-185813 Share on other sites More sharing options...
skyer2000 Posted February 15, 2007 Author Share Posted February 15, 2007 It comes from: <input type="submit" name="submit" value="Submit!" /> Is there a different way of handing the $submit variable when that is pressed (i still don't understand why it just doesn't work in this new folder)? Quote Link to comment https://forums.phpfreaks.com/topic/38652-solved-mysql-update-working-in-one-folder-but-not-another/#findComment-185817 Share on other sites More sharing options...
fenway Posted February 15, 2007 Share Posted February 15, 2007 I have to believe you, but I don't see any line that makes that assignment. Quote Link to comment https://forums.phpfreaks.com/topic/38652-solved-mysql-update-working-in-one-folder-but-not-another/#findComment-185819 Share on other sites More sharing options...
skyer2000 Posted February 15, 2007 Author Share Posted February 15, 2007 You know what, I went ahead and changed if($submit) to if ($_POST['submit']) I still have no idea why it would work in one folder but not the other, but I guess since it works now I should just forget about the mystery ??? Thanks for pointing me in the right direction! Quote Link to comment https://forums.phpfreaks.com/topic/38652-solved-mysql-update-working-in-one-folder-but-not-another/#findComment-185824 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.