Jump to content

t.bo

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Everything 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. thanks a lot man , im gonna try it out later!! grtz
  5. And is it possible to input the MM in numbers and output in a word? Example I put in 07 , and it outputs July
  6. What if the months are in another language? And how should I input the date? (ex. 01/05/2006 or 5 januari 2006) And when I use order by monthfield it just orders the months alfabetically.
  7. 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
  8. 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
  9. Nothin changed.. It did not even output anything from that echo "command is..."
  10. As i said. I already tried changing cmd to $_GET['cmd']
  11. Still doesn't help guys :-(... Localhost is no problem... U can see the example on [url=http://www.euroclinix.com/affildelete.php]http://www.euroclinix.com/affildelete.php[/url]
  12. [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...
  13. 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
  14. 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
  15. Thanks a lot man. Only had to add order by catfield. Works fine :-)
  16. 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...
  17. 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.
  18. Ok thanks again... Should this piece of code be put in the beginning of the code or already in the delete section? grtz
  19. Can anyone help me out? I think there is a problem with the idfield & $id but I cant see it... Thanks in advance
  20. 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
  21. Ok I GOT IT  ;D [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] Works perfect. Thanks for everything
  22. Ok now I get : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and `idfield`='1'' at line 1
  23. Hmm still doesnt work.. Is it possible that there is a problem with the ", ' and ` tags?
  24. Can anyone help me out? I really need this one. Greetz and 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.