i have no idea why my code wont work..
i have the table names right, and i can echo the fields and display them on the page.. so why wont they edit?
$id=$_GET['id'];
$type = $_GET['type'];
$title=$_POST['title'];
$content=$_POST['content'];
$author=$_POST['author'];
$message_length = strlen($content);
$content = nl2br(strip_tags($content,'<b><u><i>'));
include "database.php";
if($message_length > 1000000) {
echo "Your message was too long, messages must be less than 1 million chars";
}
else {
if ($type == "tip" ) {
$query="UPDATE tips SET content='$content' title='$title' WHERE id='$id' ";
echo "Successfully edited $type";
$result = mysql_query($query);
mysql_close();
}
elseif ($type == "tut" ) {
$query="UPDATE tutorials SET content='$content' title='$title' WHERE id='$id' ";
echo "Successfully edited!";
$result = mysql_query($query);
mysql_close();
}
else {
echo "huh?";
}
}
it says Successfully edit whenever i go to that page... no errors, just it wont work..LOL
nevermind
i forgot a comma
one gets used to that. ok i have another problem
i echo "&";
and eventually it turns into:
&amp;amp;amp;amp;amp;
for some weird reason..
i really need to fix this...
i think this only happens in the while loops, but im not sure..what loopi put in this:
<?
$a=mysql_query("SELECT * FROM tutorials ORDER BY date,time LIMIT 0 , 5");
while($row=mysql_fetch_array($a)) {
echo "<a href='http://www.htmlforums.com/archive/index.php/display.php?id=";
echo $row['id'];
print "&type=tut";
echo "'>";
echo $row['title'];
echo "</a><BR>";
}
?>
and later on i end up with this:
<?
$a=mysql_query("SELECT * FROM tutorials ORDER BY date,time LIMIT 0 , 5");
while($row=mysql_fetch_array($a)) {
echo "<a href='http://www.htmlforums.com/archive/index.php/display.php?id=";
echo $row['id'];
print "&amp;amp;amp;amp;amp;type=tut";
echo "'>";
echo $row['title'];
echo "</a><BR>";
}
?>there is nothing that will add it like you see it.
it should be this anyway
print "&type=tut";that didnt work Scoutt.. it turns out that something was enabled that made the encoding happen..
so i used:
$x = "&type=";
$y = htmlentities($x);
$z = html_entity_decode($y);
echo "$z";
echo "tut";
works great what?? there is no option in php that will make it do that. it has to be the way you insert them into the database.
i have the table names right, and i can echo the fields and display them on the page.. so why wont they edit?
$id=$_GET['id'];
$type = $_GET['type'];
$title=$_POST['title'];
$content=$_POST['content'];
$author=$_POST['author'];
$message_length = strlen($content);
$content = nl2br(strip_tags($content,'<b><u><i>'));
include "database.php";
if($message_length > 1000000) {
echo "Your message was too long, messages must be less than 1 million chars";
}
else {
if ($type == "tip" ) {
$query="UPDATE tips SET content='$content' title='$title' WHERE id='$id' ";
echo "Successfully edited $type";
$result = mysql_query($query);
mysql_close();
}
elseif ($type == "tut" ) {
$query="UPDATE tutorials SET content='$content' title='$title' WHERE id='$id' ";
echo "Successfully edited!";
$result = mysql_query($query);
mysql_close();
}
else {
echo "huh?";
}
}
it says Successfully edit whenever i go to that page... no errors, just it wont work..LOL
nevermind
i forgot a comma
one gets used to that. ok i have another problem
i echo "&";
and eventually it turns into:
&amp;amp;amp;amp;amp;
for some weird reason..
i really need to fix this...
i think this only happens in the while loops, but im not sure..what loopi put in this:
<?
$a=mysql_query("SELECT * FROM tutorials ORDER BY date,time LIMIT 0 , 5");
while($row=mysql_fetch_array($a)) {
echo "<a href='http://www.htmlforums.com/archive/index.php/display.php?id=";
echo $row['id'];
print "&type=tut";
echo "'>";
echo $row['title'];
echo "</a><BR>";
}
?>
and later on i end up with this:
<?
$a=mysql_query("SELECT * FROM tutorials ORDER BY date,time LIMIT 0 , 5");
while($row=mysql_fetch_array($a)) {
echo "<a href='http://www.htmlforums.com/archive/index.php/display.php?id=";
echo $row['id'];
print "&amp;amp;amp;amp;amp;type=tut";
echo "'>";
echo $row['title'];
echo "</a><BR>";
}
?>there is nothing that will add it like you see it.
it should be this anyway
print "&type=tut";that didnt work Scoutt.. it turns out that something was enabled that made the encoding happen..
so i used:
$x = "&type=";
$y = htmlentities($x);
$z = html_entity_decode($y);
echo "$z";
echo "tut";
works great what?? there is no option in php that will make it do that. it has to be the way you insert them into the database.