Jump to content

Abrupt end in code


Alphamonkey

Recommended Posts

basically php isnt executing all of the code. It just stops and doesn't display anything after a certain point.

 

heres the code

 

<?php echo " <span style='color:red'>$welcome</span> </div>"?>
   <h1><?php echo ucwords($color) ?> Menu: Add Element</h1>
  <form name="addmenuelement" id="addmenuelement" method="post" action="<?php echo $action ?>">
                 
  Title:
   <input type="text" name="title" id="title" align="left"> <div />
   
  Link:
    <input type="text" name="link" id="link" align="left">      <div />  
   
  Does this have a Parent?:
    <input type="checkbox" name="hasparent" id="hasparent">   <div />  
   
  If So......Parent Name:
    <select name="allparents" id="allparents">          
        <option value=""></option>
       
          <?php
          ini_set("display_errors","2");
          ERROR_REPORTING(E_ALL);  
           
            $query= "SELECT * FROM $table WHERE layer=1";
            $result = mysql_query($query) or die("Query failed!  <br />" . mysql_error() . "<br />". $query);
            while($row = mysql_fetch_array($result, MYSQL_ASSOC) or die( mysql_error()) )
            {  
                echo "<option value=". $row['title'].">". $row['title']. "</option>" ;
                }
        ?>
                                             
    </select>
    </div>                            
    <input type="submit" />
   
  </form>

 

here is the source from firefox

<span style='color:red'></span> </div>   <h1>Orange Menu: Add Element</h1>
  <form name="addmenuelement" id="addmenuelement" method="post" action="addmenuscript.php?c=orange">
                 
  Title:
   <input type="text" name="title" id="title" align="left"> <div />
   
  Link:
    <input type="text" name="link" id="link" align="left">      <div />  
   
  Does this have a Parent?:
    <input type="checkbox" name="hasparent" id="hasparent">   <div />  
   
  If So......Parent Name:
    <select name="allparents" id="allparents">          
        <option value=""></option>

       
          <option value=Home>Home</option><option value=Leagues>Leagues</option>  

 

basically....it just stops and doesnt display the submit button or ANYTHING after the select. does anyone know why?

Link to comment
https://forums.phpfreaks.com/topic/122308-abrupt-end-in-code/
Share on other sites

OMG, that is the funniest thing I have seen posted lately.  ;D

 

You do understand that when mysql_fetch_array() has already fetched the last row from the result set it will return a false value the next time it executes which the or die() will use to terminate program execution?

 

Remove the or die() from the end of the mysql_fetch_array(). The purpose of the while() statement is to loop until the mysql_fetch_array() returns a false value.

Link to comment
https://forums.phpfreaks.com/topic/122308-abrupt-end-in-code/#findComment-631562
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.