Jump to content

richarro1234

Members
  • Posts

    146
  • Joined

  • Last visited

Posts posted by richarro1234

  1. Hey all,

    i have this peice of code,

    it was working fine untill i added the str_replace() command and now it doesnt work.

     

    here is the code:

     

    include("data.php");
    mysql_connect($server,$anvandare, $losen);
    mysql_select_db($databas);
    
    $txt = str_replace(";", "<br>", $_POST['newinfo']);
    
    $query = mysql_query("UPDATE recipes SET $get = $txt WHERE id = $uid");
    	header ("Location: editrecipe.php?note=1");
    die();
    }

     

    Thanks

    Rich

  2. Hey all,

     

    Just wondering.

    How do i make a query so that data is pulled out of a mysql database and on the page it only shows the first few lines of an article, like say 2 or 3 lines, then there is a "more.." link that you can click that will load up a new page and show the rest of the article?

    How do i go about doin that?

     

    Thanks

    Rich

  3. hey, i tried your code but it still doesnt show anything up on the page.

    here is the link that it is supposed to show up on.

     

    http://lilysretreat.richsprivatesite.com/recipe.php?id=1

     

    Thats the link and this is what it is supposed to show.

     

    http://lilysretreat.richsprivatesite.com/recipelist.php

     

    I added it on there just so i can show you what it is meant to show up when using id 1.

     

    I had sorted the code but i didnt read your sig so i didnt see it. i only posted it so you knew there was a syntax error (im sure you dont care that there is a syntax error, but i didnt think of that this morning either).

     

    Thanks

    Rich

  4. <?php
    require("header.php");
    
    include("data.php");
    //include("funktioner.php");
    mysql_connect($server,$anvandare, $losen);
    mysql_select_db($databas);
    $cid = $_GET['id'];
    
    $query = mysql_query("SELECT * from recipes WHERE id = '$cid'");
    while ($rec = mysql_fetch_array($query)) { 
    ?>
    <center>
    <?php =$note ?></center>
    <br>
    <div align="left">
    <table border="1" cellpadding="0" cellspacing="1" style="border-collapse: collapse" width="95%" id="AutoNumber1" bordercolor="#000000" bgcolor="#252525">
      <tr>
    <td width="95%">
    <center>
    <center>
    <div align="center">
      <center>
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#5D6765" width="75%" id="AutoNumber1" bgcolor="#131313">
        <tr>
          <td width="100%" bgcolor="#000000" align="center"><font size="2"><b>All Recipes</b></font></td>
        </tr>
        <tr>
          <td width="100%"><br>
    <div align="left">
      <center>
    <table bgcolor=333333 width=50%>
    <tr>
    <td width=50%  class=trnext>
    
              <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#252525" width="100%" id="AutoNumber12">
                <tr>
                  <td width="25%" align="center">Name: </td>
                  <td width="100%"><?php echo $rec['name']; ?></td>
                </tr>
              </table>
              <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#252525" width="100%" id="AutoNumber12">
                <tr>
                  <td width="25%" align="center">Ingrediants: </td>
                  <td width="100%"><?php echo $rec['ingrediants']; ?></td>
                </tr>
              </table>
              <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#252525" width="100%" id="AutoNumber12">
                <tr>
                  <td width="100%" align="center">Method: </td>
                </tr>
              </table>
              <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#252525" width="100%" id="AutoNumber12">
                <tr>
                  <td width="100%"><?php echo $rec['method']; ?></td>
                </tr>
              </table>
    </td>
    </tr>
    </table>
      </center>
    </div><BR><BR>
          </td>
        </tr>
      </table>
      </center>
    </div>
    <?php } ?>

     

    Hey i tried your code and to start with it came up with an error sayin "

    Parse error: syntax error, unexpected '=' in D:\wamp\www\mum\recipe.php on line 14

    "

    so i got rid of the <?php =$note ?> and that got rid of the msg, but it still didnt show up any of the results.

     

    Thanks

    Rich

  5. ... i need your help again.

     

    i have this piece of code tat is meant to get the id from the address bar and show the relevant info from the database.

     

    It works on my other pages, but it doesnt work on this one, the code has been copied over and it still doesnt work.

    it doesnt even show the empty grid where the text is meant to be.

     

    i cant find the problem maybe someone on here can.

     

    Here is the code:

     

    <? require("header.php")?>
    <?
    include("data.php");
    //include("funktioner.php");
    mysql_connect($server,$anvandare, $losen);
    mysql_select_db($databas);
    $cid = $_GET['id'];
    ?>
    <?
    $query = mysql_query("SELECT * from recipes WHERE id = $cid");
    while ($rec = mysql_fetch_array($query)) { 
    ?>
    <center>
    <?=$note?></center>
    <br>
    <div align="left">
    <table border="1" cellpadding="0" cellspacing="1" style="border-collapse: collapse" width="95%" id="AutoNumber1" bordercolor="#000000" bgcolor="#252525">
      <tr>
    <td width="95%">
    <center>
    <center>
    <div align="center">
      <center>
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#5D6765" width="75%" id="AutoNumber1" bgcolor="#131313">
        <tr>
          <td width="100%" bgcolor="#000000" align="center"><font size="2"><b>All Recipes</b></font></td>
        </tr>
        <tr>
          <td width="100%"><br>
    <div align="left">
      <center>
    <table bgcolor=333333 width=50%>
    <tr>
    <td width=50%  class=trnext>
    
              <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#252525" width="100%" id="AutoNumber12">
                <tr>
                  <td width="25%" align="center">Name: </td>
                  <td width="100%"><?=$rec['name']?></td>
                </tr>
              </table>
              <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#252525" width="100%" id="AutoNumber12">
                <tr>
                  <td width="25%" align="center">Ingrediants: </td>
                  <td width="100%"><?=$rec['ingrediants']?></td>
                </tr>
              </table>
              <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#252525" width="100%" id="AutoNumber12">
                <tr>
                  <td width="100%" align="center">Method: </td>
                </tr>
              </table>
              <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#252525" width="100%" id="AutoNumber12">
                <tr>
                  <td width="100%"><?=$rec['method']?></td>
                </tr>
              </table>
    </td>
    </tr>
    </table>
      </center>
    </div><BR><BR>
          </td>
        </tr>
      </table>
      </center>
    </div>
    <?}?>

     

    Thanks

    Rich

  6. Hey all,

    just wondering.

    how do i make a text field with multiple words init that will be saved in the database with a <BR> after each word?

     

    heres the plan:

    i need a text field where i can seperate words by a ; and when i click submit it saves it in the database with <BR>.

    OR

    have the words seperated by ; again, but then show up on the website as a list.

     

    so i could have something like:

    bananas; oranges; apples; kiwi

    and then it show on the webpage like:

    bananas

    oranges

    apples

    kiwi

    (as a list)

     

    How do i go about doin that?

    Anyone able to help me?

     

    Thanks in advanced

    Rich

  7. It was, but i just noticed another problem.

     

    Now when one is a certain percent, all the colors change to the specified color instead of just that one.

     

    I.E If i do 100% on the kitchen and then go and change todo the study and do 30% on that, then all the %'ages goto green, instead of just the kitchen.

    so kitchen should be green as its on 100% but the study should be orange as it is only 30%

     

    Any ideas?

  8. Well what it is, is theres 8 rows in the database and i need to show all of them, thats what the loop is for, so that it shows all the info in the database (its a bit like a news section where you enter it and want to show all the news posted).

     

    But it repreats the information 8 times instead of just once. i will upload it to my server and send the link so you can see exactly what i mean.

     

    Thanks

    Rich

    EDIT: here is the link http://lilysretreat.richsprivatesite.com/lobby.php

  9. Hey all,

    i have a problem with some code, what im trying to create is a color coded percentage.

    so i fill in a field in a database with a number as a %'age of what i have done.

    if its under 25% then the color is red under 50 it is orange under 75 it is yellow and 100 is green for file finished.

     

    Now, in the code i have it pull the info out from the database and show it in a list so visitors can see how the files are coming along.

    now everything was fine untill i added the code for the colors and if they were under or over a certain %'age, now it repeats the info in the database 8 times and the very last set has the right colors.

     

    so it repeats everythin 7 times and on the 8th time it has the right colors for the right %'age.

     

    Can anyone help me fix this code so that it will only show it once and not 8 times.

     

    Thanks

    Rich.

    Here is the code: P.S i have already tried limit 1.

    <link rel="stylesheet" type="text/css" href="stylenews.css">
    <?
    include('data.php');
    //include("funktioner.php");
    mysql_connect($server,$anvandare, $losen);
    mysql_select_db($databas);
    $query = mysql_query("SELECT * from todo Order by percentage");
    while ($r = mysql_fetch_array($query)) {
    ?>
    <?
    
    if ($r[$percentage] <= 25) {
    $fontcol=red;
    }
    if ($r[$percentage] >= 25) {
    $fontcol=orange;
    }
    if ($r[$percentage] >= 50) {
    $fontcol=yellow;
    }
    if ($r[$percentage] >=75) {
    $fontcol=green;
    }
    if ($r[$percentage] >=100) {
    $fontcol=green;
    } ?>
    <center>
    <?=$note?></center>
    <div align="center">
      <center>
      <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#5D6765" width="95%" id="AutoNumber1">
        <tr>
          <td width="100%"><br>
    <?
    $results= mysql_query("SELECT * FROM todo Order by percentage desc");
    $id = "id";
    $name = "name";
    $description = "description";
    $left_to_do = "left to do";
    $percentage = "percentage";
    
    echo mysql_error();
    
    if (mysql_Numrows($results)>0)                            //if there are records in the fields
    {
      $numrows=mysql_NumRows($results);                       //count them
      $x=0;
      while ($x<$numrows){   //loop through the records
    
        $theid=mysql_result($results,$x,$id);
        $thename=mysql_result($results,$x,$name);
        $thedescription=mysql_result($results,$x,$description);
        $theltd=mysql_result($results,$x,$left_to_do);
        $thepercentage=mysql_result($results,$x,$percentage);
        
    ?>
    <table width="100%">
        <tr>
            <th class="subcat" width="60%">
                <font size="3"><?=$thename?>:</font>
    
            </th>
            <th class="subcat">
                <font size="2">Done so far: <font color="<?=$fontcol?>"><?=$thepercentage?>%</font>
            </th>
        </tr>
        <tr>
            <td colspan="2" class="row2">
            Design Page.<BR>
    
                <?=$theltd?></td>
        </tr>
    </table>
    <BR>
    <?
        $x++;
      }
    } else {
    ?>
    <center><b>There is nothing left to do !</b></center>
    <br>
    <?
    }
    ?>
          </td>
        </tr>
      </table>
      </center>
    </div>
    <?}?>

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