1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

SQL DB problem

Discussion in 'PHP' started by bluemouse2, Aug 15, 2008.

  1. #1
    Hi!

    This is the problem I have:

    When trying to add information via php script to the sql database I only get empty (blank) rows inserted without information...

    Can you please tell what may be wrong?

    The mysql connection is fine.
     
    bluemouse2, Aug 15, 2008 IP
  2. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #2
    Care to post the code?
     
    rohan_shenoy, Aug 15, 2008 IP
  3. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #3
    it's an entire script... don't know which part to post... whatever i try to add to the db it will only add blank rows instead information
     
    bluemouse2, Aug 15, 2008 IP
  4. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Post 20-40 lines above and below the mysql_query for the insert. We may need more later.

    Jay
     
    jayshah, Aug 15, 2008 IP
  5. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #5
    <? include "adminlogincheck.php";
    $pass=base64_encode($adminpassword);
    $sql= "update admin set login='$adminid', pass='$pass', adminname='$adminname2', adminemail='$adminemail2',title='$title2',keyword='$keywords2',description='$description2', adsense='$adsense2'";

    executeupdate($sql);
    $msg= "Details Updates";
    session_register('msg');
    header("Location: editinfo_frm.php ");
    exit;
    ?>
     
    bluemouse2, Aug 15, 2008 IP
  6. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #6
    That seems do be doing an update, not an insert. Can you confirm it's not a file being included by this one?

    Jay
     
    jayshah, Aug 15, 2008 IP
  7. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #7
    Yes, this is doing an update... but all updated fields are blank ones instead information.
    You are right.
     
    bluemouse2, Aug 15, 2008 IP
  8. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #8
    Excellent. Please add:

    var_dump($sql);
    PHP:
    above executeupdate($sql);

    Jay
     
    jayshah, Aug 15, 2008 IP
  9. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #9
    I did this and I get the following errors:

    Warning: Cannot modify header information - headers already sent by

    Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0
     
    bluemouse2, Aug 15, 2008 IP
  10. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #10
    Aside from those, you should get something like
    string (nn) "the query"
    Code (markup):
    Can you paste that line (it has the importance)?

    Jay
     
    jayshah, Aug 15, 2008 IP
  11. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #11
    string(112) "update admin set login='', pass='', adminname='', adminemail='',title='',keyword='',description='', adsense=''"

    thank you
     
    bluemouse2, Aug 15, 2008 IP
  12. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #12
    None of your variables are set, anything from $pass to $adsense2. What's the content of adminlogincheck.php, can you paste it?

    Jay
     
    jayshah, Aug 15, 2008 IP
  13. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #13
    <?session_start();

    if(!session_is_registered('loginid'))
    {
    $msg="You are not authorized to view this page";
    session_register("msg");
    header("Location: index.php ");
    exit;
    }

    require "../config.inc.php";
    require "../functions.inc.php";
    ?>
     
    bluemouse2, Aug 15, 2008 IP