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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:31:15+00:00 2026-06-17T09:31:15+00:00

Okay so I’m making php that will pull every entry from a data base

  • 0

Okay so I’m making php that will pull every entry from a data base that matches the name you put in a textbox. so here is a image of the database
https://i.stack.imgur.com/LvmrM.png < screen shot of database

So if i where to put “DigitalNuke” in the textbox and hit the submit button I want only the rows that have “DigitalNuke” as the value in the second column “referrer”

<form ACTION="" METHOD=post>
<div class="input-append">
  <input class="span2" id="youruser" type="text" name="youruser" placeholder="Your Username">
  <button class="btn btn-success" type="submit">Retrive</button>
</div>
</form>
<?php
   require_once 'connect.php';
   $name = isset($_POST['youruser']);
   $conn=  mysqli_connect ($dbhost,$dbuser,$dbpass,$dbname)or die(mysqli_error());
   $query1 = "SELECT 'id', 'referrer', 'username', 'brigade', 'faction', 'activity' FROM refmems WHERE referrer='$name";
   $result = mysqli_query($conn, $query1)
      or die('Error querying the database: ');
  echo '<table class="table table-bordered">';
  echo '<caption>Your Referred Members</caption>' . '<thead><tr><th>ID</th>' . '<th>Username</th>' . '<th>Brigade</th>' . '<th>Faction</th>' . '<th>Activity</th>' . '</tr></thead>';
      while ($row = mysqli_fetch_array($result)) {
  echo "<tr class='success'><td>" . $row['id'] . "</td><td>" . $row['username'] . "</td><td>" . $row['brigade'] . "</td><td>" . $row['faction'] . "</td><td>" . $row['activity'] ."</td></tr>";     
}
?>

So as of now it doesn’t do anything when I hit the submit button. Well it kind of works, except for instead of pulling the data from the table, it just puts id, username, brigade, faction, activity in each row of the generated table.
https://i.stack.imgur.com/XF71h.png < screen shot

Any help would be appreciated, if you need anything else let me know and i’ll post it.

  • 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-17T09:31:16+00:00Added an answer on June 17, 2026 at 9:31 am
     $query1 = "SELECT 'id', 'referrer', 'username', 'brigade', 'faction', 'activity' FROM refmems WHERE referrer='$name";
    

    should be:

     $query1 = "SELECT `id`, `referrer`, `username`, `brigade`, `faction`, `activity` FROM refmems WHERE referrer='$name'";
    

    Also learn how to use prepared statements for MySQLi. Your code is open to SQL injection.

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

Sidebar

Related Questions

Okay here's my situation. I have a php file that contains a simple form
Okay, so I've written a Macro that works fine when launched from the Workbook
Okay, next PHPExcel question. I have an HTML form that users fill out and
Okay, so I have my post.php page. If you are not logged in, you'll
okay, i'm setting up a multi-user chat system. i have a messages table, that
Okay, I'm calling a PHP using Ajax for a file upload. else if (in_array($file_extn,
Okay, I've written my first functional PHP extension. It worked but it was a
Okay I do apologise that I'm out of my depth here. I'm not the
Okay, so this is the line that's returning null. What am I doing wrong
Okay, so I'm writing a test program to send a vector of objects from

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.