SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    625
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    error details in php

    hi all

    i get error message "not updated"

    PHP Code:
    if(mysql_query($qry))
    {
    $msg "updated";
    }
    else
    {
    $msg "not updated";

    But this code doesnt let tell me what and where the problem is.

    so i would like to know where should i put the below code on my page
    (Before calling db_connection file or after calling db_connection file)

    PHP Code:
    error_reporting(E_ALL); 
    so that it tell me details of error.

    vineet

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    You need to call mysql_error since your error is with mysql and not directly with PHP

  3. #3
    SitePoint Guru
    Join Date
    Nov 2008
    Posts
    625
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cpradio View Post
    You need to call mysql_error since your error is with mysql and not directly with PHP
    thanks cp

    but just for my information where do we insert error_reporting(e_all)
    before call db_conection or after db_conection code

    vineet

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,235
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    error_reporting(e_all) would be at the top of your script, but that only enables PHP driven errors to be reported.

    You would use mysql_error in your else statement.
    PHP Code:
    if(mysql_query($qry)) 

    $msg "updated"

    else 

    $msg "not updated" mysql_error($conn);  //where $conn is your connection to mysql



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •