fert Posted January 28, 2007 Share Posted January 28, 2007 I have this code[code]if($_SESSION['user']=="") { die("No"); } else { $name=$_GET['name']; echo $name; $result=@mysql_query("SELECT * FROM `blog_archives` WHERE `name`='$name'",$cn) or die(mysql_error()); echo "<p style=\"color: #FFFFFF;\">"; while($row=mysql_fetch_array($result)) { $title=$row['title']; $comment=$row['contents']; $posted=$row['posted']; $attachments=$row['attachments']; $title=addslashes($title); $comment=addslashes($comment); print_r($row); @mysql_query("INSERT INTO `blog_entries` (title,content,posted,attachments) VALUES('$title','$comment','$posted','$attachments')",$cn) or die(mysql_error()); } echo "</p>"; @mysql_query("DELETE FROM `blog_archive_list` WHERE `name`='$name'",$cn) or die(mysql_error()); }[/code]This code is suppose to take data from an archive table and put it into an entries table. But it's not working. Can anybody see why?Here are the tables:blog_archive_list[quote]name text[/quote]blog_archives[quote]name text title text contents text posted bigint(20) attachments text[/quote]blog_entries[quote]title textcontent textposted bigint(20)attachments text[/quote] Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 28, 2007 Share Posted January 28, 2007 You should know better than to post just "it's not working".WHY isn't it working? Quote Link to comment Share on other sites More sharing options...
fert Posted January 28, 2007 Author Share Posted January 28, 2007 It's not working because it isn't inserting or deleting and I get no errors Quote Link to comment Share on other sites More sharing options...
.josh Posted January 28, 2007 Share Posted January 28, 2007 first thing I would do is separate my query string from my query and echo the query to see if I'm sending what I think I'm sending to the db. Quote Link to comment Share on other sites More sharing options...
fert Posted January 28, 2007 Author Share Posted January 28, 2007 I fixed this by putting the restore code on a seperate page. Quote Link to comment 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.