Jump to content

t.bo

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Posts posted by t.bo

  1. Hi everybody,

    I want to get the month, year and date out of my complete date (when enterred).

    Code : [code]<?
    $dat = 2006-07-24;

    $year = substr($dat,0,2);
    $month = substr($dat,3,2);
    $day = substr($dat,6,2);

    echo "year is $year<br>";
    echo "month is $month<br>";
    echo "day is $day<br>"

    ?>
    [/code]

    It displays incorrect numbers.
    What im I doing wrong?

    Grtz and thanks in advance
  2. Hello all,

    I'm working with coppermine quite a while now but I have a problem. I need to delete buttons in the top menu like "favorites" "most watched" stuff like that. Does anyone know where to find the php code to delete these links?

    Thanks in advance

    grtz T.bo
  3. Hello everybody,

    I have a lot of text and links set in my database. Now i've seen that there's an error in all the links and all the same error. I need to edit them but if im gonna edit every link seperatly its gonna take me a lot of time.

    How can i edit database content really fast. I need something like the Find and replace function in dreamweaver.

    Could I enter phpmyadmin and use update tablename SET ...    ?
    The links are not in a separate field but together with text in one big content field.
    Greetz and thanks in advance
  4. hello everybody,

    Im currently making an agenda with events, date of the event, and an URL of the event.
    It should output the current month as a title with its events first and then the next months up to 5 months ahead.
    Im having trouble ordering by month and current month and the date.

    Code [code]<table width="100%"  border="1" cellspacing="0" cellpadding="0">

    <?php
    include('dbconnect.php');
    $sql = mysql_query("select * from agenda order by monthfield") or die(mysql_error());

    $prevCat='';
    while($row = mysql_fetch_array($sql))
    {
    $event = $row["eventfield"];
    $id = $row["idfield"];
    $url = $row["urlfield"];
    $date = $row["date"];
    $month = $row["monthfield"];

    // has category changed ?
    // if so, print it
    if ($month != $prevCat)  {
    echo "<tr><td><h2>$month</h2></td></tr>";
    }
    echo  "<tr><td><a href='$url'>$event</a></td>";
    echo  "<td>$date<td></tr>";
    $prevCat = $month;
    }
    ?>
    </table>[/code]

    Hope someone can help.
    Thanks in advance
  5. Still no change [url=http://www.euroclinix.com/affildelete.php]http://www.euroclinix.com/affildelete.php[/url]

    I'm really clueless on this one.
    But i uploaded other php files and one had this code : [code]<?
    include('dbconnect.php');
    $id = $_GET[id];
    $sql = mysql_query("SELECT * FROM yourtable WHERE idfield='$id'") or die(mysql_error());
    $r=mysql_fetch_array($sql);
    $content = mysql_result($sql, 0 ,"content");
    echo "$content";
    ?>

    [/code]

    And I got the error "Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 4 in /home/euroclin/public_html/page.php on line 6"
    I did not get this error when I tested it on my localhost.

    Could the 2 errors have something to do with each other?

    grtz
  6. [code]<?
    $username = "euroclin"; //put your mysql username
    $password = "passwurd"; //put your mysql password
    $host = "localhost"; //put your mysql host usually localhost
    $database = "euroclin_01"; //put your mysql


    //Do not change these lines below
    mysql_connect($host,$username,$password) or die("Error connecting to Database! " . mysql_error());
    mysql_select_db($database) or die("Cannot select database! " . mysql_error());
    ?>[/code]

    I doubt its the dbconnect cuz everything else that uses it works fine...
  7. Hello everybody,

    A few days ago I already asked a question about deleting rows. The code works perfect on my localhost but when I upload it (and make all the changes) the code does not delete a row. There is not even an error message. The list of links just stay visible with no links deleted.
    Code : [code]
    <?
    include('dbconnect.php');

    if(!isset($cmd))
    {

      $result = mysql_query("select * from `affiliate`") or die(mysql_error());
     

      while($r=mysql_fetch_array($result))
      {

          $title=$r["titlefield"];
          $id=$r["idfield"];
       

          echo "<a href='affildelete.php?cmd=delete&idfield=$id'>$title - Delete</a>";
          echo "<br>";
        }
    }
    ?>
    <?
    $id = $_GET['idfield'];
    if($cmd=="delete")
    {
        $sql = "DELETE FROM `affiliate` WHERE idfield='$id'";
        $result = mysql_query($sql) or die(mysql_error());
        echo "Link verwijderd!";
    }
    ?>
    [/code]

    Hope someone can help out
    Thanks in advance
  8. Hi all...

    I just tried my first code using sessions but there is something wrong. I always get "Your login is wrong" while I enter the correct username and pw. The username is correctly inputted though...

    Here is the code Login.htm:
    [code]<form action="login.php" method="post">
    <b>Username</b>:<input type="text" name="username" size="20"><br>
    <b>Password</b>:<input type="password" name="pw" size="20"><br>
    <input type="submit" value="Login"></form>[/code]

    Login.php:
    [code]<?php
    session_start();
    include('dbconnect.php');
    $username = $_GET[username];
    $pw = $_GET[pw];
    $q="SELECT * FROM `login` WHERE ((username='$username') AND (pw='$pw'))";
    $result= mysql_query($q) or die ("Could not execute query : $q." . mysql_error());

    if (mysql_num_rows($result) == 0)
    {
    echo "<div align=center><b>Your login is wrong. Please click back and try again.</b></div>";
    }
    else
    {
    $r=mysql_fetch_array($result);
    $login_username=$r["username"];
    session_register("login_username");
    Header("Location: protected.php");
    }
    ?>[/code]

    and finally protected.php
    [code]<?php
    session_start();
    if ($_SESSION["login_username"]=="") {
    Header("Location: login.htm");
    } else {

    echo "U r logged in...";
    }

    ?>[/code]

    Hope someone can help me out...
    Grtz and thanks in advance
  9. But then category is displayed after every product and I really should have a category title....

    Someone told me to make a table with all the categories, and a table with the products that contains a field "categoryID". And then i should make the 2 tables correspond and create the output that I wanted. But I don't know how to do that...
  10. Hello all,

    Im making a dynamic price list. Each product has its own title, price and category. Loading these in a database is no problem but I have a problem in making a correct display. The display should be as follows :
    The first category is displayed as a title and below you can see the products with their price who belong to that category. Below the next category is displayed as a title with all the products of that category and so forth.

    An example of the static price list (and the way it should be displayed) can be viewed at [url=http://www.euroclinix.com/index2.php?content=prijslijst]http://www.euroclinix.com/index2.php?content=prijslijst[/url].

    The current output code (but far from finished) is [code]
    <?
    include('dbconnect.php');
    $sql = mysql_query("select * from pricelist");
    while($row = mysql_fetch_array($sql))
    {
    $title = $row["titlefield"];
    $id = $row["idfield"];
    $price = $row["pricefield"];
    $categorie = $row["catfield"]:
    echo "<h2>$categorie</h2>";
    }
    ?>[/code]

    Now every categorie is just displayed multiple times (of course). So each category should be displayed once as a title with the corresponding products below it.

    Hope somebody can help me out.
    Thanks in advance.
  11. My input and output code works perfect... But now the DELETE code :

    [code]<?
    include('dbconnect.php');

    if(!isset($cmd))
    {

      $result = mysql_query("select * from yourtable") or die(mysql_error());
     

      while($r=mysql_fetch_array($result))
      {

          $title=$r["titlefield"];
          $id=$r["idfield"];
       

          echo "<a href='treatedit.php?cmd=delete&idfield=$id'>$title - Delete</a>";
          echo "<br>";
        }
    }
    ?>
    <?
    if($cmd=="delete")
    {
        $sql = "DELETE FROM yourtable WHERE idfield='$id'";
        $result = mysql_query($sql) or die(mysql_error());
        echo "treat deleted";
    }
    ?>
    [/code]

    It displays the correct links and gives the correct output (treat deleted). But it does not actually delete :-s

    Can U help once again :-)

    Thanks in advance
×
×
  • 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.