php - How to include a debugger in phpmyadmin in my cPanel -


i have write few php scripts , don't want install wamp/lamp server.

i writing these scripts directly on cpanel on server side.

so if run script , there error doesn't show me line number or instead gives message url not available makes difficult debug.

so how can debug code if writing directly on server side. there software or can install?

my code : here have removed semi colon in $query line make error, otherwise code fine.

<?php  /* make connection database*/ $con = mysqli_connect("localhost","*****", "****", "****");  /*function check connection*/ if(mysqli_connect_errno()){     printf("connection failed : %s \n",mysqli_connect_error());     exit(); }  error_reporting(e_all); ini_set("display_errors", 1);  $query = "select * music order id desc"  if($result = mysqli_query($con, $query)){     $i = 0;     while($row = mysqli_fetch_row($result)){         if($i == 0){             echo "$row[0],$row[1],$row[2],$row[3]";         }          else{             echo "*$row[0],$row[1],$row[2],$row[3]";         }          $i++;      }      mysqli_free_result($result); } mysqli_close($con);  ?> 

write 2 line @ begging of php script.

<?php error_reporting(e_all); ini_set("display_errors", 1);  ?> 

this show error.

by seeing code please changes.

1: put error_reporting(e_all); ini_set("display_errors", 1); code @ begging of php script.

2: , remove $result = mysqli_query($con, $query if condition. code should this.

$result = mysqli_query($con, $query) $i = 0; while($row = mysqli_fetch_row($result)){     if($i == 0){         echo "$row[0],$row[1],$row[2],$row[3]";     }      else{         echo "*$row[0],$row[1],$row[2],$row[3]";     }      $i++;  }  mysqli_free_result($result); 

3: , (i guess) here mysqli_connect("localhost","*****", "****", "****") should sever ip address. like

mysqli_connect("192.168.0.1","*****", "****", "****")


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -