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
https://forums.phpfreaks.com/topic/260864-how-can-i-position-a-image-beside-text/
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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.