Jump to content

how can i position a image beside text?


usman07

Recommended Posts

I have php code that is connected to a mysql database and the information and image show but I want to position the image on the left and the text on the right how would i do this, any help is appreciated.

 


{
    $i = 0;
    echo '<div style="font-family:helvetica; font-size:15px; padding-left:15px; padding-top:20px;">';
    while($row = mysql_fetch_array($result)) {     // Loop through results
        $i++;
        echo "Displaying record $i<br>\n";
        echo "<b>" . $row['id'] . "</b><br>\n";      // Where 'id' is the column/field title in the database
        echo $row['Location'] . "<br>\n";            // Where 'location' is the column/field title in the database
        echo $row['Property_type'] . "<br>\n";       // as above
        echo $row['Number_of_bedrooms'] . "<br>\n";  // ..
        echo $row['Purchase_type'] . "<br>\n";       // ..
        echo $row['Price_range'] . "<br>\n";         // ..
        echo '<img src="'. $row['images'] .'" />';   //image
    }

Link to comment
Share on other sites

thats amazing, it works. thank you both very much!

You're welcome.

If you want the next one to be on a new line, you'll probably want to have <br style="clear: both" /> at the very end, or if you don't have enough text it could keep floating.

Link to comment
Share on other sites

like I have the image and text beside each other but I want the text to be a little bit further away from the image, so I changed this padding left:

echo '<div style="font-family:helvetica; font-size:15px; padding-left:15px; padding-top:20px;">';

this this moved the image and the text, for some reason, I just want to move the text more to the right.

 

thanks for your help again.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.