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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:57:50+00:00 2026-06-13T17:57:50+00:00

I am just starting to use html, php, and mysql. I’ve successfully logged into

  • 0

I am just starting to use html, php, and mysql. I’ve successfully logged into my database using php, and formed a query. I now want to go a step further and show a picture instead of just strings or numbers.

The variable ‘result’ will be returning a string that has a url to an image i want to display on this webpage. How would I do this?

<html>
<head>
<title>My First Question</title>
</head>
<body>

<?php

$dbhost = 'someURL.com';
$dbname = 'user';
$dbuser = 'user';
$dbpass = 'password';

$mysql_handle = mysql_connect($dbhost, $dbuser, $dbpass)
    or die("Error Connecting To Database Server");

mysql_select_db($dbname, $mysql_handle)
    or die("Error selecting database: $dbname");

echo 'Successfully connected to database!';

$first = 'bobbie';

$query = sprintf("SELECT image FROM Player 
    p WHERE name='%s'", mysql_real_escape_string($first));

$result = mysql_query($query);

mysql_close($mysql_handle);     

?>

</body>
</html>
  • 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-13T17:57:52+00:00Added an answer on June 13, 2026 at 5:57 pm

    Inside PHP, This will turn your SQL response into a usable variable.

    $result = mysql_fetch_assoc(mysql_query($query));
    

    Outside of your PHP tags, Echo the URL from the table into the SRC of an IMG element.

    <img src="<?= $result['url_column_name'] ?>"/>
    

    This will create a new IMG element with the source being the URL that you have fetched from your SQL query.

    Short tags are also a way of echoing PHP variables in HTML.

    <?= $var1, $var2 ?>
    

    is the equivalent of using

    <?php echo $var; echo $var2; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started to use PHP Simple HTML DOM Parser . Now I'm trying
Or the concepts/best practices used there are now deprecated? I'm just starting to use
I am just now starting to use version control and my head is spinning!
I'm just starting to use QUnit and having issues. I'm currently using TypeScript, which
Hey guys, I'm just starting out with MySQL and PHP and have a question.
I've done some Python but have just now starting to use Ruby I could
Tech used: MySQL 5.1 and PHP 5.3 I am just designing a new database
I'm just starting to use Hibernate and I was wondering how to insert a
I am just starting to use Wix and would like to use heat to
i'm just starting to use asp.net mvc.. since i'm not familiar with it, i

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.