I have tried to echo the table fields one by one.
But I can't echo the image field.
My code is:
if ($data->Prophylaxis_Indicated == 1) {
echo "<td><span title='true_logo'> <img src='url('images/1-icon.png')' height='20' width='20'></span></td>";
} else {
echo "<td> <span title='true_logo'><img src='url('images/0-icon.png')'height='20' width='20'></span></td>";
}
this works for me
if(($data->Prophylaxis_Indicated)==1){
echo "
<td>
<span title='true_logo'>
<img src='/../images/1-icon.png' height='20' width='20'>
</span>
</td>";
}
else{
echo "<td> <span title='true_logo'>
<img src='/../images/0-icon.png' height='20' width='20'>
</span></td>";
}
i think the problem is you are trying to use blade syntax in controller.
use this code this will work
if(($data->Prophylaxis_Indicated)==1){
echo " <td><span title='true_logo'>
<img src='images/1-icon.png'
height='20' width='20'>
</span></td>";
}
else{
echo "<td> <span title='true_logo'>
<img src='images/0-icon.png'
height='20' width='20'>
</span></td>";
}
Use double underscore so it may not cz syntax error
src="url('images/0-icon.png')"
instead
src='url('images/0-icon.png')'
Related
I have some code which I want to display like this:
Posts and and the comments on those posts.
I want to echo "all the comments"; if a post has atleast one comment else echo "no comments".
Below is my code which doesnt work in terms of the if else statement and the divs. Thanks for your help.
The codes starts from the while loop.Rest works fine:
while($row=mysql_fetch_array($query)){
$fname =$row['fname'];
$sname=$row['sname'];
$id=$row['poster_id'];
$id2=$row['commenter_id'];
$email=$row['email'];
$profile_pic=$row['profile_pic'];
$city=$row['city'];
$country=$row['country'];
$search_date=$row['search_date'];
$QUERY=$row['QUERY'];
$search_id=$row['search_id'];
$comment=$row['comment'];
//-displays the result of the array
echo "<div style='border-radius: 25px; border: 1px solid #73AD21; padding: 20px; width: 90%;'> ".'<img src="'.htmlentities($row["poster_photo"], ENT_QUOTES, 'UTF-8').'" alt="Avatar" style="max-width:50px;max-height:50px;" />'." ".$row["poster_fname"]. " ".$row["poster_sname"]." around <span style='color:#04B486;'>".$row["poster_city"]." </span>in <span style='color:green;'>".$row["poster_country"]." </span> </span> on <span style='color:blue;'>".$row["search_date"]." </span><div style='margin-left:8%;'> I am looking for <span style='color:green;'>".$row["QUERY"]." </div></span> </br><span class='metoo'>            <a href='#' data-toggle='tooltip' data-placement='top' title='Click this if you also need similar assistance!'><img src='images/icons/meetoo.png' alt='me too' style='width:20px;height:20px;'></a><a href='#' data-toggle='tooltip' data-placement='top' title='Click this if you also need similar assistance!'>Me too</a>         <a href='#' data-toggle='tooltip' data-placement='top' title='Click this to direct a friend!'><img src='images/icons/advise.png' alt='advise' style='width:20px;height:20px;'></a><a href='#' data-toggle='tooltip' data-placement='top' title='Click this to direct a friend!'>Advise</a>        <a href=\"user.php?id=$id\" data-toggle='tooltip' data-placement='top' title='Click this if you will sort out this issue 100%!'><img src='images/icons/assist.png' alt='me too' style='width:15px;height:15px;'></a> <a href=\"user.php?id=$id\" data-toggle='tooltip' data-placement='top' title='Click this if you will sort out this issue 100%!'>Assist</a>           </span> </br> </br>
<?php if ($comment !== 'NULL'){
echo '<div style='margin-left:35%; font-size:80%'> <center><u style='font-size:75%;'><strong> Advises </strong> </u></center></br> ".'<img src="'.htmlentities($row["commenter_photo"], ENT_QUOTES, 'UTF-8').'" alt="Avatar" style="max-width:50px;max-height:50px;" />'." ".$row["commenter_fname"]. " ".$row["commenter_sname"]." said: <span style='color:blue;'>".$row["comment"]." </span><span style='margin-left:8%;'> on <span style='color:green;'>".$row["comment_date"]." </span></span> </br>;'
}else {
echo 'Nothing to show';
}
?>
</div>
</div>
</br>";
}
?>
Here is the proper format to concatenate in PHP
<?php
while($row=mysql_fetch_array($query))
{
$id=$row['poster_id'];
$id2=$row['commenter_id'];
echo '<div style="float:left"><img src="'.htmlentities($row["poster_photo"], ENT_QUOTES, 'UTF-8').'">';
if ($comment !== 'NULL')
{
echo '<div style="float:left"><img src="'.htmlentities($row["commenter_photo"], ENT_QUOTES, 'UTF-8').'">';
}
else
{
echo 'Nothing to show';
}
echo '</div>';
echo '</div>' ;
echo '</br>' ;
}
?>
Can you try in this below format,
<?php
while($row=mysql_fetch_array($query)){
echo "<div style='border-radius: 25px; border: 1px solid #73AD21; padding: 20px; width: 90%;'>";
echo "<a href='user.php?id=".$id."'>";
echo "<img src='".htmlentities($row["poster_photo"], ENT_QUOTES, 'UTF-8')."' alt='Avatar' style='max-width:50px;max-height:50px;' />";
...
....
...
if ($comment !== 'NULL'){
echo "<div style='margin-left:35%; font-size:80%'> <center><u style='font-size:75%;'><strong> Advises </strong> </u></center></br> ";
echo "<a href='user.php?id=".$id2."'>";
echo "<img src='".htmlentities($row["commenter_photo"], ENT_QUOTES, 'UTF-8')."' alt='Avatar' style='max-width:50px;max-height:50px;' />".$row["commenter_fname"]. " ".$row["commenter_sname"]." </a> said: <span style='color:blue;'>".$row["comment"]."</span><span style='margin-left:8%;'> on <span style='color:green;'>".$row["comment_date"]." </span></span> </br>";
}else {
echo 'Nothing to show';
}
echo "</div></div></br>";
}
?>
Hope it may help you.
Just formatted your code, but you still need to check quotes (") or ('), that they are managed properly.
echo "<div style='border-radius: 25px; border: 1px solid #73AD21; padding: 20px; width: 90%;'>
<a href=\"user.php?id=$id\">".'
<img src="'.htmlentities($row["poster_photo"], ENT_QUOTES, 'UTF-8').'" alt="Avatar" style="max-width:50px;max-height:50px;" />'." ".$row["poster_fname"]. " ".$row["poster_sname"]."
</a> around
<span style='color:#04B486;'>".$row["poster_city"]." </span>
in <span style='color:green;'>".$row["poster_country"]." </span>
on <span style='color:blue;'>".$row["search_date"]." </span>
<div style='margin-left:8%;'> I am looking for
<span style='color:green;'>".$row["QUERY"]." </span>
</div>
</br>
<span class='metoo'>           
<a href='#' data-toggle='tooltip' data-placement='top' title='Click this if you also need similar assistance!'>
<img src='images/icons/meetoo.png' alt='me too' style='width:20px;height:20px;'>
</a>
<a href='#' data-toggle='tooltip' data-placement='top' title='Click this if you also need similar assistance!'>Me too</a>
       
<a href='#' data-toggle='tooltip' data-placement='top' title='Click this to direct a friend!'>
<img src='images/icons/advise.png' alt='advise' style='width:20px;height:20px;'>
</a>
<a href='#' data-toggle='tooltip' data-placement='top' title='Click this to direct a friend!'>Advise</a>
       
<a href=\"user.php?id=$id\" data-toggle='tooltip' data-placement='top' title='Click this if you will sort out this issue 100%!'>
<img src='images/icons/assist.png' alt='me too' style='width:15px;height:15px;'>
</a>
<a href=\"user.php?id=$id\" data-toggle='tooltip' data-placement='top' title='Click this if you will sort out this issue 100%!'>Assist</a>           </span> </br> </br>"; // added after the comment
if ($comment !== 'NULL')
{
echo "<div style='margin-left:35%; font-size:80%'> <center><u style='font-size:75%;'>
<strong> Advises </strong> </u></center></br>
<a href=\"user.php?id=$id2\">".
'<img src="'.htmlentities($row["commenter_photo"], ENT_QUOTES, 'UTF-8').'" alt="Avatar" style="max-width:50px;max-height:50px;" />'." ".$row["commenter_fname"]. " ".$row["commenter_sname"]." </a> said:
<span style='color:blue;'>".$row["comment"]." </span>
<span style='margin-left:8%;'> on <span style='color:green;'>".$row["comment_date"]." </span></span> </br>";
}else {
echo 'Nothing to show';
}
?>
</div>
</div>
<?php } // issue was it was taken as html as php tags were not included
?>
if(!empty($interest)){
foreach ($interest as $key => $value) {
echo "<div style='float:left; height:130px; width:100px; margin-left:10px; border:solid #f8f8f8; background-color: #f8f8f8;'>";
echo "<a class='avatar' href='#'><img width='90' height='40' src=".$value['item_image']."></a>";
echo "<div><i>".$value['item_name']."</i></div>";
echo "<a href='#' style='text-decoration: none; outline: none;'><span class='label label-success' value=".$value['item_id']." id=".$value['item_id']." onClick='reply_click1(this.id)'>Added</span></a>";
echo " </div>";
}
}
this is my code I'm printing images horizontally here but i need to print two images per line !
this is my output .
I need two items per row
i tried to put <hr> and <br> it did not help me ! is there any way to do this?
$counter = 0;
foreach ($interest as $key => $value) {
$counter++;
if($counter%2==0){
echo '<div style="clear:both;"></div>';
}
echo "<div style='float:left; height:130px; width:100px; margin-left:10px; border:solid #f8f8f8; background-color: #f8f8f8;'>";
echo "<a class='avatar' href='#'><img width='90' height='40' src=".$value['item_image']."></a>";
echo "<div><i>".$value['item_name']."</i></div>";
echo "<a href='#' style='text-decoration: none; outline: none;'><span class='label label-success' value=".$value['item_id']." id=".$value['item_id']." onClick='reply_click1(this.id)'>Added</span></a>";
echo " </div>";
}
}
Because you have float:left css property, you must write a <br style="clear:both" />
easy way to define your div width:50% in style or use clear:both in br
I am working on a Zip Code search, and have successfully built the search. Now, I need to have the ability to click on an image map of a map, and hardcode an href to a dynamic URL
So for example, the search works well displaying contact information for a zip code in PA. But if I have an image map, I'd like the ability for it to display the same contact information if I click the image map of PA on the map image.
Here is the code I'm using to do the search, and at the bottom is the code I need help with for the image map.
<form action="search6.php" method="post">
<p><span class="orange16">Zip Code:</span>
<input type="text" name="search_name"> <input type="submit" value="Search" />
</p>
</form>
<br />
<table width="700" border="0">
<?php
if (isset($_POST['search_name'])) {
$search_name = $_POST['search_name'];
if (!empty($search_name)) {
if (strlen($search_name)>=5) {
$query = "SELECT * FROM `search4` WHERE `ZipCode` LIKE '%".mysql_real_escape_string($search_name)."%'";
$query_run = mysql_query($query);
if (mysql_num_rows($query_run)>=1) {
echo "<table width=700' border='0'>";
echo "<tr>";
echo "<td width='700' valign='top'><table width='100%' border='0'>";
echo "<tr>";
echo "<td><p><strong>Results found: </strong></p>";
while ($query_row = mysql_fetch_assoc($query_run)) {{
echo $query_row['ZipCode'].', ';
echo $query_row['ZipCity'].', ';
echo $query_row['ZipState'].'<br><br>';
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo '<span class="productdescription"><p>Office: </p></span></h2>';
echo $query_row['Office'].'<br>';
echo $query_row['Address1'].'<br>';
if(!empty($query_row['Address2'])) // This will skip if the field if it's empty
echo $query_row['Address2'].'<br>';
echo $query_row['City'].', ';
echo $query_row['State'].' ';
echo $query_row['Zip'].'<br>';
echo '<p><strong>Phone Number: </strong></p>';
echo $query_row['Phone'].'<br>';
echo '<p><strong>Fax Number: </strong></p>';
echo $query_row['Fax'].'<br><br>';
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
//BeginImage display result
$res=mysql_query("select * from Images");
{
echo "<td width='703' align='right' valign='top'>";?> <img src="<?php echo $query_row["Image"]; ?>"> <?php echo "</td>";
echo "</tr>";
}
//EndImage display result
echo ("<table width='700px' border='0' cellpadding='5' cellspacing='1'>
<tr>
<td width='13%' align='left' bgcolor='#C1DDF4'><p><strong>Service Type:</strong></p></td>
<td width='13%' align='left' bgcolor='#C1DDF4'><p><strong>Name:</strong></p></td>
<td width='13%' align='left' bgcolor='#C1DDF4'><p><strong>Phone:</strong></p></td>
<td width='13%' align='left' bgcolor='#C1DDF4'><p><strong>Email:</strong></p></td>
</tr>");
echo ("
<td align='left'><p><strong>Sales</strong></p></td>
<td align='left'><p>$query_row[SalesName]</p></td>
<td align='left'><p>$query_row[SalesPhone]</p></td>
<td align='left'><p><a href='mailto:$query_row[SalesEmail]'class='admin_links'>$query_row[SalesEmail]</p></a></td>
</tr>");
echo ("
<td align='left'><p><strong>Service</strong></p></td>
<td align='left'><p>$query_row[ServiceName]</p></td>
<td align='left'><p>$query_row[ServicePhone]</p></td>
<td align='left'><p><a href='mailto:$query_row[ServiceEmail]'class='admin_links'>$query_row[ServiceEmail]</p></a></td>
</tr>");
echo ("
<td align='left'><p><strong>Service Coordinator</strong></p></td>
<td align='left'><p>$query_row[ServiceCoorName]</p></td>
<td align='left'><p>$query_row[ServiceCoorPhone]</p></td>
<td align='left'><p><a href='mailto:$query_row[ServiceCoorEmail]'class='admin_links'>$query_row[ServiceCoorEmail]</p></a></td>
</tr>");
echo ("</table>");
}
}
}else{
echo 'No results found.';
}
}else{
echo 'Your search must be a 5-digit zip code.';
}
}
}
?>
</table>
This is the code for the Image map I need help with. I'd like to use the "CustClassID" data row for my value of lets say "23-LA".
<?php
$query = "SELECT * FROM search4 WHERE CustClassID = {$_GET['CustClassID']}";
echo ("<table width='600' border='0'>
<tr>
<td align='center'> <img src='images/greymap.png' border='0' usemap='#Map' />
<map name='Map' id='Map'>
<area shape='rect' coords='42,21,136,98' href='search6.php?CustClassID=23-LA' />
</map></td>
</tr>
</table>
");
?>
Basically, is there another way to get the same results as the search, by clicking on specific areas on the imagemap? Please point me in right direction.
I have piece of php code which I want to put as a link.
echo"<img border='1' src='$images[$i]' width='350' height='250'>";
This is what I came up with
<a href = "something"> above statement <a>
but this gives me error.
<?php echo "<a href = 'something'><img border='1' src='".$images[$i]."' width='350' height='250'></a>"; ?>
echo"<img border='1' src='$images[$i]' width='350' height='250'>";
echo "<a href="url" > <img border='1' src='".$images[$i]."' width='350' height='250'> </a>";
OR
<a href="url" > <?php echo "<img border='1' src='".$images[$i]."' width='350' height='250'>"; ?></a>
echo"
<a href='...'>
<img border='1' src='{$images[$i]}' width='350' height='250'>
</a>
";
You can use the concatenate dot operator in this way:
<?php
echo '<img border="1" width="350" height="250" src="'.$images[$i].'"'>;
?>
Why am I getting an undefined under the large photo when I click on a thumbnail here and how do I fix this? I have tried commenting out everything here to no effect? Here is the code and a URL for review:
http://tinyurl.com/6pbkhg7
<td><div id="loadarea" style="width: 400px; height: 300px;">
<img width="400" height="300" src="http://www.mydomain.com/feeds/fmfl/rets_images/<?php echo(rawurlencode($row['ListingRid'])); ?>_1.jpg" alt="<?php echo(rawurlencode($row['MLNumber'])); ?>" align="left" border="0">
</div>
<?
$image = "<br>";
$ListingRid = $row['ListingRid'];
$img_cnt = 1;
//$image .= "<img src=/feeds/fmfl/rets_images/{$ListingRid}_1.jpg alt='' width='100' height='75' border='0' /> ";
for ($c=1;$c<10;$c++) {
if ($c<10)
$c_ext = $c;
else
$c_ext = $c;
if (file_get_contents("http://www.mydomain.com/feeds/fmfl/rets_images/{$ListingRid}_{$c_ext}.jpg"))
$image .= "<img src=/feeds/fmfl/rets_images/{$ListingRid}_{$c_ext}.jpg alt='' width='100' height='75' border='0' /> ";
else
$c=12;
$img_cnt++;
if ($img_cnt == 5) {
$image .= "<br>";
$img_cnt = 0;
}
}
?>
Because you are missing the title tag
try this with title:
$image .= "<img src=/feeds/fmfl/rets_images/{$ListingRid}_{$c_ext}.jpg alt='' width='100' height='75' border='0' /> ";
or this without title:
$image .= "<img src=/feeds/fmfl/rets_images/{$ListingRid}_{$c_ext}.jpg alt='' width='100' height='75' border='0' /> ";
lightbox requires a title, you should set title="" if you don't want anything there.