Jump to content

arbitter

Members
  • Posts

    349
  • Joined

  • Last visited

Everything posted by arbitter

  1. Pft this is all so difficult... Is there no simple solution; A php form with a sublmit button. Upon clicking this button, there's first a popup with OK and Cancel. If you click cancel the form is not submitted, if you click OK the form does get submitted...
  2. I've tried puzzling with the code but I really do not understand where I must put my php-code for the deletionprocess...
  3. Probably a stupid question; but you said the html form would look like this: echo"<input type='submit' name='button' id='button' value='verwijder' onClick='dothis(" . $id . ");'>"; But there is no function 'dothis()', should it be show_confirm($id)? edit: Alright, I've got the buttons to work and display ok/cancel and the notifications that go with it!
  4. Keith, I have nothing else to say except that you're an angel! My gratitude also goes to MatthewJ ofcourse! My intellect isn't that brilliant, that's why I couldn't interpret it correctly, my bad! I'm not quite sure if works, but it creates the databases so I guess it'll check it too, thanks guys!
  5. Perhaps I'm just misinterpretating it. But with this code: if(!in_array($table_name, $tables)) { //Name is available } else { // Name exists } If the name is available, I'll generate the table and all that stuff. But why is there an option that the code is not unique? In the end, I only want 1 code, and that code should not exist yet..
  6. And if she fails to push a delete button; I'll do the work for her! Still having trouble with the code though; what must I put in the else? Because it should loop shouldn't it...
  7. Keith My mother is keen with computers and the internet, she is a programmer herself. I've explained how the site works so I don't believe she'll accidentally make any copies. Our internet and server is fast enough to not give you the possibility to click the button more then once, and also she gets redirected after generating a page. And if she does make some of them accidentally; she'll be able to delete them herself! Or at least that's something I'm trying to make possible with ajax but it isn't really going that well... So much work only to get one popup in the middle of the deleting process! Kind regards Joren
  8. That seems... ehm... incredibly difficult I'll try to decipher it nevertheless, thanks for your response!
  9. But in the else-part; shouldn't it automaticaly make a new name then? I've never used a do-while loop, and arrays isn't my cup of tea. Keith; I made a page for my mother in which she can create a new 'page' with a question and people can then react to that on that page. That's why I have a table generated, one every page, where the comments can be placed. True, it could be done in one table with an extra column... But it seemed easier like this. Believe me, she isn't going to create more than 10 pages, so 10 tables, but ofcourse theres always a small tiny chance of 2 being with the same name.
  10. Hi there! On a page of mine, random tables get generated. The tables consist of 8 characters, so there's 5 . 10^13 possibilities. Yet ofcourse there is a possibility that 2 tables with the same name can be generated, which ofcourse is not desired. So I need an adjustment that can see whether there is already a name that's the same, and if so, make another random name. And if that one also exists, make a new one again. Untill the name doesn't exist yet and it remains. Here's the script I have right now: function createName($length) { $chars = "abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $i = 0; $password = ""; while ($i <= $length) { $password .= $chars{mt_rand(0,strlen($chars))}; $i++; } return $password; } $name = createName(; mysql_select_db($database, $con); $sql = "CREATE TABLE " . $name . "( id int NOT NULL AUTO_INCREMENT, PRIMARY KEY(id), devraag varchar(500), weergave varchar(500), naam varchar(500), inhoud varchar(500), tijd varchar(100))"; mysql_query($sql, $connection)or die(mysql_error()); I'm not goot with the combination of PHP and mysql, and really have no Idea how to do this. Any help?
  11. This is probably a very simple question, but I just can't figure it out. I've taken the javascript tutorials a while ago, now I went back to see what I needed but don't really find it. So what I want to have is the following. A submit-type button with an ID, which is meant to delete a database with that same id. When the button gets clicked, the person first get's a popup with 'Do you really want to delete this table?' ad the buttons OK and cancel. It speaks to itself that when the person clicks cancel, nothing happens (or perhaps it get's shown 'Database was not deleted'), and when the person clicks OK, the PHP-code will reaload the same page with the $_POST['deletetable'] active. For the button I found this code: <html> <head> <script type="text/javascript"> function show_confirm() { var r=confirm("Do you really wish to delete this table?"); if (r==true) { alert("Database was succesfully deleted.."); } else { alert("Database was not deleted."); } } </script> </head> <body> <input type="button" onclick="show_confirm()" value="Show a confirm box" /> </body> </html> But if I use this method, shouldn't there also be a form around the input button, and where and how should I set to execute the form? I know this should be basic javascript stuff, but trying to get the hang of it...
  12. Oh that's a little to difficult for me, I've never worked with frames, so definitly not with iframes! Sorry!
  13. I don't really understand what you mean, but shouldn't you use this for the link: <?php echo "<a href=\"search.php?id=" . $ID . "&latinsk=" . $latinsk . "\"> " .$latinsk . "</a>"; ?> I could be mistaken.
  14. ah ok then. thanks for the help!
  15. I'm really bad in all the safety-stuff... But I'll try to maeke it all with $_GET[] another problem then though is that I can't make an alibi for the url using dot.tk . Eg if I wish to name it whatever.tk, it would not be possible would it?
  16. Well what I want to do is actually be able to generate a whole webpage by the click of a button... It would get a random name, eg AsUjeZee.php, and it also creates a database with the same random name(this part I have already). The random php file should then be able to connect to the same-named database and show all the queries. On the other hand, I could make it with one single phpfile and a $_GET containing the random name, but I don't really like to work with $_GET[] since it seems rather unsafe...
  17. arbitter

    cURL?

    Hi there, I wanted to create files from my phpscript. So I used the most obvious function, fopen(). It didn't work on my server and contacted the administrator, who said fopen() was disabled for security reasons, and that I should use cURL. So I did what everyone would do; I googled it. Found the php.net curl manual, but can't really comprehend what it sais. So I have a few questions: 1) Can you create .php files with cURL? 2) How? 3) How do I then write php-content in the file? Please try to explain rather detailed and simplified, I've never been good at quickly understanding all these things. Thanks a lot!
  18. Oh wow it works! So this is what I did, and it works like a charm: $query = "SELECT naam, inhoud, tijd FROM vraag ORDER BY id ASC"; $result = mysql_query($query)or die(mysql_error()); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {whatever;} Thank you so much!
  19. Could you explain a little better how to do that? I'm quite new to all of these things...
  20. You have a body{} in your css sheet, yet you still use <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">. You can integrate that in the css sheet. Also, you use: <div class="header" id="header"> class'es and id's are not the same. In your css script you have written classes. Classes are written like this: .first { color:red; } id's are written as: #first { color:red; } ID's can only be used once in a script, but classes can be used dozens of times. You used the class-notation, so no need to also say "id='...'". I don't really understand what your question is though.
  21. Oh my such a stupid mistake with the deleting! Thanks! And by dissaranged, I mean that sometimes in phpmyadmin the id 20 comes before id 5. Example: This is for a type of forum, and to display them I simply use $query = "SELECT naam, inhoud, tijd FROM vraag"; $result = mysql_query($query)or die(mysql_error()); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<div class='ctotal'> <div class='chead'> <span class='left'>" . $row['naam'] . " </span> <span class='right'>" . $row['tijd'] . "</span> </div> <div class='cc' align='center'> " . $row['inhoud'] . " </div> </div><br /><br />"; } So I don't sort them. So with the example image, the comment with id 30 would come before the comment with id 26, which is not correct, because I want the oldest first. So I guess I should sort them?
  22. Hello, I have a problem when inserting mysql queries (and also with the deleting) So when I insert, I use the following code: mysql_query("INSERT INTO vraag (naam,inhoud,tijd) VALUES ('$naam','$inhoud','$tijd')")or die(mysql_error()); And that inserts the code. But when I look in PHPMYADMIN, the order of all the comments is disaranged. Though I also have an ID column which is auto-insecremented. Is this normal, or am I doing it wrong? And if this is normal, I need a method to arrange the id's when displaying. Now for the deleting part: if(isset($_POST['delete'])) { foreach($_POST['id'] as $id) { mysql_select_db('blabla')or die(mysql_error()); $ontvang = mysql_query("DELETE FROM blabla WHERE id='$id'")or die(mysql_error()); $_SESSION['melding'] = 'selected items are deleted.'; header('Location: moderator.php'); exit(); } } Now the problem is, that it only deletes the highest id number if multiple are selected. Even if the higher ID is in the first position of the table in PHPMYADMIN. All the help will be highly appreciated!
  23. Thanks! And sorry for my late reply. Due to exams I havn't been active on the programming side, and I also wanted to learn C# but that hasn't quite lifted off eather
  24. arbitter

    How TO

    Don't really see what you mean, but put in in a table? <table> <tr> <td> <img src='....jpg' /> </td> <td> <img src='....png'/> </td> </tr> <tr> <td> Text ...
  25. Can't you explode the link? say the link is: $url = "http://www.weddingfares.co.uk/index/na/Avon" $exploded = explode(" ", $url); //Then exploded[0] is the first part, exploded[1]the second, ... //so: $exploded[5] = 'Avon' (I'm not sure whether the // in http:// counts double or not, test it out. You can also work with $_GET[] superglobals. I don't know the method you're using now... If you use $_GET[] it's a lot easier. Though I'm sure there are dozens of possibilities here, and I'm not sure whether exploding is that safe; considering getting the url and stuff.. Hope this helps
×
×
  • 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.