Jump to content

any help please


lolclol

Recommended Posts

http://cffoodtoday.com/1.php

hi I am fetching data from my database.. but I want to so the ingredients and methods are in order like <br /> is there a way to do this?

<?php
  define("_VALID_PHP", true);
  require_once("init.php");
?>   <?php include("header.php");?>


        

		        <!-- ============= CONTENT AREA STARTS HERE ============== -->

<div id="left-area" class="clearfix">
<?php $conn = mysql_connect("localhost", "user", "password!");
mysql_select_db("_recipes", $conn)
or die ('Database not found ' . mysql_error() );
$cust = $_GET["id"];
$sql = "select * from mr_recipes WHERE id='5' ";
$rs = mysql_query($sql, $conn)
or die ('Database not found ' . mysql_error() );

?>

<?php if (mysql_num_rows($rs)>0){ ?>

<?php while ($row = mysql_fetch_array($rs)) { ?>




						  <h1><?php echo $row["name"]?></h1>
              <span class="w-pet-border"></span>
              <div class="recipe-info">
                <h2><a href="#"></a></h2>
                <div class="recipe-tags"> <span class="type">Date: <?php echo $row["addDate"]?></span> <span class="cuisine">Recipe By: </span> <?php echo $row["submitted_by"]?></div>
                <p>.<br />
								
			    </p></div>
              <div class="post recipe-listing-item">
			    <div class="list-left">
			      <h3 class="blue">Ingredients </h3>

<!-- == new here == -->								    <ul><?php echo $row["ingredients"]?>

								     
							        </ul>

							      </div>

                                  <br />

                                  <h3 class="blue">Method</h3>

                                  <?php echo $row["instructions"]?>

						  </div><!-- end of recipe-listing-item div -->

						

								<div class="post recipe-listing-item"></div><!-- end of recipe-listing-item div -->

								

							<?php } ?>	      <?php }
else {?> <p>No weight with username<?php echo $username ?>
in  database.</p>
<?php } ?>    

</div><!-- end of left-area -->

				        <!-- LEFT AREA ENDS HERE -->

							

        <!-- end of content div -->

  <!-- ========== CONTENT AREA ENDS HERE ========== -->

                        

  </div><!-- end of container div -->

<div class="w-pet-border"></div>

<!-- ============= CONTAINER AREA ENDS HERE ============== -->

<?php include("footer.php");?>
Link to comment
https://forums.phpfreaks.com/topic/277603-any-help-please/
Share on other sites

Yeah if you add ORDER BY to your query.....

$sql = "select * from mr_recipes WHERE id='5' ORDER BY id DESC";

See this link for reference.

 

Also, just picking this out our your query, is your id a string or an integer? If you put '' around it you are saying that it is a string. It depends on what you saved it in your database as. Give us more information on that as well. 

Link to comment
https://forums.phpfreaks.com/topic/277603-any-help-please/#findComment-1428035
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.