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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:40:56+00:00 2026-05-13T16:40:56+00:00

Ok, I don’t use php often enough to remember it when I wander back

  • 0

Ok, I don’t use php often enough to remember it when I wander back into it. I’m going a bit crazy with this one. I’ll post the code below but a few quick explanations. con.php is a php file that creates the database connection $wkHook. There is no issue at all with the connection, so that is not my problem. Basically, I am selecting data from one table, storing it, and then looping through it. In that loop I am trying to insert the data into another table. You will notice that I am echoing $mid in the loop, this is to let me know that the loop itself is working. And it is working. When I loop through every value for $mid is echoed. The query inside the loop, however, is doing nothing. It doesn’t even have the decency to throw an error. It just runs through and the loop as if the query wasn’t there.

require('con.php');
$runonce=$wkHook->prepare("select moveId, Max, Hev, Work, Split, Rps from Movement order by movementId asc");
          $runonce->execute();
          $runonce->store_result();
          $runonce->bind_result($mid, $max, $hev, $wrk, $spt, $rps);
$user=1;

while($runonce->fetch())
{
    echo $mid."<br>";
    $runup=$wkHook->prepare("insert into Entry
(userId, movementId, Max, Hev, Work, Split, Rps)
values
(?, ?, ?, ?, ?, ?, ?)");
    $runup->bind_param('iisssss', $user, $mid, $max, $hev, $wrk, $spt, $rps);
    $runup->execute();
}
$runup->close();
$runonce->close();
$wkHook->close();
  • 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-13T16:40:56+00:00Added an answer on May 13, 2026 at 4:40 pm

    You seem to be initializing your database connection over and over again. Try removing the second, inner require('con.php').

    MySQL errors aren’t going to be spit out to the browser by default, you need to call the mysql_error() or mysqli_error functions to see what went wrong if anything. Add this after your execute call in your loop to see if errors are being reported:

    echo mysqli_error() . '<br />';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't ask me why but i can't use this method because I need to
Don't dismiss this as a newbie question! It's not, I'm not, I've tried everything,
I don't know why, but this code worked for me a month ago... maybe
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if this has been asked before, so point me to another question
Don't think that I'm mad, I understand how php works! That being said. I
Don't know if anyone can help me with this or if it's even possible.
Don't be afraid to use any technical jargon or low-level explanations for things, please.
Don't know whats exactly going on, but it's definitely killing my time for nothing.
I don't know: if this works. if it's a good idea. what it is

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.