Problems when edit a row that has a very long field
(for example when it contains html code) and has
special characters.
Row edit URL:
https://XXXXXX.com/phpmyadmin/tbl_change.php?
lang=en&server=1&db=XXXXXX&table=templates&pos=0&sessio
n_max_rows=30&disp_direction=horizontal&repeat_cells=10
0&dontlimitchars=&primary_key=+id+%3D+%270%
27+AND+template+%3D+%27%3C%21DOCTYPE+HTML+PUBLIC+%22-%
2F%2FW3C%2F%2FDTD+HTML+4.0+Transitional%2F%2FEN%22%3E%
0D%0A%3Chtml%3E%0D%0A%3Chead%3E%0D%0A%3Ctitle%3E%
24boardname%3C%2Ftitle%3E%0D%0A%3Cmeta+name%3D%
22keywords%22+content%3D%22bbs%2C+openbb%2C+forum%
2C+board%2C+blazeboard%2C+discussion%2C+bb2%22%3E%0D%
0A%3Cmeta+name%3D%22description%22+content%3D%
22is+a+discussion+forum+powered+by+OpenBB%22%3E%0D%0A%
3Cmeta+http-equiv%3D%22Content-Type%22+content%3D%
22text%2Fhtml%3B+charset%3Diso-8859-1%22%3E%0D%0A%
3Cmeta+http-equiv%3D%22expires%22+content%3D%22-1%22%
3E%0D%0A%3Cmeta+http-equiv%3D%22Pragma%22+content%3D%
22no-cache%22%3E%0D%0A%3Cmeta+http-equiv%3D%22Cache-
Control%22+content%3D%22no-cache%22%3E%0D%0A%
3Cmeta+http-equiv%3D%22MSThemeCompatible%22+content%3D%
22Yes%22%3E%0D%0A%3Cstyle+type%3D%22text%2Fcss%22%3E%
0D%0AINPUT%2C+SELECT%2C+TEXTAREA%09%09%7B%0D%0A%
09BACKGROUND-COLOR%3A+%24tempvars%5Binputbg%5D%3B%0D%
0A%09BORDER-LEFT%3A+%24tempvars%5Binputborder%
5D+solid+%24tempvars%5Binputbordersize%5D%3B%0D%0A%
09BORDER-RIGHT%3A+%24tempvars%5Binputborder%5D+solid+%
24tempvars%5Binputbordersize%5D%3B%0D%0A%09BORDER-TOP%
3A+%24tempvars%5Binputborder%5D+solid+%24tempvars%
5Binputbordersize%5D%3B%0D%0A%09BORDER-BOTTOM%3A+%
24tempvars%5Binputborder%5D+solid+%24tempvars%
5Binputbordersize%5D%3B%0D%0A%09COLOR%3A+%24tempvars%
5Binputtextcolor%5D%3B%0D%0A%09FONT-FAMILY%3A+%
24tempvars%5Bfontface%5D%3B%0D%0A%09FONT-SIZE%3A+%
24tempvars%5Binputtextsize%5D%3B%0D%0A%7D%0D%0A%3C%
2Fstyle%3E%0D%0A%3C%2Fhead%3E%0D%0A%3Cbody+bgcolor%3D%
22%24tempvars%5Bbackground%5D%22+text%3D%22%23000000%
22+link%3D%22%23000000%22+vlink%3D%22%23000000%
22+alink%3D%22%23000000%22%3E%0D%0A%24navigation%0D%0A%
3Ctable+width%3D%22100%25%22+border%3D%220%
22+cellspacing%3D%220%22+cellpadding%3D%220%22+bgcolor%
3D%22%23000000%22+align%3D%22center%22%3E%0D%0A++%3Ctr%
3E%0D%0A++++%3Ctd+bgcolor%3D%22%23FFFFFF%22%3E+%0D%
0A++++++%3Cbr%3E%3Cdiv+align%3D%22center%22%3E%
24include%3C%2Fdiv%3E%3Cbr%3E%0D%0A++++%3C%2Ftd%3E%0D%
0A++%3C%2Ftr%3E%0D%0A%3C%2Ftable%3E%0D%0A%3Cbr%3E%0D%
0A%3C%21--+Do+Not+Remove+This+Copyright+--%3E%0D%0A%
3Cdiv+align%3D%22center%22%3E%3Cfont+face%3D%22%
24tempvars%5Bfontface%5D%22+size%3D%221%22+color%3D%22%
23FFFFFF%22%3E%0D%
0AOpen+Bulletin+Board+1.0.0+Release+Canidate+2%3Cbr%3E%
0D%0A%26copy%3B+2001+%3Ca+href%3D%22http%3A%2F%
2Fwww.iansoft.net%22%3EIansoft+Enterprises%3C%2Fa%3E%
3C%2Fdiv%3E%3C%2Ffont%3E%0D%0A%3C%21--
+Do+Not+Remove+This+Copyright+--%3E%0D%0A%3C%2Fbody%3E%
0D%0A%3C%2Fhtml%3E%27+AND+groupid+%3D+%270%
27&sql_query=SELECT+%2A+FROM+templates&goto=sql.php
Error:
SQL-query :
SELECT * FROM templates WHERE id = '0' AND template
= '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<html>
<head>
<title>$boardname</title>
<meta name="keywords" content="bbs, openbb, forum,
board, blazeboard, discussion, bb2">
<meta name="description" content="is a discussion
forum powered by OpenBB">
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<meta http-equiv="expires" content="-1">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="MSThemeCompatible" content="Yes">
<style type="text/css">
INPUT, SELECT, TEXTAREA {
BACKGROUND-COLOR: $tempvars[inputbg];
BORDER-LEFT: $tempvars[inputborder] solid
$tempvars[inputbordersize];
BORDER-RIGHT: $tempvars[inputborder] solid
$tempvars[inputbordersize];
BORDER-TOP: $tempvars[inputborder] solid
$tempvars[inputbordersize];
BORDER-BOTTOM: $tempvars[inputborder] solid
$tempvars[inputbordersize];
COLOR: $tempvars[inputtextcolor];
FONT-FAMILY: $tempvars[fontface];
FONT-SIZE: $tempvars[inputtextsize];
}
</style>
</head>
<body bgcolor="$tempvars[background]" text="#000000"
link="#000000" vlink="#000000" alink="#000000">
$navigation
<table width="100%" border="0" cellspacing="0"
cellpadding="0" bgcolor="#000000" align="center">
<tr>
<td bgcolor="%
MySQL said:
You have an error in your SQL syntax near ''<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
' at line 1
Solution:
Don't use "AND template=" as id is primary and no more
fields is needed to describe which field is to be
edited.
Logged In: YES
user_id=210714
Please show us your table schema.
Logged In: YES
user_id=210714
They only explanation I see: your primary key is
(id,template).
Logged In: YES
user_id=144058
Hi!
No way to fix the problem because it's a table design
problem: either you do not define a primary or, at least,
unique key, either you did but this key contains
the "template" field (as Marc suggested) and that field is
way too large to be used for this.
Then to identify a row the script has to pass by url the
value for this two fields and, of course, reach the max.
size allowed.
Define a valid unique or primary key in your table and you
will no longer face this problem.
Loc
Logged In: NO
Oh, now I see some problems, the problem exist in the
templates table on openbb 1.0 rc2. The table has three
fields, id, template and groupid. None of the three fields
are primary. They are separated by id and groupid is never
the same in one row. Template field is html code. Id
describes whats in the template field, like id 0 is page
header. groupid describes which template the row belongs to.
phpMyAdmin has no way of knowing that it only needs id and
groupid to select a particular row so it takes tamplate
also with all the html code :(
There is nothing you can do about that but it shouldn't
lead to a SQL syntax error? Some characters must be escaped
wrong or something like that?
Regards, David Nordenberg UIN:5545436 //feel free to
contact me on ICQ :)
Logged In: YES
user_id=210714
Does not look like an escaping problem but a browser-dependent truncation problem.