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
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
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.