Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6473305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:27:01+00:00 2026-05-25T06:27:01+00:00

I wanted to change from normal mysql query to PDO but since that time

  • 0

I wanted to change from normal mysql query to PDO but since that time I can’t even track the fault back.

Is there anyone out there to help me? Any hint would be appreciated!

Q1: what is wrong? Q2: how can the fault be tracked generally?

<?php
// Check if add button active, start this
if (isset($_POST['create'])) {
 $new=htmlspecialchars($_POST['newgroup']);
 $sql = "INSERT INTO contactgroups (status, gr_name) VALUES(1, : new )";
 $sql->bindvalue( ': new', $new);
 $sql->execute();
 $arr = $sql->errorInfo();
 echo $arr;
 echo  "<meta http-equiv=\"refresh\" content=\"0;URL=groups.php\">";
}
?>

<form id="group-in" method="post" action="groups.php">
Add new Distribution group: <input type="text" name="newgroup" placeholder="name..."> <input type="submit" name="create" value="Create new">
Rename groupname: <input type="text" value="<?php echo $result['gr_name']; ?>"> <input type="submit" name="rename" value="Rename">
</form>

the $_POST is coming, the SQL is running but after the bindPARAM/bindVALUE nothing comes…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:27:02+00:00Added an answer on May 25, 2026 at 6:27 am

    You never prepare your sql statement above.

    In order to run, you would first need to initialize the DB and create a new PDO instance. Assuming you have this done before:

    <?php
    // Check if add button active, start this
    if (isset($_POST['create'])) {
     $new=htmlspecialchars($_POST['newgroup']);
     $sql = "INSERT INTO contactgroups (status, gr_name) VALUES(1, : new )";
     $stmt = $db->prepare($sql);
     $stmt->bindvalue( ': new', $new);
     $stmt->execute();
     $arr = $stmt->errorInfo();
     echo $arr;
     echo  "<meta http-equiv=\"refresh\" content=\"0;URL=groups.php\">";
    }
    ?>
    

    You can wrap a function/code bit with a try/catch statement and enable exception handling with PDO to get better insight into errors going forward.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to change the displayed string from start to keyup or keydown but
I'm changing from IceFaces to PrimeFaces (I really wanted to change to RichFaces but
I wanted to change the resolution of a image,this image I am getting from
i 'm trying the hibernate tutorials from their main site and wanted to change
I wanted to change the divider height dynamically. From whatever I have searched it
I have a ListView inside of an Update Panel and wanted to change the
I have a JSP which has jQuery and wanted to change the action message
I'm working on a quick setup program in Visual Studio and wanted to change
I wanted to see what happened if you change the reference of an object
Complete Flash / AS Noob here. Friend wanted a change in Email address and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.