Jump to content

ale_jrb

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by ale_jrb

  1. It's this line that's doing it. The "_blank" secion tells it to open a new window to send the form. I guess you could change that, but it may be needed - I don't know enough about Flash to help you with this. If you need to have that part there, replace the "_blank" with "_self" - though this might mess up your flash... gatherForm.send("http://www.mysite.com/contact_us.php", "_self", "POST"); Good luck.
  2. To get the ID, set it to a variable like so: [code]$id = mysql_insert_id()[/code] Put the above variable as your link (/add_detail.php?id='.$id.'). Then on your add_detail.php page, you have to use the $_GET command. For example: [code] if(isset($_GET['id'])){ $id = $_GET['id']; $moreinfo = "true"; } if($moreinfo = "true"){ Type code that you want to happen if the link is clicked here... } else { Type code you want to happen if the page is accessed by typing "www.yoururl.com/add_detail.php" in the browser by itself. } [/code] Does this help you? Your question is quite unclear.
  3. Oops lol - glad it helped.
  4. To update things live, you have to use a client side script such as Javascript - PHP cannot validate things until the submit button is pressed, which if I understood correctly, is not what you want.
  5. I would try putting your code as this instead: [code]    if ($years >= 1) { $str.="{$years} years "; }    if ($weeks >= 1) { $str.="{$weeks} weeks "; }    if ($days >= 1) { $str.="{$days} days "; }    if ($hrs >= 1) { $str.="{$hrs} hours "; }    if ($mins >= 1) { $str.="{$mins}"; }    // Checks if there are only seconds.    if ($years < 1 && $weeks < 1 && $days < 1 && hrs < 1 && mins < 1)       {$str = "00";}    if ($secs >= 10) { $str.=":{$secs}"; }    if ($secs < 10) { $str.=":0{$secs}"; } [/code] This will first work as you wrote it. When it reaches the comment, it checks to see if there are no years, weeks, days, hours or minutes. If there are not, it will set $str to "00" before finishing the script (then the seconds and colon will be added after the 00, which is what you wanted). If there are any of the above, it will do nothing and proceed as it normally would. Hope this helps.
  6. The unqiue option is shown here when you create a table, and in turn, fields: [img src=\"http://img123.imageshack.us/img123/5927/mysqlfront0na.png\" border=\"0\" alt=\"IPB Image\" /] :)
  7. [code] <html> <head> <title>Favourite Fruit</title> </head> <body> <p><strong>Question 1:</strong> What is your favourite fruit? <p><FORM method="POST" action="<?php echo $_SERVER['PHP_SELF']?>"> <input type="radio" name="fruit" value="Apple" checked />Apple<br> <input type="radio" name="fruit" value="Banana" />Banana<br> <input type="radio" name="fruit" value="Grape" />Grape<br> <input type="radio" name="fruit" value="Orange" />Orange<br> <INPUT TYPE="SUBMIT" value="Send data"> </body> </html> [/code] Did you mean to do something like this? This asks that user their favourite fruit. They choose one of the options and click "Send" and it stores their answer in a text file. Is that what you were trying to do?
  8. [code] while ( $health > 0 AND $health2 > 0 ) { echo "You Hit Dragon for $truedam.<br>"; // update dragon health $newhealth2=($health2-$truedam); $sql2="UPDATE players SET health='$newhealth2' WHERE user='Dragon'"; $query = mysql_query($sql2); if($health2 < 1) { echo "you have defeated the dragon"; die(); } echo "Dragon Hit You For $truedam2.<br>"; // update player health $newhealth=($health-$truedam2); $sql2="UPDATE players SET health='$newhealth' WHERE user='$user'"; $query2 = mysql_query($sql2); if($health < 1) { echo "Dragon Has Killed You UNLUCKY"; die(); } } [/code] Try that.
  9. Ooh... OK, thanks. Now to find out how to call a script with Javascript... :) Thanks.
  10. Hi. I need to code a timer but I am unsure how I should go about doing so. It needs to work in such a way that a user can click a link which will start a timer. The timer will then start counting down. It must be able to change without the user having to refresh the page. Also, the user must be able to close the page or destroy their log in section and it must carry on counting. When it reaches the end it activates something. Does anyone know how I could manage this? Thanks very much! :)
  11. Yeah, it was just an example. How do you set up one of them? Thanks.
  12. Hi. I need to write a script that allows a database to automatically update itself even if a user is not there, but I'm not sure how to go about it. Can anyone say? What I want to happen is something like this: A user sets something to true in a database (it doesn't really matter how this happens, I'll do that). The user can then go away, close their browser and end their session, or whatever. Something in the database updates every now and then (say every 30 seconds). They come back later, the value having changed. The best example I can think of is, for example, in online PHP games where you get a mining thing or something and you get some metal whether or not you are at the computer. You can then see how much you have when you come back. Help? Thanks!
  13. No - its not creating a session (I don't think). All I see it doing is retreiving the values from a form - you'd have to register a session to use sessions...
  14. Thanks, I'll try that. But what the script is doing, is the random part gives it an ID to work with. It checks how many rows have that ID (1) and are [b]not[/b] empty. If it is empty, then there will be 0 rows that agree to the if statement. If it is full there will be 1. The theory is that it only overwrites if it returns 0. But its not working...
  15. Probably best not... 644 is the future...
  16. Hi, I;m writing a script to update a database. The rows are already set up and I need to change one field in a random row. Here's my script: [code] $number = mysql_query("SELECT * FROM `mytable`"); $number = mysql_num_rows($number); $i = 1; while ($i < 2) { $setfield = rand(1, $number); $checkempty = mysql_query("SELECT * FROM `mytable`             WHERE fieldiwannaupdate!='' AND ID='$setfield'"); $checkempty = mysql_num_rows($checkempty); if(checkempty == 0) { $sql = mysql_query("UPDATE `mytable` SET `fieldiwannaupdate` = '$thingiwannaupdateto' WHERE `ID` ='$setfield' LIMIT 1; ") or die (mysql_error()); break; } } [/code] But it isn't working - it will always overwrite something, even if there is something there already. Help please...
×
×
  • 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.