[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Webmasterplein.net • Toon onderwerp - PHP -> MySQL + nieuw probleem
Pagina 1 van 1

PHP -> MySQL + nieuw probleem

BerichtGeplaatst: 06 apr 2006 16:09
door Remi
Hey,

Ik ben al een tijdje bezig met PHP. Maar ik snap niks van de SQL tabels. Ik ben namelijk gewoonlijk gewent van een database dat je een soort tabel net zoals in Excel. Maar dit is heel anders. Dus kan iemand mij dit uitleggen. Ben ook al opzoek gewesst naar tut's maar niet gevonden. Dus als iemand mij dit kan uitleggen.

Re: PHP -> MySQL

BerichtGeplaatst: 06 apr 2006 16:16
door LinkinTED
Mijn waardige collega heeft een artikel geschreven over de basis van MySQL, daarin heeft hij ook een stukje opgenomen over het opzetten van de database. Ik hoop dat je er wat aan hebt:

Re: PHP -> MySQL

BerichtGeplaatst: 06 apr 2006 17:24
door Remi

Re: PHP -> MySQL

BerichtGeplaatst: 06 apr 2006 19:20
door Remi
Heb nu al het al een beetje onder de knie.
Maar ben nu tegen een probleempje aangelopen.

[code="PHP"]
<?php
$username = 'remi'; // De gebruikersnaam voor de databaseconnectie.
$password = ''; // Het wachtwoord voor de databaseconnectie.
$host = 'localhost'; // De server waarop MySQL draait.
$database = 'remi'; // De naam van de database waar we de naam in gaan invoeren.

// Controleer een naam is meegegeven als POST-variabele.
if(isset($_POST['user']) && !empty($_POST['user']));
if(isset($_POST['pass']) && !empty($_POST['pass']))

{
// Maak een connectie naar de MySQL-database:
$connection = mysql_connect($host, $username, $password);

// Selecteer de database:
mysql_select_db($database);

// Voer de volgende query uit:
// achter INTO staat de databasenaam (test)
// achter de databasenaam staan tussen haakjes de velden die worden toegevoegd (alleen naam);
// achter VALUES staan de waarden van die velden;
mysql_query("INSERT INTO users (user) VALUES ('{$_POST['user']}')");
mysql_query("INSERT INTO users (pass) VALUES ('{$_POST['pass']}')");

// Sluit de connectie:
mysql_close($connection); echo 'De waarde is toegevoegd.';
}
else
{
echo 'Er is geen naam ingevoerd om toe te voegen aan de database.';
}
?>[/code]

Maar de user en pass worden niet in één rij opgeslagen.
zoals je hier onder kan zien.

Afbeelding

Wat moet ik in mijn script veranderen???

Re: PHP -> MySQL

BerichtGeplaatst: 06 apr 2006 20:33
door Anthony

Re: PHP -> MySQL + nieuw probleem

BerichtGeplaatst: 06 apr 2006 20:54
door Derk
Een database werkt zo:

Je hebt databases, zie dit als mapjes
Je hebt tabellen, zie dit als excel files
Je hebt velden, zie dit als de horizontale lijn die ze in excel nummeren als abc...
Je hebt regels, zie dit als de verticale lijnen die in excel 12345.... zijn.

met een INSERT voeg je een regel toe. Wat jij doet is dus 2 regels toevoegen. hier moet je 1 van maken.
Ik doe dit altijd zo:
mysql_query("INSERT INTO users (user,pass) VALUES ('{$_POST['user']}',{$_POST['pass']})");
Hierbij heb ik jou regels aangepast.

Ik zou nu een stukje kunnen vertellen over SQL injection, maar ik denk dat dat voor later zorg is.

Je hebt nu het begin, dat vond ik van mysql écht het allemoeilijkst, ik zou me geen zorgen maken om de rest ^^

Re: PHP -> MySQL + nieuw probleem

BerichtGeplaatst: 06 apr 2006 22:09
door KillerSponge

Re: PHP -> MySQL + nieuw probleem

BerichtGeplaatst: 07 apr 2006 09:55
door Derk

Re: PHP -> MySQL + nieuw probleem

BerichtGeplaatst: 07 apr 2006 16:16
door Remi
Toen ik het voor het eerst zag haalde ik het invoegen van velden. Een beetje door de war. Ik dacht dat dat al je tabel was. Maar nu begrijk ik het.
En bedankt.
Maar ik vind het eigenlijk niet zo heel moeilijk op de site van LinkinTED stond het simpelen makkelijk uit gelegd.