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

  • SEARCH
  • Home
  • 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 9222359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:49:18+00:00 2026-06-18T03:49:18+00:00

$UniqueID = rand(5400, 40000); $InsertQuery = $c->prepare(INSERT INTO dbo.Users_Master ( UserUID, UserID, Pw, JoinDate,

  • 0
$UniqueID = rand(5400, 40000);
$InsertQuery = $c->prepare("INSERT INTO dbo.Users_Master ( 
UserUID, UserID, Pw, JoinDate, Admin, AdminLevel, UseQueue, Status, Leave, UserType, Point)
VALUES (:UserUID, :UserID, :Pw, :Date, :Admin, :AdminLevel, :UseQue, :Status, :Leave, :UserType, :Point)");
$Param = array ($UniqueID, $_POST['Username'], $_POST['Password'], '2013-21-10', 'False', '0', 'False', '0', '0', 'P', '0');
$InsertQuery->execute($Param);

Hello. My above code does have the correct column names/table name for my database, but my insert is not working? Can anyone see why?


I have went over this query like 10 times, trying to spot the mistake but I just cant try it. I have tried binding the params the traditional way:

$InsertQuery->bindParam(':UserUID', $UniqueID, PDO::PARAM_INT);
$InsertQuery->bindParam(':UserID', $_POST['Username'], PDO::PARAM_STR);
$InsertQuery->bindParam(':Pw', $_POST['Password'], PDO::PARAM_STR);
$InsertQuery->bindParam(':Date', '2013-21-10', PDO::PARAM_STR);
$InsertQuery->bindParam(':Admin', 'False', PDO::PARAM_STR);
$InsertQuery->bindParam(':AdminLevel', '0', PDO::PARAM_INT);
$InsertQuery->bindParam(':UseQue', '0', PDO::PARAM_INT);
$InsertQuery->bindParam(':Status', '0', PDO::PARAM_INT);
$InsertQuery->bindParam(':Leave', '0', PDO::PARAM_INT);
$InsertQuery->bindParam(':UserType', 'P', PDO::PARAM_STR);
$InsertQuery->bindParam(':Point', '0', PDO::PARAM_INT);

This proven no luck either.

  • 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-06-18T03:49:19+00:00Added an answer on June 18, 2026 at 3:49 am

    “trying to spot the mistake” is extremely inefficient way to spot a mistake.
    A programmer have to ask their program to do so.

    IN case with PDO issues one have to tell PDO to raise an error on error:

    $c->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
    

    have to be set right after connect, or even better – as a connect option.
    it will retell you whatever error occurred in database – so, you will know, what’s going wrong.

    There are also some issues with your code

    1. Never call a random number an unique. Make this field auto_increment PRIMARY KEY instead and let database keep uniqueness for you.
    2. Do not bind constants. that’s just boring.
    3. Shorten your code. But reasonably: long line doesn’t make your code shorter

    so

    $sql = "INSERT INTO Users_Master VALUES (NULL,?,?,curdate(),'False',0,0,0,0,'P',0)";
    $stmt = $c->prepare($sql);
    $stmt->execute(array($_POST['Username'], $_POST['Password']));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query INSERT INTO asterisk.llamadas ( uniqueid, fecha, origen, destino, tipo, fechaInicioCola,
The UniqueID of a control is delemited with the '$', is it possble that
I know ClientID is used for javascript and UniqueId for server side and that
If I have a wcf rest service such as http://somedomain.com/service.svc/uniqueid/somemethod/parameter1 then is there a
I have array of select tag. <select id='uniqueID' name=status> <option value=1>Present</option> <option value=2>Absent</option> </select>
I have a MySQL database with the following structure: Table1 UniqueID (int) (PrimaryKey &
I like to know how to get the ClientID/UniqueID of a control inside a
So the db structure looks like this tablename(uniqueid, categoryname, categoryid) I want to be
I have a tbl, for example: uniqueId | col1 | col2 | col3 u1
Quick question. I want to generate code with SPMetal that includes the UniqueId field

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.