• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

If statement no longer works after changing ID field to auto-increment

I don't get this, but ever since I changed the ID fields to auto-increment which is where they should have originally been the page doesn't work anymore.  This is my if statement now, which worked before I changed that setting for the IDs.

<?php
if(isset($_GET['Posted_Comment'])) {

$sql_post = mysql_query("SELECT Posts.intPost_ID, Posts.strTime, Posts.strSubject, Posts.strTitle, Posts.strComment, Posts.strName FROM Posts WHERE intPost_ID = '" . $_GET['intPost_ID'] . "' ") or die(mysql_error());
            
            while($row = mysql_fetch_array($sql_post)) {
            
                  $intPost_ID = $row['intPost_ID'];
                  $strTime = $row['strTime'];
                  $strSubject = $row['strSubject'];
                  $strTitle = $row['strTitle'];
                  $strComment = $row['strComment'];
                  $strName = $row['strName'];
                  
            }

      } elseif(isset($_GET['Reply_Comment'])) {
      
$sql_reply2 = mysql_query("SELECT Replies.intReply_ID, Replies.strTime, Replies.strReply, Replies.strReply_Name, Posts.strSubject, Posts.strTitle, Posts.strComment FROM Posts, Replies WHERE Replies.intReply_ID = '" . $_GET['intReply_ID'] . "' ") or die(mysql_error());
      
            while($row = mysql_fetch_array($sql_reply2)) {
                  
                  $intReply_ID = $row['intReply_ID'];
                  $strTime = $row['strTime'];
                  $strReply = $row['strReply'];
                  $strReply_Name = $row['strReply_Name'];
                  $strSubject = $row['strSubject'];
                  $strTitle = $row['strTitle'];
                  
            }
      }
echo title . $strTitle;
?>
0
pingeyeg
Asked:
pingeyeg
  • 4
2 Solutions
 
OscurochuCommented:
try mysql_fetch_assoc()
0
 
pingeyegAuthor Commented:
Nope that didn't work.
0
 
punkstarCommented:
Take a look at your database table. Does anything look out of place. All ID's looking fine?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
pingeyegAuthor Commented:
Everything appears to be in order.  I tried deleting the ones I inserted and then inserted another one, but still doesn't work.  When I click on reply to that comment the next page doesn't have anything from the db there other than the text from html.
0
 
pingeyegAuthor Commented:
Any clue as to why nothing is showing but the html?
0
 
pingeyegAuthor Commented:
Nevermind I got it.

I calling the ID number instead of the name of the ID number.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now