Why else ERROR message not displaying

This is the end of the php code that I am using can you please let me know why I am not getting the after else message.

 if ($desc !="")
      {
    $sql = "INSERT INTO categories (name, description,image,videolink,videoimage,user,date)
                VALUES ('$name', '$desc', '$exitfile','$videolink','$exitfile1','$use','$date')";
      }
      else {
     $sql = "INSERT INTO categories (name,image,videolink,videoimage,user,date)
            VALUES ('$name',  '$exitfile','$videolink','$exitfile1','$use','$date')";
                }


    if ($db->query($sql) === TRUE) {                    
    echo "<p align='center'><font color='green'><b>New image added successfully</b> </font></p>";               
    echo "<script>window.location.href='categoryadd1.php';</script>";
    header('Location:categoryadd1.php?message=Category added successfully');
    } 


  else 

  {

  echo "Error: " . $sql . "<br>" . $conn->error;
```

if you var_dump($desc);, what do you get?

I’m not sure what incorrect output you are getting, but if your database connection is in $db, trying to echo $conn->error probably won’t work. Do you have php’s error_reporting set to E_ALL and display_errors set to ON so that php would help you by reporting and displaying all the errors it detects?

The thing is the upload of the image file is working fine. But if the file is to large ( like more then 1mb then the message of ERROR does not show and the page opens only with the header and no form is shown. Other wise 1mb or less the form works fine. Anyways will try the error_report and see what I get. thanks.

var_dump($desc); , - this shows error;

Sponsor our Newsletter | Privacy Policy | Terms of Service