error in php code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sanjay123456
    New Member
    • Sep 2006
    • 125

    error in php code

    hello sir...
    plz check the coding....jsp functions are not working...
    Sir plz check the following code and point out me errror


    [PHP]
    <?
    include('../include/site_config.php ');

    ############### ############### ######
    /* @PAGGING */
    ############### ############### ######

    //Variable Declaration
    $array_user = array();
    $i=0;
    //Pagging Variable
    $display_per_pa ge = 10;
    $row_count = 0;
    $total_page = 0;
    $page_no = 0;
    if(isset($_REQU EST['page']))
    $selected_page_ no = $_REQUEST['page'];
    else
    $selected_page_ no = 1;
    //End Pagging Variable

    ############### ############### ###############

    $i = 0;
    $login_user = array();

    $sqlQuery = "SELECT id, fname, mname, lname, email,
    countries.count ries_name, status
    FROM customer, countries
    WHERE customer.countr y = countries.count ries_code_2
    ORDER BY fname";
    $rsQuery = mysql_query( $sqlQuery );
    while($row = mysql_fetch_obj ect( $rsQuery )) {
    $login_user[$i]['id'] = $row->id;
    $login_user[$i]['name'] = stripslashes($r ow->fname)."
    ".stripslashes( $row->mname)." ".stripslashes( $row->lname);
    $login_user[$i]['email'] = stripslashes($r ow->email);
    $login_user[$i]['country'] = $row->countries_name ;
    $login_user[$i]['status'] = $row->status;
    $i++;
    }
    ?>


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <link rel = 'stylesheet' href = '..\admin.css'>
    <script language="JavaS cript">
    function send_form( id, page ) {
    window.location .href = "add_category.p hp&page="+page ;
    }
    function send_form_edit( cust_id, page ) {
    window.location .href = "customer.p hp
    ?cust_id="+cust _id+"&page="+pa ge;
    }
    function pagging( page ) {
    window.location .href = "index.php?page ="+page;
    }
    function delcom(id, page) {
    var ans = window.confirm( "Are you sure you want to delete?");
    if(ans)
    window.location .href =
    'del_user.php?c ust_id='+id+'&p age='+page;
    }
    function status_check( mode, cust_id, page_no ){
    window.location .href = "index.php
    ?mode="+mode+"& cust_id="+cust_ id+"&page="+pag e_no;
    }
    </script>

    </head>
    <body leftmargin="0" topmargin="0" marginwidth='0' marginheight='0 '>
    <table cellpadding="0" cellspacing="0" border="0" width="600"
    align="center">
    <tr>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td align="center" valign="top">
    <table width="100%" border="0" cellpadding="0"
    cellspacing="0" >
    <tr>
    <td colspan = '3' class = 'mainHeader'>Cu stomer
    Manager</td>
    </tr>
    <tr>
    <td width="45%" height="22"
    class="tableCel l_banner_V"><a href="customer. php?page=<?=$se lected_page_no
    ?>">Add Customer</a></td>
    <td width="55%" height="22" colspan = '2'
    class="tableCel l_banner_V">&nb sp;</td>
    </tr>
    </table>
    <table width="100%" cellspacing="1" cellpadding="2"
    border="0">
    <tr class="searchRe sult" height="18">
    <td width="7%" align="center"> <b>SNo.</b></td>
    <td width="18%"
    align="center"> <b>Name</b></td>
    <td width="20%"
    align="center"> <b>Email</b></td>
    <td width="18%"
    align="center"> <b>Country</b></td>
    <td width="16%"
    align="center"> <b>Edit</b></td>
    <td width="21%"
    align="center"> <b>Delete</b></td>
    </tr>
    <? //paging

    //total record
    if(count($login _user) > 0)
    $row_count =
    count($login_us er);

    $from = $display_per_pa ge * (
    $selected_page_ no-1 );
    $to = $display_per_pa ge *
    $selected_page_ no;
    $row_no = $from + 1;

    $total_page =
    ceil(count($log in_user)/$display_per_pa ge);
    if($total_page == 0)
    $total_page = 1;
    //end
    $show_rows_on_s creen = 0;

    for( $i=$from; $i<$to; $i++ ) {
    if($show_rows_o n_screen ==
    $display_per_pa ge || !isset($login_u ser[$i]['id']) )
    break;
    $show_rows_on_s creen++;
    ?>
    <tr class="tableCel l">
    <td align="center"
    valign="top">&n bsp;<?=$i+1 ?></td>
    <td align="center"
    valign="top">&n bsp;<?=$login_u ser[$i]['name'] ?></td>
    <td align="center"
    valign="top">&n bsp;<?=$login_u ser[$i]['email'] ?></td>
    <td align="center"
    valign="top">&n bsp;<?=$login_u ser[$i]['country'] ?></td>
    <td align="center"
    valign="top">&n bsp;<a
    href="javascrip t:send_form_edi t(<?=$login_use r[$i]['id']
    ?>,<?=$selected _page_no ?>);"><img border='0' src='../images/edit_icon.gif'
    alt='Edit'></a></td>
    <td align="center"
    valign="top">&n bsp;<a href="javascrip t:delcom(<?=$lo gin_user[$i]['id'] ?>,
    <?=$selected_pa ge_no ?>)" ><img border='0' src='../images/b_drop.gif'
    alt='Delete'></a></td>
    </tr>
    <? } ?>
    <tr height="22">
    <td colspan="6">&nb sp;</td>
    </tr>
    <tr class="tableCel l" height="22">
    <td colspan="6" align="right">
    <?
    //echo "page :";
    for($i=1; $i<=$total_page ; $i++) {
    if( ($page_no+$i)== $selected_page_ no
    ) {
    echo " ";
    echo "[".($page_no+$i) ."]";
    } else {
    ?>
    <a
    href="javascrip t:pagging(<?=($ page_no+$i) ?>)"><? echo "[".($page_no+$i) ."]"
    ?></a>
    <? }//End If
    }//For
    ?>&nbsp;&nbsp;
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </body>

    [/PHP]

    sanjay
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Firstly, there is no JSP code in your code, I see just JavaScript, which is very different from JSP.

    Secondly, a statement like "it is not working" does not give much of information on "what" is not working. So, please answer these questions, so we can help you:

    - what function or part of the code is not working?
    - what have you done to find the error, what debug statements and traces?

    Ronald :cool:

    Comment

    • sanjay123456
      New Member
      • Sep 2006
      • 125

      #3
      Sir ,

      sorrry for that its js code error menas java script function
      java script functiion r not work menas its give blank page sir


      sanjay

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Originally posted by ronverdonk
        Firstly, there is no JSP code in your code, I see just JavaScript, which is very different from JSP.

        Secondly, a statement like "it is not working" does not give much of information on "what" is not working. So, please answer these questions, so we can help you:

        - what function or part of the code is not working?
        - what have you done to find the error, what debug statements and traces?

        Ronald :cool:
        And what about the 'please answer these questions' answers as asked in the previous reply? 'It does not work': what have you done yourself to isolate the possible error? After >20 threads you should know that you'll first have to try yourself to isolate your problem.

        Your thread title says: error in php code! Apparently it is not, it is in the javascript code.

        Ronald :cool:

        Comment

        Working...