Database tabel
ScriptPHP Code:
`id` int(11) NOT NULL auto_increment,
`titel` varchar(255) NOT NULL default '',
`doelurl` varchar(255) NOT NULL default '',
`bannerurl` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=75 DEFAULT CHARSET=latin1 AUTO_INCREMENT=75 ;
Om een of andere manier werkt het nietPHP Code:
<?php
require_once("../config.inc.php");
require 'beveiliging.php';
include("header.php");
// $action = get('action', 'x');
if($action == 'toevoegen')
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$errors = array ();
foreach ($_POST as $key => $value) {
$value = trim ($value);
if (empty ($value)) {
array_push ($errors, '<p>Vul iets in bij ' . $key . '</p>');
}
}
if (empty ($errors)) {
$titel = mysql_real_escape_string($_POST['titel']);
$doelurl = mysql_real_escape_string($_POST['doelurl']);
$bannerurl = mysql_real_escape_string($_POST['bannerurl']);
$sql = "
INSERT INTO banners
(
titel,
doelurl,
bannerurl
)
VALUES
(
'".$titel."',
'".$doelurl."',
'".$bannerurl."'
)
";
if(!$res = mysql_query($sql))
{
trigger_error(mysql_error().'<br />In query: '.$sql);
}
if($res)
{
echo 'De banner is toegevoegd, <a href="admin.php">Ga terug naar admin</a>';
}
else
{
echo 'Er is iets misgegaan bij het toevoegen van de banner.';
}
}
}
}
{
?>
<form action="?action=toevoegen" method="post">
<table width="100%">
<tr>
<td>Titel: </td>
<td><input type="text" name="titel" maxlength="45" value=""> </td>
</tr>
<tr>
<td>Doel url: </td>
<td><input type="text" name="doelurl" maxlength="75" value="http://"> </td>
</tr>
<tr>
<td>Banner url: </td>
<td><input type="text" name="bannerurl" maxlength="75" value="http://">
<br />
<input type="submit" value="Toevoegen"> </td>
</tr>
</table>
</form>
<?php
}
include("footer.php");
?>
mvg Mark
- Probleem met toevoegen in tabel
-
15-06-2009, 18:49 #1
- Berichten
- 1.384
- Lid sinds
- 17 Jaar
Probleem met toevoegen in tabel
-
-
15-06-2009, 19:01 #2
- Berichten
- 613
- Lid sinds
- 19 Jaar
Errors?
-
15-06-2009, 19:06 #3
- Berichten
- 1.384
- Lid sinds
- 17 Jaar
ja niks juist
-
15-06-2009, 19:07 #4
- Berichten
- 613
- Lid sinds
- 19 Jaar
Zo misschien? Komt hij wel bij die insert query?
PHP Code:<?php
require_once '../config.inc.php';
require 'beveiliging.php';
include 'header.php';
if($action == 'toevoegen')
{
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$errors = array();
foreach($_POST as $key => $value)
{
$value = trim($value);
if(empty($value))
{
array_push($errors, '<p>Vul iets in bij ' . $key . '</p>');
}
}
if(empty($errors))
{
$titel = mysql_real_escape_string($_POST['titel']);
$doelurl = mysql_real_escape_string($_POST['doelurl']);
$bannerurl = mysql_real_escape_string($_POST['bannerurl']);
$sql = "INSERT INTO banners
(
titel,
doelurl,
bannerurl
)
VALUES
(
'".$titel."',
'".$doelurl."',
'".$bannerurl."'
)
";
if(!$res = mysql_query($sql))
{
trigger_error(mysql_error().'<br />In query: '.$sql);
echo 'Er is iets misgegaan bij het toevoegen van de banner.';
}
else
{
echo 'De banner is toegevoegd, <a href="admin.php">Ga terug naar admin</a>';
}
}
}
}
else
{
?>
<form action="?action=toevoegen" method="post">
<table width="100%">
<tr>
<td>Titel: </td>
<td><input type="text" name="titel" maxlength="45" value=""> </td>
</tr>
<tr>
<td>Doel url: </td>
<td><input type="text" name="doelurl" maxlength="75" value="http://"> </td>
</tr>
<tr>
<td>Banner url: </td>
<td><input type="text" name="bannerurl" maxlength="75" value="http://">
<br />
<input type="submit" value="Toevoegen"> </td>
</tr>
</table>
</form>
<?php
}
include("footer.php");
?>Laatst aangepast door Dannyvw : 15-06-2009 om 19:15
-
15-06-2009, 19:11 #5
- Berichten
- 1.384
- Lid sinds
- 17 Jaar
Origineel gepost door Dannyvw
Zo misschien? Komt hij wel bij die insert query?
PHP Code:<?php
require_once '../config.inc.php';
require 'beveiliging.php';
include 'header.php';
if($action == 'toevoegen')
{
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$errors = array();
foreach($_POST as $key => $value)
{
$value = trim($value);
if(empty($value))
{
array_push($errors, '<p>Vul iets in bij ' . $key . '</p>');
}
}
if(empty($errors))
{
$titel = mysql_real_escape_string($_POST['titel']);
$doelurl = mysql_real_escape_string($_POST['doelurl']);
$bannerurl = mysql_real_escape_string($_POST['bannerurl']);
$sql = "INSERT INTO banners
(
titel,
doelurl,
bannerurl
)
VALUES
(
'".$titel."',
'".$doelurl."',
'".$bannerurl."'
)
";
if(!$res = mysql_query($sql))
{
echo 'Er is iets misgegaan bij het toevoegen van de banner.';
trigger_error(mysql_error().'<br />In query: '.$sql);
}
else
{
echo 'De banner is toegevoegd, <a href="admin.php">Ga terug naar admin</a>';
}
}
}
}
else
{
?>
<form action="?action=toevoegen" method="post">
<table width="100%">
<tr>
<td>Titel: </td>
<td><input type="text" name="titel" maxlength="45" value=""> </td>
</tr>
<tr>
<td>Doel url: </td>
<td><input type="text" name="doelurl" maxlength="75" value="http://"> </td>
</tr>
<tr>
<td>Banner url: </td>
<td><input type="text" name="bannerurl" maxlength="75" value="http://">
<br />
<input type="submit" value="Toevoegen"> </td>
</tr>
</table>
</form>
<?php
}
include("footer.php");
?>
PHP Code:Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/markvaneij/domains/xxxxxxxx.nl/public_html/admin/bannertoev.php:1) in /home/xxxxxxx/domains/xxxxxxxx.nl/public_html/admin/beveiliging.php on line 2
begint op lijn de 2
session start
mvg Mark
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic