Hey,
Ik heb iets gemaakt waardoor je een MYSQL query via een pagina op je site kan maken...
Alleen als ik het volgende doe:
Query:
UPDATE gebruikers SET muntjes = muntjes + 5 WHERE naam = admin
Ik druk op verzenden en er komt dit te staan:
Fout:
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 5 WHERE naam = admin at line 1
+ nog een query andere manier:
Query:
UPDATE gebruikers SET muntjes = muntjes + `5` WHERE naam = `admin`
Fout:
Unknown column admin in where clause
Het script van de hele pagina:
Alles werkt behalve dat...
Ik heb iets gemaakt waardoor je een MYSQL query via een pagina op je site kan maken...
Alleen als ik het volgende doe:
Query:
UPDATE gebruikers SET muntjes = muntjes + 5 WHERE naam = admin
Ik druk op verzenden en er komt dit te staan:
Fout:
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 5 WHERE naam = admin at line 1
+ nog een query andere manier:
Query:
UPDATE gebruikers SET muntjes = muntjes + `5` WHERE naam = `admin`
Fout:
Unknown column admin in where clause
Het script van de hele pagina:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]./config.php[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]./menu.php[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"safe/safe_leerling.php"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"safe/safe_leeraar.php"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"safe/safe_beheerde.php"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"safe/safe_admin.php"[/COLOR][COLOR= #007700]);[/COLOR]
?>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]query[/COLOR][COLOR= #007700]])){[/COLOR]
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]query[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$query[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700])[/COLOR] or [COLOR= #0000BB]$errstr[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$errstr[/COLOR][COLOR= #007700])){[/COLOR]
[COLOR= #0000BB]$msg[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$msg[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"</strong>FOUT! Er zit in fout in de mysql query: <strong>"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$errstr[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$affected_rows[/COLOR] [COLOR= #007700]= @[/COLOR][URL="http://www.php.net/mysql_affected_rows"]mysql_affected_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$query[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$msg[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$msg[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]"</strong>Gelukt!: <strong>"[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$affected_rows[/COLOR][COLOR= #007700];
}
}[/COLOR]
?>
<b>MYSQL tabellen & querys voor DataBase:</b> superb_database<BR><BR>
<div id="column7" class="column">
<b>MYSQL Database tabellen:</b><BR>
[COLOR= #0000BB]<?php
$getTables[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SHOW TABLES FROM superb_database"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$tmp[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$getTables[/COLOR][COLOR= #007700])){[/COLOR]
[COLOR= #0000BB]$table[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$tmp[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]];[/COLOR]
?>
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$table[/COLOR] ?><BR>
[COLOR= #0000BB]<?php[/COLOR] [COLOR= #007700]}[/COLOR] ?>
</div>
<div id="column7" class="column">
<b>MYSQL Query:</b>
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$msg[/COLOR][COLOR= #007700])){[/COLOR] ?><strong><font color="#FF0000" face="Arial,Arial Black,sans-serif" size="2">[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$msg[/COLOR][COLOR= #007700];[/COLOR] ?></font></strong>[COLOR= #0000BB]<?php[/COLOR] [COLOR= #007700]}[/COLOR] ?>
<form method=post>
<textarea name=query cols=40 rows=10>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]query[/COLOR][COLOR= #007700]];[/COLOR] ?></textarea>
<BR>
<input type=submit value=Verstuur>
</form>
<BR><BR><BR>
<a class="butto" href="./mysql_rep" onclick="this.blur();"><span>Tabellen repareren</span></a>
</div>
</p> Alles werkt behalve dat...