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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:35:56+00:00 2026-06-13T00:35:56+00:00

I have made a php script to pull from two different tables within the

  • 0

I have made a php script to pull from two different tables within the same database. After the data is pulled, it is put into another table that will hold that specific information for later use. Right now, it will submit the userid and username but will not submit the puid variable I have stated.

Here is the script

include('data.php');

//Database Connection
$con=@mysql_connect("$ip", "$guser", "$gpass")
            or die(mysql_error());

//Select Database
$dbcon=@mysql_select_db($forums, $con)
            or die(mysql_error());

$search = $_POST['term'];

$sql = mysql_query("select userid, usergroupid, username from $users where username like '%$search%'");

while ($row = mysql_fetch_array($sql)) {
    $id = $row['userid'];
    $name = $row['username'];
    $ugid = $row['usergroupid'];
}       

if ($ugid == '21') {

    $sql4 = "INSERT INTO $vip (fuid, username) VALUES ('$id', '$name')";
    $res2 = @mysql_query($sql4, $con) or die(mysql_error());

    $sql2 = mysql_query("SELECT $id, field5 FROM $userfield");
    while ($row = mysql_fetch_array($sql2)) {
        $puid = $row['field5'];
    }

    $sql3 = "INSERT INTO $vip (puid) VALUES ('$puid')";
    $res = @mysql_query($sql3, $con) or die(mysql_error());
    echo 'Completed';
} else {
    echo 'User is not VIP'; 
}
  • 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-13T00:35:57+00:00Added an answer on June 13, 2026 at 12:35 am

    you are not doing those queries for all retrieved rows.you should get those queries inside foreach loop otherwise only the last row will be effected!

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

Sidebar

Related Questions

I have made a js function to remove data from a database using ajax.
I have ajax call which pulls from the processing script 'getajax.php'. Call is made
i have made a server using php. The server is getting new information after
I have made a subdomain and uploaded php script on that. but php code
I have made an Ajax request to a PHP script and that PHP script
I made a php script to counts the number of users have viewed my
i have a problem. I have made a PHP proxy to get json data
I have made a generic PHP script to use for an AJAX call. I
I have several divs, which are made automatically by php script. Each div have
I have a PHP script search script that logs every query made in a

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.