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 7521843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:20:49+00:00 2026-05-30T02:20:49+00:00

I’ve looked around here but can’t seem to find an answer to my problem.

  • 0

I’ve looked around here but can’t seem to find an answer to my problem.

This is the first time I’ve used PDO and so am a complete newbie to it.

I have a load of data split into 2 tables and want to merge them into one, there are other ways of doing this, but without going into the complicated reasons why I am trying to do it this way…

I generate a recordset of the table I want to copy data from

construct my statement

run it in a loop

but I get the following error

SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match the number of tokens

I’ve gone through and triple checked I have the same amount of variables so why “tokens don’t match I dont know” like I said am very new to this so am probably missing something the pros would consider as obvious.

  • It’s probably worth mentioning that I am not adding to every single column in the table, there are other columns but I have left them out of the prepared statement…
    Heres my code:

    //$dbh = new PDO($hostname_Seriously,  $DB_USER, $DB_PASSWORD);
    $dbh = new PDO('mysql:host=localhost;dbname=seriouslysoulful_summers', $username_Seriously, $password_Seriously);
    $stmt = $dbh->prepare("INSERT INTO records_rec (oldid_rec, firstname_rec, artist_rec, aside_rec, bside_rec, label_rec, condition_rec, genere_rec, price_rec, collection_rec, active_rec, info_rec, notes_rec, order_rec, alabelimage_rec, blabelimage_rec, asound_rec, bsound_rec, featured_rec, format_rec) 
    VALUES (:oldid_rec, :firstname_rec, :artist_rec, :aside_rec, :bside_rec, :label_rec, :condition_rec, :genere_rec, :price_rec, :collection_rec, :active_rec, :info_rec, :notes_rec, :order_rec, :alabelimage_rec, :blabelimage_rec, asound_rec, bsound_rec, :featured_rec, :format_rec)");
    $stmt->bindParam(':oldid_rec', $id);
    $stmt->bindParam(':firstname_rec', $firstname);
    $stmt->bindParam(':artist_rec', $artist);
    $stmt->bindParam(':aside_rec',$aside);
    $stmt->bindParam(':bside_rec',$bside);
    $stmt->bindParam(':label_rec',$label);
    $stmt->bindParam(':condition_rec',$condition);
    $stmt->bindParam(':genere_rec',$genere);
    $stmt->bindParam(':price_rec',$price);
    $stmt->bindParam(':collection_rec',$collection);
    $stmt->bindParam(':active_rec',$active);
    $stmt->bindParam(':info_rec',$info);
    $stmt->bindParam(':notes_rec',$notes);
    $stmt->bindParam(':order_rec',$order);
    $stmt->bindParam(':alabelimage_rec',$alabel);
    $stmt->bindParam(':blabelimage_rec',$blabel);
    $stmt->bindParam(':asound_rec',$asound);
    $stmt->bindParam(':bsound_rec',$bsound);
    $stmt->bindParam(':featured_rec',$featured);
    $stmt->bindParam(':format_rec',$format);
    $reccount = 0;
    //do{
    $id = $row_rs_original['id_prod'];
    $firstname = 
    mysql_real_escape_string($row_rs_original['firstname_prod']);
    $artist = mysql_real_escape_string($row_rs_original['artist_prod']);
    $aside = mysql_real_escape_string($row_rs_original['a_side_prod']);
    $bside = mysql_real_escape_string($row_rs_original['b_side_prod']);
    $label = mysql_real_escape_string($row_rs_original['label_prod']);
    $condition = mysql_real_escape_string($row_rs_original['condition_prod']);
    $genere = $row_rs_original['genre_prod'];
    $price = $row_rs_original['price_prod'];
    $collection = mysql_real_escape_string($row_rs_original['collection_prod']);
    $active = $row_rs_original['active_prod'];
    $info = mysql_real_escape_string($row_rs_original['info_prod']);
    $notes = mysql_real_escape_string($row_rs_original['notes_prod']);
    $order = $row_rs_original['order_prod'];
    $alabel = mysql_real_escape_string($row_rs_original['labelimage_A_prod']);
    $blabel = mysql_real_escape_string($row_rs_original['labelimage_B_prod']);
    $asound = mysql_real_escape_string($row_rs_original['soundfile_A_prod']);
    $bsound = mysql_real_escape_string($row_rs_original['soundfile_B_prod']);
    $featured = $row_rs_original['featured_prod'];
    $format = $row_rs_original['format_prod'];
    
    $stmt->execute();
    
        $reccount = $reccount +1;
    //} while ($row_rs_original = mysql_fetch_assoc($rs_original));
    echo($reccount." - records added...");
    
  • 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-30T02:20:51+00:00Added an answer on May 30, 2026 at 2:20 am

    Missing colons

    :blabelimage_rec, **:**asound_rec, **:**bsound_rec, :featured_rec, :format_rec
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

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.