>php doet raar<
PHP Jasper op 06/02/2011 20:17:59:
Zoals karl het doet is het natuurlijk veel korter (en beter). MAAR, zoals hij ook al zegt: "Het kan veel beter". Volgens mij klopt er iets niet met jouw database model of met je logica.
Zoals je kunt lezen zeg ik ook dat mijn stukje code alleen voor nu is.
En het is niet mijn databasemodel, dat heeft die gozert bedacht. Die is volgens mij ook mis. Ik heb gewoon templates, als bestanden.
Mijn logica is in principe wel correct.
Natuurlijk ging het over zijn logica / db model. Ik kan me niet voorstellen dat er 10 updates nodig zijn voor eigenlijk 1 aanpassing?
%n (?) wat jij binnen de mysql_query plaatste kende en weet ik eigenlijk nog steets niks van. Ik heb 1x een boek basiscursus php aangeschaft maar deze legt dat echt niet uit.
Morgen ga ik verder knutselen, Good night
Gewijzigd op 06/02/2011 22:11:39 door phpnuke r
Ga eerst php leren voordat je met databases aan de slag gaat.
Begin dan goed met het leren van databases, niet volgens zo'n php boek. Maar leer over bijvoorbeeld normaliseren.
Morgen kijken of de script van jullie wel werkt, maar, waarom werkt deze niet, dat is wel waar ik antwoord op zoek want dan kan ik of heel maybe jullie ook deze fout vermeiten.
Dus bijv:
$bottommargin = $_POST['blabla'];
echo $bottommargin;
$bottommargin = mysql_real_escape_string($bottommargin);
echo $bottommargin;
QUERY or die(mysql_error());
Beter gezegd: kijk of de waardes wel goed worden toegekend gewoon door te echo-en :).
Ik zit nu op school dus ik kan even niks toevoegen, maar op dat idee kwam ikzelf ook wel:
echo $_POST;
Deze gaf de hele array en $_POSt['??'](alles) werkt dus gewoon. Dus het ligt niet aan het posten.
MG
Toevoeging op 07/02/2011 17:10:45:
<html>
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">
<strong>Header instellingen</strong> for <i>{option}</i>:
<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;background:#E2E2E2;">
<div style="display: none;">
<br />
<form action='./admin.php?action=templatesetupheader' method='post'>
<table style='width:100%;'>
</tr>
<tr>
<td>
(min-)hoogte:
<br />
<br />
<br />
</td>
<td>
<input type='text' value='' name='headerminheight'>
<br />
Template: 175px, 487px, 80em
<br />
<br />
</td>
</tr>
<tr>
<td>
Padding:
</td>
<td>
Links:<input type='text' value='' name='header_padding_left' style='width:35px;'> Rechts: <input type='text' value='' name='header_padding_right' style='width:35px;'> Boven: <input type='text' value='' name='header_padding_top' style='width:35px;'> Bodem: <input type='text' value='' name='header_padding_bottom' style='width:35px;'>
</td>
</tr>
<tr>
<td>
Margin:
<br />
<br />
<br />
</td>
<td>
Links:<input type='text' value='' name='header_margin_left' style='width:35px;'> Rechts: <input type='text' value='' name='header_margin_right' style='width:35px;'> Boven: <input type='text' value='' name='header_margin_top' style='width:35px;'> Bodem: <input type='text' value='' name='header_margin_bottom' style='width:35px;'>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td>
Header image:
</td>
<td>
<input type='text' value='' name='header'> <a href='' target='_new'>[test]</a>
</td>
</table>
<input type='submit' value='Opslaan'>
</form>
</html>
Dit stukje hierboven zorgt er voor dat de header word verzorgt
Dit is de nieuwe updater
Maar, nog steeds hetzelfde probleem.
Toevoeging op 07/02/2011 17:52:05:
hallo,
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '65' at line 1 1064
UPDATE cms_themevars SET variable='header_padding_left' WHERE name='10px'
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '73' at line 1 1064
UPDATE cms_themevars SET variable='header_padding_right' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '70' at line 1 1064
UPDATE cms_themevars SET variable='header_padding_top' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '68' at line 1 1064
UPDATE cms_themevars SET variable='header_padding_bottom' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '71' at line 1 1064
UPDATE cms_themevars SET variable='header_margin_left' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '68' at line 1 1064
UPDATE cms_themevars SET variable='header_margin_right' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '69' at line 1 1064
UPDATE cms_themevars SET variable='header_margin_top' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '67' at line 1 1064
UPDATE cms_themevars SET variable='header_margin_bottom' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '70' at line 1 1064
UPDATE cms_themevars SET variable='header' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '56' at line 1 1064
Geloof me dat tablenaam etc klopt, het heeft namelijk gewerkt. Volgensmij is er echt een fout gekomen in m'n mysql server.
<html>
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">
<strong>Header instellingen</strong> for <i>{option}</i>:
<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;background:#E2E2E2;">
<div style="display: none;">
<br />
<form action='./admin.php?action=templatesetupheader' method='post'>
<table style='width:100%;'>
</tr>
<tr>
<td>
(min-)hoogte:
<br />
<br />
<br />
</td>
<td>
<input type='text' value='' name='headerminheight'>
<br />
Template: 175px, 487px, 80em
<br />
<br />
</td>
</tr>
<tr>
<td>
Padding:
</td>
<td>
Links:<input type='text' value='' name='header_padding_left' style='width:35px;'> Rechts: <input type='text' value='' name='header_padding_right' style='width:35px;'> Boven: <input type='text' value='' name='header_padding_top' style='width:35px;'> Bodem: <input type='text' value='' name='header_padding_bottom' style='width:35px;'>
</td>
</tr>
<tr>
<td>
Margin:
<br />
<br />
<br />
</td>
<td>
Links:<input type='text' value='' name='header_margin_left' style='width:35px;'> Rechts: <input type='text' value='' name='header_margin_right' style='width:35px;'> Boven: <input type='text' value='' name='header_margin_top' style='width:35px;'> Bodem: <input type='text' value='' name='header_margin_bottom' style='width:35px;'>
<br />
<br />
<br />
</td>
</tr>
<tr>
<td>
Header image:
</td>
<td>
<input type='text' value='' name='header'> <a href='' target='_new'>[test]</a>
</td>
</table>
<input type='submit' value='Opslaan'>
</form>
</html>
Dit stukje hierboven zorgt er voor dat de header word verzorgt
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
$return = true;
foreach($_POST as $key => $value)
{
$query = sprintf("UPDATE " . $table_pref . "themevars SET variable='%s' WHERE name='%s'",
mysql_real_escape_string($key),
mysql_real_escape_string($value));
if(!mysql_query($query))
{
echo '<p><strong>Query probleem: ' . mysql_error() . ' ' . mysql_errno() . '</strong></p>' . PHP_EOL;
$return = false;
}
}
if(!$return==false)
{
echo "
<script language='javascript'>
window.location='./admin.php?action=theme&i=template';
</script>
";
}
?>
$return = true;
foreach($_POST as $key => $value)
{
$query = sprintf("UPDATE " . $table_pref . "themevars SET variable='%s' WHERE name='%s'",
mysql_real_escape_string($key),
mysql_real_escape_string($value));
if(!mysql_query($query))
{
echo '<p><strong>Query probleem: ' . mysql_error() . ' ' . mysql_errno() . '</strong></p>' . PHP_EOL;
$return = false;
}
}
if(!$return==false)
{
echo "
<script language='javascript'>
window.location='./admin.php?action=theme&i=template';
</script>
";
}
?>
Dit is de nieuwe updater
Maar, nog steeds hetzelfde probleem.
Toevoeging op 07/02/2011 17:52:05:
hallo,
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '65' at line 1 1064
UPDATE cms_themevars SET variable='header_padding_left' WHERE name='10px'
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '73' at line 1 1064
UPDATE cms_themevars SET variable='header_padding_right' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '70' at line 1 1064
UPDATE cms_themevars SET variable='header_padding_top' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '68' at line 1 1064
UPDATE cms_themevars SET variable='header_padding_bottom' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '71' at line 1 1064
UPDATE cms_themevars SET variable='header_margin_left' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '68' at line 1 1064
UPDATE cms_themevars SET variable='header_margin_right' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '69' at line 1 1064
UPDATE cms_themevars SET variable='header_margin_top' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '67' at line 1 1064
UPDATE cms_themevars SET variable='header_margin_bottom' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '70' at line 1 1064
UPDATE cms_themevars SET variable='header' WHERE name=''
Query probleem: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '56' at line 1 1064
Geloof me dat tablenaam etc klopt, het heeft namelijk gewerkt. Volgensmij is er echt een fout gekomen in m'n mysql server.
Gewijzigd op 07/02/2011 17:10:58 door phpnuke r