could someone help me out of this code i have a problem the quoted input text could not be print see my codes

`function generate_table(){
    $query = "select id,branchcode,accountno,accountname,naturalaccount,mname,placeholder,design,elevel from account_codes";
    $result = mssql_query($query);  
    $index = 0; 

    while($result_row=mssql_fetch_array($result)){
    $index++;
        echo '<tr>
                    <td><input size="2" type="hidden" value="'.$result_row['id'].'" name="did'.$index.'" id="did'.$index.'" disabled="disabled"/>';
                        echo '<select  style="width:160px" disabled="disabled" name="bcode'.$index.'" id="bcode'.$index.'" >'.branch_code($result_row['branchcode']).'</select></td>';
                    echo '<td><input type="text" style="width:200px;" value="'.$result_row['accountno'].'" name="ano'.$index.'" id="ano'.$index.'" readonly="readonly"/></td>
                    <td><input type="text" style="width:300px;" value="'.$result_row['accountname'].'" name="aname'.$index.'" id="aname'.$index.'" readonly="readonly"/></td>
                    <td><input type="text" value="'.$result_row['naturalaccount'].'" name="naccount'.$index.'" id="naccount'.$index.'" readonly="readonly"/></td>
                    <td><input type="text" value="'.$result_row['mname'].'" name="mname'.$index.'" id="mname'.$index.'" readonly="readonly"/></td>
                    <td><input  type="text" value="'.$result_row['placeholder'].'" name="pholder'.$index.'" id="pholder'.$index.'" readonly="readonly"/></td>
                    <td><input  size="10" type="text" value="'.$result_row['design'].'" name="design'.$index.'" id="design'.$index.'" readonly="readonly"/></td>
                    <td><input  size="4" type="text" value="'.$result_row['elevel'].'" name="elevel'.$index.'" id="elevel'.$index.'" readonly="readonly"/></td>
                    <td><a href="javascript: edit_acodes('.$index.')" id="editor'.$index.'">edit</a></td><td><a href="delete_acodes.php?did='.$result_row['id'].'">delete</a></td>';
        echo '</tr>';
    }
  echo '<input type="text" id="endindex" name="endindex" value="'.$index.'"/>';
}

function branch_code($default){
    $query = "select left(locationname,PATINDEX( '%~%' , locationname )-1) as id,right(locationname,len(locationname)-PATINDEX( '%~%' , locationname )) as lname from location_setup1_v";
    $result = mssql_query($query);
    $retval = '';
    while($result_row = mssql_fetch_array($result)){
        if($default==$result_row['id']){
            $selected = 'selected="selected"';
        }else{
            $selected = '';
        }
        $retval .= '<option value="'.$result_row['id'].'" '.$selected.' >'.$result_row['lname'].'</option>';
    }
    return $retval;     
}`

Recommended Answers

All 5 Replies

Which input does not print (identify it by name attribute)? The first input is the type of "hidden" and won't print which is what is expected. Other input fields show up normaly.

Try and watch your opening posts a bit more, it's very hard to read without dots and enters at the right place.
also, if your 'endindex' file seems empty, try to echo $index one rule in front of it, see what that gives you.
try using multiple echoes in your functions to see if it even gets there at all. it lookss commented away here.

One more issue: are your queries returning values for all the fields? You are not checking that in your (with isset() function). This is not a good practice. If some field is not returned (since it not exists) your query can break.

thanks for the replies =)
i already solved it the query
breaks and only few will be displayed its because there are lots of data to be retrieve and i only set mssql.timeout to 3600

OK. Please mark the thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.