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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:51:51+00:00 2026-06-13T13:51:51+00:00

I am trying to get the row queried in preceding code to echo inside

  • 0

I am trying to get the row queried in preceding code to echo inside of this if conditional if the user clicks the modify video link. However, when I echo the $video variable directly above the if ($videoEdit) { conditional, it displays on page, but if I try to echo it inside the if ($videoEdit) { conditional, it will not output for some reason. I’m confused. Here is my code (query not included, but echo $video does output proper results before conditional)

Addition:::

require ('../mysql_connect.php'); // Connect to DB

    // Handle Video Edit
   if ($_GET['video'] == "EDIT") {

$videoEdit = TRUE;

   }

    $query = "SELECT inventory.inv_key, inventory.mdl_key, inventory.serial, inventory.date_aquired, inventory.location, inventory.price, model.mdl_key, model.man_key, model.cls_key, model.sub_cls_key, model.model, model.video, model.picture, model.pdf, subclass.sub_cls_key, subclass.subclass, class.cls_key, class.class, manufacturer.man_key, manufacturer.manufacturer FROM inventory, manufacturer, model, class, subclass WHERE inventory.mdl_key='$_GET[mdl_key]' AND model.mdl_key='$_GET[mdl_key]' AND class.cls_key='$_GET[cls_key]' AND subclass.sub_cls_key='$_GET[sub_cls_key]' AND manufacturer.man_key='$_GET[man_key]' AND manufacturer=manufacturer.manufacturer AND class=class.class AND subclass=subclass.subclass";
$result = @mysql_query ($query); // Run the query

while ($row = mysql_fetch_array 
($result, MYSQL_ASSOC)) {
$model = $row['model'];
$mdl_key = $row['mdl_key'];
$video = $row['video'];
$picture = $row['picture'];
$pdf = $row['pdf'];
$description = $row['description'];
$manufacturer = $row['manufacturer'];
$man_key = $row['man_key'];
}

Addition Above::::

if ($_GET['video'] == 'EDIT') { 
$videoEdit = TRUE; 
}

while ($row = mysql_fetch_array($result)) {
$video = $row['video'];
}

if ($videoEdit) { // <-- boolean comparison
echo '<form action="edit_media.php" method="post">
<p>Video Link: <input type="text" name="serial" size="25" maxlength="100" value=';
       if (isset($video))
            echo $video;
        }
            echo ' /></p><p><input type="submit" name="submit" value="Submit Video" /></p>               <input type="hidden" name="submitted" value="TRUE" />
        </form>';
}

Addition:: this is, in my code, directly below the above code

if ($video != "") {
    echo '<iframe width="420" height="315" src=' . $video . ' frameborder="0" allowfullscreen></iframe> | <a href=edit_media.php?video=EDIT&mdl_key=' . $mdl_key . '&man_key=' . $man_key . '>Modify Video Link</a>';
} else {
    echo "Video Not Present | <a href=edit_media.php?video=EDIT>Add a Video</a>";
}
  • 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-13T13:51:52+00:00Added an answer on June 13, 2026 at 1:51 pm

    Most likely, $video is not set.

    You should try to echo $video; after the while loop. Also, you should not be using a loop unless if you’re only fetching a single result.

    $row = mysql_fetch_array($result);
    $video = $row['video'];
    echo $video;
    

    Update

    Here’s how I would approach your problem (obviously replacing mysql_ functions):

    if ($_GET['video'] == 'EDIT') { 
        $result = mysql_query("SELECT ... ");
        $row = mysql_fetch_array($result);
        $video = $row['video'];
    
        echo '<form action="edit_media.php" method="post">
        <p>Video Link: <input type="text" name="serial" size="25" maxlength="100" value='";
        if (isset($video)) {
            echo $video;
        }
    
        echo '" /></p><p><input type="submit" name="submit" value="Submit Video" /></p>               <input type="hidden" name="submitted" value="TRUE" />
                </form>';
        }
    
    }
    

    Also noticed that you were missing the open curly bracket ({), and double quotes around the value of $video in the HTML.

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

Sidebar

Related Questions

I am trying to get columns inside row. But I only want to get
Ok, so I am trying to insert a dynamical data inside a row. This
Hi I am trying to execute a query to get row between certain number
I am trying to get a new dynamically created row to add to a
I am trying to get all the prime(row) numbered records from my table.Can someone
I'm trying to get the value for row and col with the following function:
I am trying to get the values from an HTML table row. When I
I'm trying to get the top N records for each unique row of data
I'm trying to get distinct id's out of a 6 million row table. The
I'm trying to get fastercsv setup so that rather than parsing each row, it

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.