Jump to content

I need to display an image stored in my gallery through my SQL Query on PHP


Kashmenon
Go to solution Solved by Kashmenon,

Recommended Posts

The code below is what helps me to display radio buttons on the website. The radio buttons are now in text format. The images are stored in a folder on my server. $sep_row['av_image'] displays the name of the image. but i want to display this in png format.

 

Thank you for the help in advance.

$i=1;

$avaQuery ="SELECT * FROM dd_ava_mst ORDER BY av_code_name";
$seldata_cat = $obj->selectQuery($avaQuery);
if($q==2)
{
$output .= '<b style="color: #000000;">Availability:</b>';
$output .= "<table width=\"400\" border=\"0\" >\n"; //open table tag
while($sep_row = mysql_fetch_array($seldata_cat)){

$checked = '';
if(in_array($sep_row['av_id'], $fdiva_cat_sub_array)){
$checked = 'checked="checked"';
}
if($i==1)
{
$output .= "<tr class='yl_tb'>";
}

$output .= "<td class='yl_tb' >";
$output .= '<input '.$checked.' type="radio" name="fav_id[]" value="'.$sep_row['av_id'].'" />'.$sep_row['av_image'];
$output .= "</td>\n";
if($i==3)
{
$output .= "</tr>";
$i=0;
}
$i++;
}
$output .= "</table>\n";
}

 

This is the output now

Availability: Green.png Orange.png Orange.png red.png

Link to comment
Share on other sites

Hi Barand

 

Thank you for the advice

 

I had already tried this 

 

$output .= '<input '.$checked.' type="radio"  name="fav_id[]" value="'.$sep_row['av_id'].'" />'.echo "<img src=../../images/dot/'{$sep_row['av_image']}'>"; 

 

I get this error " XMLHTTP" Internal server occured

 

Please let me know if i am doing it wrong.

 

Appreciate it

Link to comment
Share on other sites

  • Solution

Hi Barand

 

I played around with it a lot and this one worked for me

 

$output .= '<input '.$checked.' type="radio" name="fav_id[]" value="'.$sep_row['av_id'].'" /> <img src="/the foldername/'.$sep_row['av_image']. '" />';

 

Thank you so much for the input. Cheers

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.