Jump to content

[SOLVED] If...Else


forumnz

Recommended Posts

Ok here is some of my script. I have just altered it so that if the row 'on' in the database 'mag' is '1' then it will echo... else it will echo...

 

Problem is, it just doesn't echo anything at all. - Yes the db is set to 1

 

Thanks a bunch!

 

<?php
// Make a MySQL Connection
mysql_connect("localhost", "photomagik", "***") or die(mysql_error());
mysql_select_db("photomagik_co_nz_-_soho") or die(mysql_error());

// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM mag WHERE id='1'") 
or die(mysql_error());  

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table


if ($on == 1)

echo "<a href=" . $row['stg2'] . "><img src=" . $row['stg1'] . " class=float /><br />
<div align=center><p>" . $row['stg3'] . " </p></div></a>";

else
echo "";

} 

?>

Link to comment
https://forums.phpfreaks.com/topic/50074-solved-ifelse/
Share on other sites

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.