- Messages
- 5,508
- Reaction score
- 35
- Points
- 48
Idk then, as a last solution I'd check if MySQL is version 5... but at me it works just fine with the same code... so the problem isn't with the code...
Serverversion: 5.0.51b-community. Weird...
Idk then, as a last solution I'd check if MySQL is version 5... but at me it works just fine with the same code... so the problem isn't with the code...
<?php
// Insert HTML into database :D This is just the basics to make it work. You can add more to this if you have the desire to
if (!empty($_POST['gcode'])) { // Just make sure that your field name is gcode ;)
$gcode = $_POST['gcode'];
mysql_real_escape_string($gcode);
$result = mysql_query("INSERT INTO `table` (id, gcode) VALUES(NULL,'$gcode')");
if ($result) {
echo "Created new page";
} else {
echo "There was an error creating your page.<br /><br />".mysql_error();
}
} else {
echo "
<form action='?submit' method='post'><div>
<textarea name='gcode'></textarea><br /><br />
<input type='submit' value='Create Page' name='submit' />
</div></form>
";
}
?>
http://www.php.net/mysql_real_escape_string said:Description
string mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier ] )
Escapes special characters in the unescaped_string , taking into account the current character set of the connection so that it is safe to place it in a mysql_query(). If binary data is to be inserted, this function must be used.
mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.
This function must always (with few exceptions) be used to make data safe before sending a query to MySQL.
Sorry about this mess, I thought you were having problems trying to parse it, not submit it x-P. tryIf you can get all of your html in the database, then we can go on from there...PHP:<?php // Insert HTML into database :D This is just the basics to make it work. You can add more to this if you have the desire to if (!empty($_POST['gcode'])) { // Just make sure that your field name is gcode ;) mysql_real_escape_string($_POST['gcode']); $result = mysql_query("INSERT INTO `table` (id, gcode) VALUES(NULL,'$gcode')"); if ($result) { echo "Created new page"; } else { echo "There was an error creating your page.<br /><br />".mysql_error(); } } else { echo " <form action='?submit' method='post'><div> <textarea name='gcode'></textarea><br /><br /> <input type='submit' value='Create Page' name='submit' /> </div></form> "; } ?>
P.S. I'm giving you back your credits until you get it working, so you can choose to donate it to someone else if you feel it's necessary (or give it back, i'm just giving back what's yours until the time is right
Dude, xPlozion, the script is fine. It worked at my place. It may need a little tweaking so that it works on his version of PHP/MySQL or whatever too, but the script is great You've done a really good job
in the db. Now why does it stop this time...<script src="http://ww
<script src="http://www.gmodules.com/ig/ifr?url=http://www.canbuffi.de/gadgets/clock/clock.xml&up_title=Clock%20%26%20Date&up_time_format=0&up_seconds=1&up_date_format=0&up_dayofweek=1&up_offset_hours=&up_offset_minutes=&up_daylight=0&up_color=red&synd=open&w=320&h=120&title=__UP_title__&lang=en&country=ALL&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>
<?php
mysql_connect('localhost','...','...');
mysql_select_db('...');
// Insert HTML into database :D This is just the basics to make it work. You can add more to this if you have the desire to
if (!empty($_POST['gcode'])) { // Just make sure that your field name is gcode ;)
$gcode = mysql_real_escape_string($_POST['gcode']);
$result = mysql_query("INSERT INTO `table` (id, gcode) VALUES(NULL,'$gcode')");
if ($result) {
echo "Created new page";
} else {
echo "There was an error creating your page.<br /><br />".mysql_error();
}
} else {
echo "
<form action='?submit' method='post'><div>
<textarea name='gcode'></textarea><br /><br />
<input type='submit' value='Create Page' name='submit' />
</div></form>
";
}
?>
so, when you use blob, all of the code is inserted into the database?
also, text and blob do not get a limit.
<script src=\"http://www.gmodules.com/ig/ifr?url=http://www.canbuffi.de/gadgets/clock/clock.xml&up_title=Clock%20%26%20Date&up_time_format=0&up_seconds=1&up_date_format=0&up_dayofweek=1&up_offset_hours=&up_offset_minutes=&up_daylight=0&up_color=red&synd=open&w=320&h=120&title=__UP_title__&lang=en&country=ALL&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js\"></script>
so that's what you see in phpMyAdmin?