Need a bit of help

Discussion in 'MySQL' started by xadet3, Mar 31, 2007.

  1. #1
    I've just started PHP/MySQL and I'm having a bit of trouble with the site I'm making.

    This certain page shows if a link is validated, pending or deleted.

    People submit the ID into the form and it displays one of the above.

    The problem is it's just showing nothing when I enter a test id.

    The part of the script is
               
    			<form action='<?php echo "$self?action=submit"; ?>' method='post'>
    			<input name='statusid' type='text' size="10" maxlength='20'><br />
    			<input type='Submit' name='submit' value='Check Status'>
    			</form>
               <?php
               if(isset($_POST['submit']))
    
               {
    				
               $statusid = mysql_real_escape_string(strip_tags($_POST['statusid']));
    			
               $status = mysql_fetch_assoc(mysql_query("SELECT is_validated FROM links WHERE id = '$statusid'"));
    			
               $error_msg = array();
    			
               if(empty($statusid))
               {
               $error_msg[] = "Please insert a ID!<br />";
               }
               if(count($errors) > 0)
               {
               echo "<strong>ERROR:</strong><br>";
               echo "$error_msg";
               }
    
               if(($status) == "0") 
               {
    	       echo "Unverified";
               }
               elseif(($status) == "1") 
               {
               echo "Verified";
               }
               elseif(($status) == "2")
               {
               echo "Deleted";
               }
               }
               ?>
    Code (markup):
    It is already connected to to the db from a small part of the script above.

    It's probably a stupid error somewhere but like I said, I'm new :p
     
    xadet3, Mar 31, 2007 IP
  2. Dextrone

    Dextrone Peon

    Messages:
    680
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <br /> ?????

    Could that be an error....I don't see a mySql connection part either {atleast I think so}
     
    Dextrone, Mar 31, 2007 IP
  3. xadet3

    xadet3 Peon

    Messages:
    565
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I don't quite get what you mean by the <br /> being an error.

    The mysql connection is further up the page, I havn't put it on here.
     
    xadet3, Mar 31, 2007 IP
  4. maiahost

    maiahost Guest

    Messages:
    664
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #4
    this part :
    
     if(($status) == "0") 
               {
    	       echo "Unverified";
               }
               elseif(($status) == "1") 
               {
               echo "Verified";
               }
               elseif(($status) == "2")
               {
               echo "Deleted";
               }
               }
    
    
    Code (markup):
    should have $status["is_validated"] not just $status
    edit : like :
    
     if($status["is_validated"]   == 0) 
               {
    	       echo "Unverified";
               }
               elseif($status["is_validated"]  == 1) 
               {
               echo "Verified";
               }
               elseif($status["is_validated"]  == 2)
               {
               echo "Deleted";
               }
               }
    
    
    Code (markup):
    You also have other errors in the script (echo the array?)
     
    maiahost, Mar 31, 2007 IP