Pagina systeem

Gestart doorShahiem17 reacties24 weergaven

18 berichten · pagina 1 van 2

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Heya ,one2xsers

Ik heb een probleempje want hij mijn paginasysteem zet geen paginas in me database.

Code:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/require_once"]require_once[/URL] [COLOR= #DD0000]config.php[/COLOR][COLOR= #007700];[/COLOR]


[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]] ||[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]) {[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO titel,bericht WHERE pagina"[/COLOR][COLOR= #007700]);[/COLOR]
                    
                
            
                                
                                [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]Pagina is toegevoegd[/COLOR][COLOR= #007700];

                            }[/COLOR]
                            [URL="http://www.php.net/else"]else[/URL]
                            [COLOR= #007700]{[/COLOR]
                            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]Er is iets misgegaan.[/COLOR][COLOR= #007700];
                            }[/COLOR]
            
?>
<form name="pagina" action="" method="post" />
<table>
<tr>
<td>Titel:</tdj><td><input type="text" name="titel" value="" /></td>
</tr>
<tr>
<td>Bericht:</td><td><textarea id="" size="50" name="bericht" value="" /></textarea></td>
</tr>

<tr>
<td><input type="submit" name="submit" value="Verzenden" /></td>
<td><input type="reset" name="reset" value="Wissen" /></td>
</tr>


- Bedankt smile
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/require_once"]require_once[/URL] [COLOR= #DD0000]config.php[/COLOR][COLOR= #007700];[/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]submit[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO table (titel, bericht) VALUES ("[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]titel[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
                    
                
            
                                
                                [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]Pagina is toegevoegd[/COLOR][COLOR= #007700];

                            }[/COLOR]
                            [URL="http://www.php.net/else"]else[/URL]
                            [COLOR= #007700]{[/COLOR]
                            [URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]Er is iets misgegaan.[/COLOR][COLOR= #007700];
                            }[/COLOR]
            
?>
<form name="pagina" action="" method="post" />
<table>
<tr>
<td>Titel:</tdj><td><input type="text" name="titel" value="" /></td>
</tr>
<tr>
<td>Bericht:</td><td><textarea id="" size="50" name="bericht" value="" /></textarea></td>
</tr>

<tr>
<td><input type="submit" name="submit" value="Verzenden" /></td>
<td><input type="reset" name="reset" value="Wissen" /></td>
</tr>
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Script doet maar als je de pagina opstart staat er Er is iets misgegaan, ligt denk ik aan else ofzo.
En hij geeft als id 0 aan maar ik wil dat hij naar bovengaat.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Shahiem schreef:
Script doet maar als je de pagina opstart staat er Er is iets misgegaan, ligt denk ik aan else ofzo.
Ligt inderdaad aan de else. Er word namelijk gecheckt of $_POST[submit] een waarde heeft en dat is nog niet zo als de pagina laad
Shahiem schreef:
En hij geeft als id 0 aan maar ik wil dat hij naar bovengaat.
Wat bedoel je hiermee?
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kijk , De ids zijn nu allemaal 0, Ze moeten automatisch gaan dus: 1234556 etc
0
Berichten
8.602
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
dan meot je er een autoincrement veld vanmaken
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Shahiem schreef:
Kijk , De ids zijn nu allemaal 0, Ze moeten automatisch gaan dus: 1234556 etc
in je database bij het veld id auto_increment aanzetten
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dat lukt juist niet, Ik probeerde dat de heletijd en dan krijg ik dit:

Incorrect table definition; there can be only one auto column and it must be defined as a key
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Shahiem schreef:
Dat lukt juist niet, Ik probeerde dat de heletijd en dan krijg ik dit:
Incorrect table definition; there can be only one auto column and it must be defined as a key
Dan is er al iets anders in die tabel die auto_increment is
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Nee er is geen auto_increment confused
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Shahiem schreef:
Nee er is geen auto_increment confused
kun je effe een dump van die tabel maken?
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
-- phpMyAdmin SQL Dump
-- version 2.11.9.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generatie Tijd: 12 Oct 2009 om 19:50
-- Server versie: 5.0.67
-- PHP Versie: 5.2.6

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `hr`
--

-- --------------------------------------------------------

--
-- Tabel structuur voor tabel `pagina`
--

CREATE TABLE IF NOT EXISTS `pagina` (
  `paginaid` int(11) NOT NULL ,
  `titel` varchar(225) NOT NULL,
  `bericht` varchar(225) NOT NULL,
  `categorie` varchar(225) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Gegevens worden uitgevoerd voor tabel `pagina`
--


Ligt het misschien ook niet aan omdat ik Loclahost gebruik?
0
Berichten
364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
ik heb wel een scriptje die paginas maak
0
Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Mag ik die smile
0
Berichten
364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
wil er minimaal 2 punten voor
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren