mysql - PHP If else statement that a database record is empty it will display a default picture -


Hi Basically I am trying to create a simple IF statement which shows a default image if someone entered me Databases have not been done. I am using the server to store a database to store my image and file name, so I can display the image if it gets the name of a file in the DB, but I want to If the statement displays the empty display it shows the image. I have some code that I have tried but does not work on any idea?

Cheers.

So far the code:

  // retrieves data from MySQL $ data = mysql_query ("SELECT * d to *****") or die ( Mysql_error ()); // puts it in an array ($ info = mysql_fetch_array ($ data)) {? & Gt; & Lt; Div class = "subscriber" & gt; & Lt; Div class = "imageSection" & gt; By & lt;? If ($ info ['photo'] == '') {echo ". [Info] ['Photo']. " & Gt; "?}? & Gt; & lt; / div> & lt; div class =" memberInfo "& gt; K & lt;? Echo" & lt; P & gt; & Lt; Strong & gt; Name: "$ info ['nameMember']." & Lt; / Strong> & Lt; / P & gt; "; Echo" & lt; P & gt; Status: "$ info [bandMember ']." & Lt; / P & gt; "; Echo" & lt; P & gt; About the band member ". $ Info ['nameMember'].": ". $ Info ['aboutMember']" & lt; / P & gt; "; Echo" & lt; P & gt; Other bands: ". Info ['Other Band']" & Lt; / P & gt; & Lt; Br / & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Br class = \ "clear \" /> ";}? & Gt;  

About a simple:

  $ photo = ($ info ['photo'] == tap)? "Default.jpg": $ info ['photo']; echo "& Lt; Img class = \ "memberImage \" src = images / ". $ Photo." & Gt;  

Comments