Jump to content

lolclol

Members
  • Posts

    22
  • Joined

  • Last visited

lolclol's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Am not asking you to write the code for me.. I have looked and searched and tested things all day. To a point where am struggling to know a way I can do this... I am asking for help to make me understand that there is a way I can do it but I have no idea how! So am asking for an expert to point me in the right way to make it work!
  2. Hi jessica Sorry. Hum am after doing a personal food and weight tracker. I have it all working. But then the idea of instead of it being 2 things. I wanted to merge them into one. So all the data a user inputs. Gets showen in this calendar. Am struggling to know how I would get it to show The breakfast, lunch dinner etc for the date it was posted on. Www.cffoodtoday.com/Weight.php Www.cffoodtoday.com/my_food.php Username testing Password testing1
  3. Weight and food diary. 2 input forms to insert weight and then for one to insert what they had to eat. i then wanting it to show on a calendar, <?php /** * Account * * @package Digital Downloads Pro * @author wojoscripts.com * @copyright 2010 * @version $Id: account.php, v2.00 2011-07-10 10:12:05 gewa Exp $ */ define("_VALID_PHP", true); require_once("init.php"); if (!$user->logged_in) redirect_to("login.php"); ?> <?php include("header.php");?> <!-- ============= CONTENT AREA STARTS HERE ============== --> <div id="content"> <!-- SLIDER STARTS HERE --> <div id="slider" class="slider2"> <div > </div> <h2 class="slider-head">Track your Weight</h2><br /><br /> <div id="whats-hot" > <p></p> </div> <br /><br /><br /> <!-- end of news div --><!-- end of container div --> <div class="w-pet-border"> <br /><br /> <table style='background-color:E1E1E1; color:000000;font-family: Verdana; font-size: 7pt;'><tr><td colspan='8' align='center' style='background-color:9999cc; color:000000;'><font face='Verdana' size='3' color='000'><b>May 2013</b></font></td></tr><tr><tr><td align='center' style='background-color:9999cc; color:000000;'><font face='Verdana' size='2' color='000'><b>Sun</b></font></td><td align='center' style='background-color:9999cc; color:000000;'><font face='Verdana' size='2' color='000'><b>Mon</b></font></td><td align='center' style='background-color:9999cc; color:000000;'><font face='Verdana' size='2' color='000'><b>Tue</b></font></td><td align='center' style='background-color:9999cc; color:000000;'><font face='Verdana' size='2' color='000'><b>Wed</b></font></td><td align='center' style='background-color:9999cc; color:000000;'><font face='Verdana' size='2' color='000'><b>Thu</b></font></td><td align='center' style='background-color:9999cc; color:000000;'><font face='Verdana' size='2' color='000'><b>Fri</b></font></td><td align='center' style='background-color:9999cc; color:000000;'><font face='Verdana' size='2' color='000'><b>Sat</b></font></td><td align='center' style='background-color:9999cc; color:000000;'><font face='Verdana' size='2' color='000'><b>Weekly</b></font></td></tr><td style="background-color:ccccff; color:000000; width:75;height:100"> </td><td style="background-color:ccccff; color:000000; width:75;height:100"> </td><td style="background-color:ccccff; color:000000; width:75;height:100"> </td><td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>1<br> Breakfast <br /> Lunch<br /> Tea<br /> Other<br /> Weight<br/>Creon</td><td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>2<br> <br></td><td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>3<br> <br></td><td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>4<br> <br></td><td align='left' valign='top' style='background-color:ffffcc; color:000000;' width='91' height='100'> <br><br> Creon: 0<br /> Best Weight: 0<br /> lowest Weight: 0</td></tr><tr> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>5</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>6</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>7</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>8</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>9<br> <br></td><td align='left' valign='top' style='background-color:ffffff; color:000000;' width='75' height='100'><p>10<br> </p></td><td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>11<br> <br></td><td align='left' valign='top' style='background-color:ffffcc; color:000000;' width='91' height='100'> <br><br> Creon: 0<br> Best Weight: 0<br> lowest Weight: 0<br></td></tr><tr> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>12</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>13</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>14</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>15</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>16</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>17</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>18</td><td align='left' valign='top' style='background-color:ffffcc; color:000000;' width='91' height='100'> <br><br> Creon: 0<br /> Best Weight: 0<br /> lowest Weight: 0</td></tr><tr> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>19</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>20</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>21</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>22</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>23</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>24</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='75'>25</td><td align='left' valign='top' style='background-color:ffffcc; color:000000;' width='91' height='100'> <br><br> Creon: 0<br /> Best Weight: 0<br /> lowest Weight: 0</td></tr><tr> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='93'>26</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='93'>27</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='93'>28</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='93'>29</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='93'>30</td> <td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='93'>31</td><td align='left' valign='top' style='background-color:ccccff; color:000000;' width='75' height='93'> <br><br> <br> </td><td align='left' valign='top' style='background-color:ffffcc; color:000000;' width='91' height='93'> <br> <br> Creon: 0<br /> Best Weight: 0<br /> lowest Weight: 0</td></tr></table> </div><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> Beta v2.0 <?php include("footer.php");?> this is the weight database id date day month year username weight_lb weight_kg notes email this is the my_food database id username date day month year meal content notes creon open a new page where they can see the content they added of the meals ie, breakfast, lunch etc. and to total the creon intake up from that week... if anyone could help me.. please i need to get it all working within this month. due to my article is being published in the CF Trust magazine and they want all my website to be full functional
  4. $name=$_POST['name']; $cat=$_POST[cat]; $url=$_POST[url]; so this for variables?
  5. <?php $host="localhost"; // Host name $username="user"; // Mysql username $password="Pass!"; // Mysql password $db_name="_login1"; // Database name $tbl_name="mr_recipes"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name WHERE isApproved = 'no'"; $result=mysql_query($sql); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td> <table width="400" border="1" cellspacing="0" cellpadding="3"> <tr> <td colspan="4"><strong>List data from mysql </strong> </td> </tr> <tr> <td align="center"><strong>isApproved</strong></td> <td align="center"><strong>Name</strong></td> <td align="center"><strong>Lastname</strong></td> <td align="center"><strong>Email</strong></td> <td align="center"><strong>Update</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td><? echo $rows['isApproved']; ?></td> <td><? echo $rows['name']; ?></td> <td><? echo $rows['cat']; ?></td> <td><? echo $rows['url']; ?></td> <td align="center"><a href="update.php?id=<? echo $rows['id']; ?>">update</a></td> </tr> <?php } ?> </table> </td> </tr> </table> <?php mysql_close(); ?>
  6. <?php $host="localhost"; $username="user"; $password="pass!"; $db_name="_login1"; $tbl_name="mr_recipes"; // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // update data $sql="UPDATE $tbl_name SET name='$name', url='$url', cat='$cat', isApproved='$isApproved' WHERE id='$id'"; $result=mysql_query($sql); if($result){ echo "Successful"; echo "<BR>"; echo "<a href='editrecipe.php'>View result</a>"; } else { echo "ERROR"; } ?> update_ud.php still not updating! I have gone on the isApproved, update.php <?php $host="localhost"; // Host name $username="user"; // Mysql username $password="pass!"; // Mysql password $db_name="_login1"; // Database name $tbl_name="mr_recipes"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // get value of id that sent from address bar $id=$_GET['id']; // Retrieve data from database $sql="SELECT * FROM $tbl_name WHERE id='$id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); ?> <table class="display" width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <form name="form1" method="post" action="update_ud.php"> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td> </td> <td colspan="3"><strong>Update data in mysql</strong> </td> </tr> <tr> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td align="center"><strong>url</strong></td> <td align="center"><strong>cat</strong></td> <td align="center"><strong>name</strong></td> <td align="center"><strong>isApproved</strong></td> </tr> <tr> <td> </td> <td align="center"> <input name="url" type="text" id="url" value="<? echo $rows['url']; ?>"> </td> <td align="center"> <input name="cat" type="text" id="cat" value="<? echo $rows['cat']; ?>" size="15"> </td> <td> <input name="name" type="text" id="name" value="<? echo $rows['name']; ?>" size="15"> </td> <td> <input name="isApproved" type="radio" value="yes" /></td> </tr> <tr> <td> </td> <td> <input name="id" hidden="hidden" id="id" value="<? echo $rows['id']; ?>"> </td> <td align="center"> <input type="submit" name="Submit" value="Submit"> </td> <td> </td> </tr> </table> </td> </form> </tr> </table> <?php // close connection mysql_close(); ?>
  7. <?php $host="localhost"; // Host name $username="user"; // Mysql username $password="pass!"; // Mysql password $db_name="_login1"; // Database name $tbl_name="mr_recipes"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); // Count table rows $count=mysql_num_rows($result); ?> <table class="display" width="500" border="0" cellspacing="1" cellpadding="0"> <form name="form1" method="post" action=""> <tr> <td> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>Id</strong></td> <td align="center"><strong>Name</strong></td> <td align="center"><strong>username</strong></td> <td align="center"><strong>cat</strong></td> <td align="center"><strong>url</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center"> <? $id[]=$rows['id']; ?><? echo $rows['id']; ?> </td> <td align="center"> <input name="name[]" type="text" id="name" value="<? echo $rows['name']; ?>"> </td> <td align="center"> <input name="username[]" type="text" id="username" value="<? echo $rows['username']; ?>"> </td> <td align="center"> <input name="cat[]" type="text" id="cat" value="<? echo $rows['cat']; ?>"> </td> <td align="center"> <input name="url[]" type="text" id="url" value="<? echo $rows['url']; ?>"> </td> </tr> <?php } ?> <tr> <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </td> </tr> </form> </table> <?php // Check if button name "Submit" is active, do this if($Submit){ for($i=0;$i<$count;$i++){ $sql1="UPDATE $tbl_name SET name='$name[$i]', username='$username[$i]', cat='$cat[$i]',url='$url[$i]' WHERE id='$id[$i]'"; $result1=mysql_query($sql1); } } if($result1){ header("location:editrecipe.php"); } mysql_close(); ?> find 2 codes that are simple like this one. just not doing anything. it shows fields from databases.. type in what I need to edit. then submit...but just refreshes the page with out updating the database
  8. in the mr_recipes the field are id, username, name, ingredients, methods, URL and date. when someone using add recipe. the username is hidden, date and URL the URL is set to insert recipe.php?id=1 field "id 1" is a waiting for approval. I then have to go into my database to change the ?id=1 to the right ID number. what am wanting is to make it a little easier, so I need a page where . it shows all the url set to ?id=1 and where I can change it. for this I need to echo the id and have a edit form to change the url.. I can get it to echo this but noidea about the coding to change it. any help to direct me in the right direction
  9. got it working <?php $conn = mysql_connect("localhost", "user", "pass!"); mysql_select_db("_login1", $conn) or die ('Database not found ' . mysql_error() ); $id=mysql_real_escape_string($_GET['id']); $sql = "select * from mr_recipes WHERE id = $id"; $rs = mysql_query($sql, $conn) or die ('Database not found ' . mysql_error() ); $result = mysql_query("SELECT * FROM mr_recipes"); while($row = mysql_fetch_array($result)){ $id = strtolower($row['id']); $url = "recipe.php?id=".urlencode($id); $get_result = file_get_contents($url); } ?>
  10. <?php $conn = mysql_connect("localhost", "user", "pass!"); mysql_select_db("_login1", $conn) or die ('Database not found ' . mysql_error() ); $cust = $_GET["id"]; $sql = "select * from mr_recipes WHERE id='6'"; $rs = mysql_query($sql, $conn) or die ('Database not found ' . mysql_error() ); ?> I understand that, that will show the id I want. but how do get it show it shows the id from the url?
  11. hi Jessica, just cant figure it out.
  12. I have had a full day and half of coding and playing around to getting this working. just a little stuck now. http://cffoodtoday.com/recipe.php?id=6 I know the code below is a little messy. the code is showing all the database fields. and not just the ID the url is asking for, <?php define("_VALID_PHP", true); require_once("init.php"); ?> <?php include("header.php");?> <div id="left-area" class="clearfix"> <!-- ============= CONTENT AREA STARTS HERE ============== --> <?php $conn = mysql_connect("localhost", "user", "pass!"); mysql_select_db("_login1", $conn) or die ('Database not found ' . mysql_error() ); $cust = $_GET["id"]; $sql = "select * from mr_recipes WHERE id "; $rs = mysql_query($sql, $conn) or die ('Database not found ' . mysql_error() ); $result = mysql_query("SELECT * FROM mr_recipes"); while($row = mysql_fetch_array($result)){ // Prepare gamertag for url $id = strtolower($row['id']); //echo $gamertag.'<br />'; $url = "recipe.php?id=".urlencode($id); $get_result = file_get_contents($url); } ?> <?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["date"]?></span> <span class="cuisine">Recipe By: </span> <?php echo $row["username"]?></div> <p>.<br /> Cook Time:<?php echo $row["cooktime"]?> ~ Prep Time<?php echo $row["perptime"]?> </p></div> <div class="post recipe-listing-item"> <div class="list-left"> <h3 class="blue">Ingredients </h3> <?php echo nl2br($row['ingredients']);?> </ul> </div> <br /> <h3 class="blue">Method</h3> <?php echo nl2br($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 recipes 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");?>
  13. 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");?>
  14. all fixed.. thank you so much limmin
  15. $sql = "select * from weight WHERE username = '$user->username'"; i took out the . at '$user->username' and it works for just the admin but not other users
×
×
  • 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.