camdenite Posted February 4, 2009 Share Posted February 4, 2009 Hi all, I have been adapting scripts to build my own blog. All working okish so far. I have created a blog delete page - only problem is that I can't get it to display anything. I can get it to delete the blog but not show $row['heading'] or any other. There is definatly some text in there and the info shows up on my blog edit page - and indeed blog display page - as well as the actual page where you choose which you want to delete. But not here. Thank you for any advice, Colin // Retrieve the page information. $query = "SELECT blog_id, heading, first_para from blogb WHERE blog_id=$id"; $result = @mysql_query ($query); // Run the query. if (mysql_num_rows($result) == 1) { // Valid page ID, show the form. // Get the page information. $row = mysql_fetch_array ($result, MYSQL_NUM); // Create the form. echo '<h2>Delete a blog.</h2> <form action="delete_blog.php" method="post"> <h3>Blog Name: ' . $row['heading'] . '</h3> <p>Are you sure you want to delete this blog?<br /> <input type="radio" name="sure" value="Yes" /> Yes <input type="radio" name="sure" value="No" checked="checked" /> No</p> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="id" value="' . $id . '" /> </form>'; } else { // Not a valid user ID. echo '<h1 id="mainhead">Page Error</h1> <p>This page has been accessed in error.</p><p><br /><br /></p>'; } In fact echo $row['heading']; is not working either. Nothing in the error log :s Link to comment https://forums.phpfreaks.com/topic/143837-solved-rowheading-not-displaying/ Share on other sites More sharing options...
justinh Posted February 4, 2009 Share Posted February 4, 2009 change $query = "SELECT blog_id, heading, first_para from blogb WHERE blog_id=$id"; $result = @mysql_query ($query); // Run the query. to $query = "SELECT blog_id, heading, first_para from blogb WHERE blog_id=$id"; $result = @mysql_query ($query) or die(mysql_error()); // Run the query. and see if that returns any errors Link to comment https://forums.phpfreaks.com/topic/143837-solved-rowheading-not-displaying/#findComment-754737 Share on other sites More sharing options...
camdenite Posted February 4, 2009 Author Share Posted February 4, 2009 Hi justinh, Thank you for this. $query = "SELECT heading, first_para, entry FROM blogb WHERE blog_id=$id"; $result = @mysql_query ($query) or die(mysql_error()); // Run the query. I did this but it returned no errors - not displayed or in the error log. Cheers Link to comment https://forums.phpfreaks.com/topic/143837-solved-rowheading-not-displaying/#findComment-754739 Share on other sites More sharing options...
trq Posted February 4, 2009 Share Posted February 4, 2009 Where is $id defined? Link to comment https://forums.phpfreaks.com/topic/143837-solved-rowheading-not-displaying/#findComment-754740 Share on other sites More sharing options...
trq Posted February 4, 2009 Share Posted February 4, 2009 You'll also want to change this.... $row = mysql_fetch_array ($result, MYSQL_NUM); to... $row = mysql_fetch_array ($result, MYSQL_ASSOC); Link to comment https://forums.phpfreaks.com/topic/143837-solved-rowheading-not-displaying/#findComment-754741 Share on other sites More sharing options...
camdenite Posted February 4, 2009 Author Share Posted February 4, 2009 You'll also want to change this.... $row = mysql_fetch_array ($result, MYSQL_NUM); to... $row = mysql_fetch_array ($result, MYSQL_ASSOC); Hi thorpe, That did it I was wondering about the NUM as I wasn't trying to display a list. I will read up on it. Thank you all Link to comment https://forums.phpfreaks.com/topic/143837-solved-rowheading-not-displaying/#findComment-754744 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.