Jump to content

NLCJ

Members
  • Posts

    129
  • Joined

  • Last visited

    Never

Everything posted by NLCJ

  1. I don't need it directly in the SQL query, I just need PHP to check it (using if and else). I've found a function using reformat_date, maybe this will work?
  2. But if I insert them using YYYY-MM-DD, how can I display them then like: DD-MM-YYYY?
  3. Hello, I've got some SQL queries and in a row in the table is a date. Formatted: dd-mm-yyyy. Now I have to check if that date is in the past, so how should i do it? Using '<' doesn't work and Google ain't helping a lot... Regards, Chris
  4. Somehow it's working now... I guess I was just to tired. Thanks for all the help though!
  5. Okay. Here is a part of the code, which I think is necessary: <?php $id = $_GET['id']; $table1 = mysql_fetch_array(mysql_query("SELECT * FROM table1 WHERE id='".mysql_real_escape_string($id)."'")); $table2 = mysql_fetch_array(mysql_query("SELECT * FROM table2 WHERE date='".mysql_real_escape_string($table1['date'])."'")); Lets say that there is a row with the same name as the result of table 1. echo $table2[$table1['name']]; ?> However this doesn't work... Thanks for your reply.
  6. Hello, I'm creating a new site, and to do that I will have to do it like below. Basically I have to display something that I got from SQL, but the row I need is a variable. How do I do this? I've tried all possibilities I could think of... $name = "NameOfSomething"; $sql = //MySQL query echo $sql[$name]; I hope you guys understand my problem. Thanks,
  7. Okay, at first I was Googling on how to do this, but couldn't find the answer. After asking it here I thought of a different search term and I found at that this can be set with number_format. Thanks a lot though!
  8. Hello, After I've been working for a little while I finally made a pretty complicated calculation. And it does give the right answers! The only problem is that it sometimes shows 3 or 4 decimals but other results have waaayyy more. How can I limit this to for example 3 decimal numbers? Regards, CJansen
  9. I'll look up how I get it parsed to my script. But this is the error I get with XML when it has to say something like: à This page contains the following errors: error on line 34 at column 10: Encoding error Below is a rendering of the page up to the first error.
  10. Hello, We get an array from another site, and we convert it to XML for further use. The problem is that special characters result in errors at XML (especially Internet Explorer...) so we have to filter them out, and replace them. This might be a noobish attempt, but I did: $resultsuncensored = $resp->value(); $e = array("é", "ë", "ê", "è"); $resultse = str_replace($e, "e", $resultsuncensored); $resultsen = str_replace("&", "en", $resultse); $a = array("à", "á", "â", "ã", "ä"); $resultsa = str_replace($a, "a", $resultsen); $results = str_replace("ç", "c", $resultsa); But no characters get replaced! How can I solve this / what am I doing wrong? Regards,
  11. Hello, I want to count one column where the userid is the same. Let's say I got this: $get = mysql_query("SELECT column FROM table WHERE userid='1'); [code=php:0] For example, this gives: [code] UserID - Column 1 - 24 1 - 58 1 - 89 I want that this goes like: 24 + 58 + 89, how can I do this? Or is this a PHP specific question? Sorry that I didn't use a table, but it just doesn't insert one when I say it should. Regards, NLCJ
  12. Thank you! Dumb me...
  13. I know, but I don't want that there comes a \'... I trust this source 100% so that will be fine...
  14. Hello, I've run into another (simple) problem. Lets say I've got this: $variable1 = "12"; $variable2 = "Testin' this system"; mysql_query("INSERT INTO tablename ('id', 'name') VALUES ('".$variable1."', '".$variable2."')"); That will look like this: mysql_query("INSERT INTO tablename ('id', 'name') VALUES ('12', 'Testin' this system'"); So, how do I get this right into the database? Regards,
  15. Hello, I was trying to get a random value from the MySQL where one value is less than the other one. I've got this (so far). SELECT * FROM table WHERE status='1' AND value1<value2 ORDER BY rand() Value 1 is a variable from the same table as where it should get a random row from, the same counts for value2. I'm kinda stuck here... Regards, NLCJ
  16. Thanks, I think I might be able to do that, but that would take a lot of time. Isn't it possible to send the information from a 'Disabled' dropdown-box? Like: <form method="POST" action="page.php"> <select name="gotcha-type" DISABLED> <option value="movies">Movies / Images</option> </select> </form> Right now it sends the information if I remove 'DISABLED' (of course, totally logic), but is it also possible to keep it sending while it is disabled? Regards,
  17. Hello, I'm creating a form which depends on their first input, when they select the first type from a dropdownlist and press 'Go to step 2' they'll go there and select a subtype (which depends on their first input). Above the input of subtype I've created the dropdownlist from step 1, so they'll be able to see what they've chosen. The problem is hard to explain, but I'll try. <?php $page = $_GET['p']; $gotchatype = $_POST['gotchatype']; $gotchasubtype = $_POST['gotchasubtype']; if($page == gotcha){ if($gotchatype == movies) { if($gotchasubtype == rip){ <!-- Form of step 3 --!> } <!-- Form of step 2 --!> } <!-- Form of step 1 --!> } ?> But since I've 'DISABLED' the dropdown box that they've chosen earlier it doesn't send that part, so it doesn't go further than if($page == gotcha){. I hope that you understand my problem. Regards, EDIT: I've made the script more 'simple' to understand.
  18. I've manually set the width to 500, guess I'll have to do it with the hard way...
  19. Hello, I'm creating a site and was trying to get at the top a menu. When an user isn't logged in it should display a link to login or register. When they're logged in it will change into other links. The only problem is that they don't use the full width of the container div. I use float: left; to get them next to each other. http://phide.net/~ond/ Thank you,
  20. Thank you very much! It was useless over there, just forgot to delete it after I defined it in the while function.
  21. Since I was trying to get all the commands in one page it is over 600 lines at this moment... Is gonna be a bit hard. I can remember I had this problem before, with the menu since that one is also dynamic. I cannot remember how I solved that (it was the day before yesterday ). EDIT: I've added the file. At line 567 starts the part of the guestbook. At line 238 is the part where it inserts the values if you're registered. At line 251 starts the part when you're not registered. [attachment deleted by admin]
  22. Refreshed the page endless times, no result. The database sees the value, but it just doesn't work. See it for yourself: http://melkwegstelsel.co.cc/?p=gastenboek You're free to register. (Password is encoded ).
  23. It echoes every reply except the last one that is added, when somebody else adds another one that one won't show up, but others will. mysql_query("INSERT INTO gastenboek (userid,titel,tekst,datum,tijd) VALUES ('".mysql_real_escape_string($d_usergegevens['id'])."','".mysql_real_escape_string($titel)."','".mysql_real_escape_string($tekst)."','".mysql_real_escape_string($date)."','".mysql_real_escape_string($time)."')");
  24. Sorry $d_getberichten = mysql_query("SELECT * FROM gastenboek ORDER BY datum,tijd DESC");
×
×
  • 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.