Jump to content

Child of Darkness

New Members
  • Posts

    8
  • Joined

Profile Information

  • Gender
    Not Telling

Child of Darkness's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [!--quoteo(post=350352:date=Feb 28 2006, 09:36 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Feb 28 2006, 09:36 PM) [snapback]350352[/snapback][/div][div class=\'quotemain\'][!--quotec--] You were passing it via a GET paramater? Well, yeah, that would explain it. [/quote] haha, it was like 10 times in my code but everything works now, so... thanks to everyone who helped me with this glad I found the worst mistake myself though:)
  2. Okay, I solved the problem myself this time so if anyone feels like patting me for this:p I won't stop you:P final code, I changed GET into POST and made the whole form post data instead of GETting the URl; CODE: [code] <?php error_reporting(E_ALL); include('connect.php'); if(isset($_POST['commented'])) { $NAMEinput = $_POST['NAMEinput']; $AUTHinput = $_POST['AUTHinput']; $POEMinput = nl2br($_POST['POEMinput']); $LANGinput = $_POST['LANGinput']; $sql = "INSERT INTO poems (NAME,AUTHOR,POEM,LANGUAGE) values ('$NAMEinput', '$AUTHinput' , '$POEMinput', '$LANGinput')"; mysql_query($sql) or die(mysql_error()."<br />\n".$sql); echo"Your comment has been posted<br> <a href='addpoem.php'>Add another Poem</a><br> <a href='admin.php'>Back to Admin-area</a>"; } else { ?> <form method='post' action="<? echo $PHP_SELF ?>"> <h1><img src="icons/AddIcon.png" border="0" width="32">Add a Poem</h1> <table class="details" border="0" cellspacing="10"> <tr> <td class="id">ID: <?php echo mysql_insert_id() ?></td> <td class="language">Language: <input type="text" style="width:150px" name="LANGinput" /></td> </tr> <tr> <td class="name">Name: <input type="text" style="width:150px" name="NAMEinput" /></td> <td class="author">Author: <input type="text" style="width:150px"  name="AUTHinput"/></td> </tr> </table> <div class="poem"> <textarea class="poem" name="POEMinput"> </textarea> </div> <div class="buttons"> <input type="submit" value="OK"/> <input type="reset" value="Reset" onClick="reset();"/> <input type= 'hidden' name= 'commented' value= 'set' > <a href="admin.php" class="button">Back</a> <br> </div> </form> <? } ?> [/code] thanks for all the help. glad it finally works. if anyone has any hints about coding left, tell me. one more question; what's the code to make sure the ID that the poem is going to have is visible in the form? do I need a new selecting statement for it?
  3. Stats: when 255 chars: no notices, no errors; inserting takes place and everything works fine when 255+ chars: varies from time to time what notice or weird stuff is showing up, most common: Undefined index: POEMinput in /home/xaddict/public_html/admin/addpoem.php on line 33 on that line is the statement: $POEMinput = nl2br($_GET['POEMinput']); when a very large text is inserted: 414 Request-URI Too Large
  4. [!--quoteo(post=349039:date=Feb 24 2006, 03:37 PM:name=shoz)--][div class=\'quotetop\']QUOTE(shoz @ Feb 24 2006, 03:37 PM) [snapback]349039[/snapback][/div][div class=\'quotemain\'][!--quotec--] Btw, how are you determining that the POEM is not inserted. If you're not directly querying the database, post the relevant portions of the script that should show it. [/quote] before I start coding my viewer pages, I always check my code with my database management system, PhpMyAdmin in this case:).. and when I use the current inserting this doesn't show up in pma, all the other fields do but the poem itself doesn't
  5. [!--quoteo(post=348844:date=Feb 24 2006, 12:21 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Feb 24 2006, 12:21 AM) [snapback]348844[/snapback][/div][div class=\'quotemain\'][!--quotec--] That is odd -- either it inserts, or it complains. It can't be neither. [/quote] there's nothing more than the code I already gave. So this means I have to trash it and start over?? or could there be another mistake in my db? the field the code refers to is: POEM longtext utf8_general_ci and I found out the short texts can still be inserted but the longer just don't so when it really becomes a longtext it does not work any longer
  6. [!--quoteo(post=348814:date=Feb 23 2006, 10:58 PM:name=wickning1)--][div class=\'quotetop\']QUOTE(wickning1 @ Feb 23 2006, 10:58 PM) [snapback]348814[/snapback][/div][div class=\'quotemain\'][!--quotec--] Unless magic quotes is turned on, you probably have a ' in the text that is screwing up the query. Use echo get_magic_quotes_gpc() to find out if magic quotes is turned on for your script. [/quote] I already hoped that was the problem but the problem also shows up when using no ' at all.
  7. [!--quoteo(post=348787:date=Feb 23 2006, 10:05 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Feb 23 2006, 10:05 PM) [snapback]348787[/snapback][/div][div class=\'quotemain\'][!--quotec--] First, you should probably be using an AUTO_INCREMENT field for your IDs -- using MAX() is not recommended, nor desired. It's entirely possible to get UID collisions this way. Second, AFAIK, there's no difference at all -- you can store anything in TEXT/LONGTEXT, and DB shouldn't know the difference, and neither should PHP. What do you mean by "not working anymore"? Nothing gets inserted? An error is produced? Please clarify. [/quote] The max_id field isn't there because of the incrementing:) It's there to show the new number in a textfield so that's no problem. As the form uses self it refreshes and when I tried to change it mysql gave an error, but I'll change that the next time. About the error: It doesn't say anything but it just doesn't insert. with a normal text is showed till it became >255 chars, now it doesn't do anything anymore. thanks,
  8. Okay, so here's the problem: I'm trying to get myself a form which is able of adding an enormous amount of text as the 'entry'-field into a database. the rest of code that you will find beneath work till I found out I had to use longtext or blob or something to get great amounts of data in the DB. POEMinput is the field containing the precious data. This is my code of the addpoem.php: [code]<?php include('connect.php'); $max_ID = mysql_result(mysql_query('SELECT MAX(ID) from poems'),0) +1; if(isset($_GET['commented'])) { $IDinput = $max_ID; $NAMEinput = $_GET['NAMEinput']; $AUTHinput = $_GET['AUTHinput']; $POEMinput = nl2br($_GET['POEMinput']); $LANGinput = $_GET['LANGinput']; $sql = "INSERT INTO poems (ID,NAME,AUTHOR,POEM,LANGUAGE) values ('$IDinput', '$NAMEinput', '$AUTHinput' , '$POEMinput', '$LANGinput')"; mysql_query($sql) or die(mysql_error('Error')); echo"Your comment has been posted<br><a href='addpoem.php'>Add another Poem</a><br><a href='admin.php'>Back to Admin-area</a>"; } else { ?> <form method='get' action="<? echo $PHP_SELF ?>"> <h1><img src="icons/AddIcon.png" border="0" width="32">Add a Poem</h1> <table class="details" border="0" cellspacing="10"> <tr>         <td class="id">ID: <?php echo $max_ID; ?></td>         <td class="language">Language: <input type="text" style="width:150px" name="LANGinput" /></td> </tr> <tr>         <td class="name">Name: <input type="text" style="width:150px" name="NAMEinput" /></td>         <td class="author">Author: <input type="text" style="width:150px"  name="AUTHinput"/></td> </tr> </table> <div class="poem"> <textarea class="poem" name="POEMinput"> </textarea> </div> <div class="buttons"><input type="submit" value="OK"/><input type="reset" value="Reset" onClick="reset();"/><input type= 'hidden' name= 'commented' value= 'set' >&nbsp;<a href="admin.php" class="button">Back</a><br></div> </form> <? } ?>[/code] the problem with it is it worked with text, now I use longtext it suddenly doesn't anymore. I searched internet for days looking for an answer and then found out my account here was still open so I'm asking you. what am I doing wrong? tips about layout and styling are welcome too but the main thing is to get it working:) ps. sorry for the messed-up code, it's copy-pasted, so....
×
×
  • 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.