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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:44:57+00:00 2026-06-09T00:44:57+00:00

I’m building a website to learn coding. I have a claim.php which is a

  • 0

I’m building a website to learn coding. I have a claim.php which is a claim your business page (its just a place that you can search for a business and then click a link to addclaimedbiz.php) and a addclaimedbiz.php page which adds the claimed business to the database.

First of all, heres my sql code for the user where the business id will be added to the row biz:

`id` int(15) NOT NULL AUTO_INCREMENT,
`firstname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
`email` varchar(75) NOT NULL,
`password` varchar(50) NOT NULL,
`biz` int(1) NOT NULL,
`verifiedbiz` int(1) NOT NULL,

and heres my sql code for the businesses:

`id` int(15) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`phone` varchar(14) NOT NULL,
`claimed` int(1) NOT NULL,

Now heres the code for claim.php that sends the company id to addclaimedbiz.php. ( I only posted a little but can post more if you need it!)

 while($row = mysql_fetch_array($result))
            {
            $id=$row['id'];
            $company_name=$row['name'];
            $company_phone=$row['phone'];
            $company_address=$row['address'];
            $address2=$row['address2'];
            $company_city=$row['city'];
            $company_zip=$row['zipcode'];
            $cat1=$row['cat1'];
            $cat2=$row['cat2'];
            $cat3=$row['cat3'];
            $subcat1=$row['subcat1'];
            $subcat2=$row['subcat2'];
            $subcat3=$row['subcat3'];
            $claimed=$row['claimed'];
            //Start While Loop
            echo"
            <div class='listing'>
                                    <li>
                                        <span class='bphone'>$company_phone</span>
                                        <span class='bname'>$company_name</span>
                                        <br/>
                                        <div class='blocation'>$company_address, $company_city, CO $company_zip ";if($address2 != ""){echo"(".$address2.")";}echo"</div>
                                        <br/>
                                        ";if($claimed != 1){echo "<a href='addclaimedbiz.php?id=".$id."'><button>Claim Business</button></a>";}else{echo "Already Claimed";}echo"
                                    </li>

                                <!--/Listing-->

                </div>";

            }

And then heres my code for addclaimedbiz.php:

 <?
 $biz_id = $_REQUEST['id'];

 //This next select from db is to take the id of the company and get the name for the corresponding id

 include("./config.php");
 $result = mysql_query("SELECT * FROM company WHERE id = '$biz_id'") or die(mysql_error());
 while($row = mysql_fetch_array($result))
 {
    $business_name = $row['name'];
 }

 ?>

and then to echo out $business_name i use (this is on addclaimedbiz.php as well just down the page a bit)

<?php if($biz == "0"){

            echo "You are claiming:"$business_name " as your business";

            }
            else{"You are already have a claimed business"}
            ?>

What should be happening is it should echo out You are claiming: $business_name as your business but right now its leaving out $business_name. Why is this?

Major thanks to all help!

Oh and I left out some of the rows in my databases that were unnecessary to the problem I thought, but if you need them I can definitely post!


EDIT


my new code looks like this:

<?
error_reporting(E_ALL);
$auth = $_COOKIE["auth"];
if ($auth != "1"){
header("Location: ./signin.php");
}
$firstname = $_COOKIE['firstname'];
$id = $_COOKIE['id'];
$fname = ucwords($_COOKIE['firstname']);
$lname = ucwords($_COOKIE['lastname']);
$email = $_COOKIE['email'];
$city = ucwords($_COOKIE['city']);
$biz = ucwords($_COOKIE['biz']);

$biz_id = $_REQUEST['id'];

include("./config.php");
$result = mysql_query("SELECT * FROM company WHERE id = '$biz_id'") or die(mysql_error());
if(mysql_num_rows($result)){
    while($row = mysql_fetch_assoc($result)){
        $business_name = $row['name'];
    }
}
echo count($result);
?>
  • 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-09T00:44:58+00:00Added an answer on June 9, 2026 at 12:44 am

    You’re not using proper variable interpolation in your string, put $business_name inside the qutoes:

    echo "You are claiming:$business_name as your business";
    

    Ah, also looks like you want mysql_fetch_assoc, not mysql_fetch_array:

    while($row = mysql_fetch_assoc($result)){
        $business_name = $row['name'];
    }
    

    Docs here.

    Hmmm…I have a hunch, try wrapping your while block with:

    if(mysql_num_rows($result)){
       ...   
    }
    

    I’ll let someone else do the lecturing on the mysql_* functions. 🙂

    Cheers

    • 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&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have a text area in my form which accepts all possible characters from
I'm trying to select an H1 element which is the second-child in its group
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.