1

I have a simple mysql database and am working with PHP to display results for individually selected items from a table. I can't get individual selections to show. My code is below. It seems that something is not triggering for the .$selectedbow but I don't know how to get it right. Be gentle - I'm totally new to this. Thank you!

$bowinfo = mysql_query("SELECT id, make, description 
                        FROM bowid WHERE bowid=".$selectedbow);

        //START THE WHILE LOOP 
        while ($bowdata = mysql_fetch_array($bowinfo)) {

            $id = $bowinfo["id"];
            $make = $bowinfo["make"];
            $description - $bowinfo["description"];

    echo ( "<section>
                    <p> $id</p> 
                    <p>$make</p>
                    <p>$description</p></section>
                    ");
12
  • "to display results from 3 different tables" - What three tables? blog.codinghorror.com/a-visual-explanation-of-sql-joins - You're also referencing the wrong variable. Commented Mar 20, 2015 at 1:55
  • The answer you've gotten below; does it not solve the problem you're having? Commented Mar 20, 2015 at 2:06
  • Unfortunately, no. I corrected the code and still nothing displays? confessionsofaclosethipster.com/bowdescription_detail.php Commented Mar 20, 2015 at 2:08
  • That site's not loading. It times out. Commented Mar 20, 2015 at 2:09
  • interesting......it loads fine for me. But, to describe what it does, I have the echo statement which shows the html entered, but nothing is coming in from the db. So something is still not connecting with the while loop Commented Mar 20, 2015 at 2:11

1 Answer 1

1

There is a mistake in the code within your while loop, you should be using $bowdata not $bowinfo, ie.:

$id = $bowdata["id"];
$make = $bowdata["make"];
$description = $bowdata["description"];

and to get data from multiple tables you can do SQL joins, for that I need to know other tables detail

Sign up to request clarification or add additional context in comments.

3 Comments

What detail do you need to know? I may have misspoke. I have one table I'm trying to pull this information from. The table contains an ID, Make, and Description of a bow. I really only want to display the Make and the Description of each bow individually one on its own page.
if there are not multiple tables, no problem,
gotcha. sorry :( I'm just so lost LOL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.