Aarclay schreef:Kun je een voorbeeld geven? Heb al gegoogled en al.En kijk eens naar [func]mysql_error[/func].Eerdere citaten tonen
Lennard schreef:Dan ga je uitzoeken waarom hij niets in je database stopt... dus ga je de ingevulde query echoën en kijken of die klopt.
En uiteraard ook goede foutafhandeling toevoegen..
En die undefined variabelen. Ze zijn nog niet aangemaakt. Lijkt erop dat ze niet eens meegestuurd worden met je POST.
Desire`s Bug Topic
Aarclay schreef:Dat natuurlijk sowieso, maar dat is altijd een heel gedoe als je losse mysql_query functies gebruikt, dan kun je beter een database class maken.En kijk eens naar [func]mysql_error[/func].Eerdere citaten tonen
Lennard schreef:Dan ga je uitzoeken waarom hij niets in je database stopt... dus ga je de ingevulde query echoën en kijken of die klopt.
En uiteraard ook goede foutafhandeling toevoegen..
De ene keer zie ik dat er dit gebruikt wordt:
$mysql->real_escape($_POST[id])
En de andere keer gewoon de oude mysql_*() functies.
Niet echt efficiënt.
$mysql->real_escape($_POST[id])
En de andere keer gewoon de oude mysql_*() functies.
Niet echt efficiënt.
Is dit beter dan? Betere uitlijning enzo?
En wat moet ik toevoegen / bewerken om die erros weg te halen?
En wat moet ik toevoegen / bewerken om die erros weg te halen?
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]config.php[/COLOR][COLOR= #007700]);[/COLOR]
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP url shortener</title>
<style type="text/css">
#form1 p {
text-align:center;
}
</style>
</head>
<body background="images/backgroud.gif">
<div class="header"> Php URL shortener<hr /></div>
<div class="content">
[COLOR= #0000BB]<?php
$url[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]]));[/COLOR]
[COLOR= #0000BB]$id[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]10000[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]99999[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$code[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/base_convert"]base_convert[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]20[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]36[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]url[/COLOR][COLOR= #007700]]))){[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"insert into url 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]id[/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]url[/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]shortened[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$con[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Uw verkorte url is <a href="http://site/"[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$code[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]"">http://site/"[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$code[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]"</a>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/Mysql_close"]Mysql_close[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$con[/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]"Uw url is niet verkort"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
</div>
</body>
</html> - Wat doet die isset hier?
- Wat wil je hier mee bereiken? Weet je wel wat mysq_real_escape_string() teruggeeft?
- Waarom typ je de MySQL functies in je query niet met een hoofdletter?
- Waar is nou je foutafhandeling op je query?
- Waar controleer je of je formulier verstuurd is?
- Waarom gebruik je het bakground-attrbuut in je body, terwijl je dit in CSS af kan handelen?
- Gebruik a.u.b. tags voor je Php URL shortener ( dus..)
$url=mysql_real_escape_string(isset($_POST[url])); - Wat wil je hier mee bereiken? Weet je wel wat mysq_real_escape_string() teruggeeft?
if(mysql_real_escape_string(isset($_POST[url]))){ - Waarom typ je de MySQL functies in je query niet met een hoofdletter?
- Waar is nou je foutafhandeling op je query?
- Waar controleer je of je formulier verstuurd is?
- Waarom gebruik je het bakground-attrbuut in je body, terwijl je dit in CSS af kan handelen?
- Gebruik a.u.b. tags voor je Php URL shortener (
dus..)
- Je schotelt de gebruiker bij een fout wel dit voor "Uw url is niet verkort". Waarom is het niet verkort? Bij wie ligt de oorzaak? Wees hier wat duidelijker in.
Als ik dit script zo zie, lijkt een rewrite een stuk beter.
@ desire: zoek gewoon eens van elke functie op wat hij precies doet.
Het lijkt erop dat je at random wat functies en ifjes en elsjes plakt en dat net zo lang doet totdat het goed is.
Je moet in je hoofd hebben zitten wat je wil, en dat moet je bijna foutloos kunnen programmeren zonder te testen (je moet natuurlijk wel testen, maar het idee van het script moet dan al duidelijk zijn).
Dus wat Aar zegt: bedenk wat je script moet doen, bedenk wat je daar voor nodig hebt (je hebt $_POST[url] en $_POST[id] nodig), bedenk wat het allemaal moet zijn ($_POST[url] moet een url zijn, $_POST[id] moet een getal zijn, enz.), en ga bedenken hoe je dat in PHP kunt maken.
Succes.
Het lijkt erop dat je at random wat functies en ifjes en elsjes plakt en dat net zo lang doet totdat het goed is.
Je moet in je hoofd hebben zitten wat je wil, en dat moet je bijna foutloos kunnen programmeren zonder te testen (je moet natuurlijk wel testen, maar het idee van het script moet dan al duidelijk zijn).
Dus wat Aar zegt: bedenk wat je script moet doen, bedenk wat je daar voor nodig hebt (je hebt $_POST[url] en $_POST[id] nodig), bedenk wat het allemaal moet zijn ($_POST[url] moet een url zijn, $_POST[id] moet een getal zijn, enz.), en ga bedenken hoe je dat in PHP kunt maken.
Succes.
Bedankt allebij, ik zal kijken wat ik kan doen.
toevoeging op 27 september 2012, 07:56:25:
Ik heb nu dit:
Verder kom ik er echt niet uit.
toevoeging op 27 september 2012, 07:56:25:
Ik heb nu dit:
[COLOR= #0000BB]<?php
$url[/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]url[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$id[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]10000[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]99999[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$shortened[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/base_convert"]base_convert[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]20[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]36[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO url (id, url, shortened) 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]id[/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]url[/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]shortened[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$con[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Uw verkorte url is <a href="http://site/"[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$shortened[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]"">http://site/"[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$shortened[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]"</a>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/Mysql_close"]Mysql_close[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$con[/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]"Uw url is niet verkort, dit kan komen door het volgende:<br>
* Er zit een fout in ons systeem.<br>
* U heeft geen geldige URL ingevult.<br>
* Of een onbekende fout, raadpleeg hiervoor de website beheerder."[/COLOR][COLOR= #007700];
}[/COLOR]
?> Verder kom ik er echt niet uit.
BUMP
toevoeging op 28 september 2012, 08
21:
Heb nu dit:
Alleen slaat hij shortened nu niet op in de database.
toevoeging op 28 september 2012, 08
21:Heb nu dit:
[COLOR= #0000BB]<?php
$url[/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]url[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$id[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]10000[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]99999[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$shortened[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/base_convert"]base_convert[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]20[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]36[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/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]id[/COLOR][COLOR= #007700]])){[/COLOR]
[COLOR= #0000BB]$id[/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]id[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO url (id) 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]id[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/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]shortened[/COLOR][COLOR= #007700]])){[/COLOR]
[COLOR= #0000BB]$id[/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]shortened[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO url (shortened) 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]shortened[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);
}[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO url (url) 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]url[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$con[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Uw verkorte url is <a href="http://site/"[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$shortened[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]"">http://site/"[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$shortened[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]"</a>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/Mysql_close"]Mysql_close[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$con[/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]"Uw url is niet verkort, dit kan komen door het volgende:<br>
* Er zit een fout in ons systeem.<br>
* U heeft geen geldige URL ingevult.<br>
* Of een onbekende fout, raadpleeg hiervoor de website beheerder."[/COLOR][COLOR= #007700];
}[/COLOR]
?> Alleen slaat hij shortened nu niet op in de database.
Gebruik alleen mysql_real_escape_string in een query aub
toevoeging op 28 september 2012, 08:28:58:
Controleer ook of het een url is je kan nu ook een getal invoeren
toevoeging op 28 september 2012, 08:28:58:
Controleer ook of het een url is je kan nu ook een getal invoeren
En voeg goede foutafhandeling toe aan je mysql_query. En waarom losse queries?
Ik zal er naar kijken, maar weet iemand verder ook hoe ik die shortened werkend krijg?
Komen ze al in de database of niet?
Nope nog steeds niet, ik post nu mijn script, ik ben nu aan het zoeken hoe ik die nl2br/htmlentities op de input doe..
toevoeging op 28 september 2012, 19:50:02:
toevoeging op 28 september 2012, 19:50:02:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #0000BB]$url[/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]url[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$id[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/rand"]rand[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]10000[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]99999[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$shortened[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/base_convert"]base_convert[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$id[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]20[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]36[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Uw verkorte url is <a href="http://site/"[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$shortened[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]"">http://site/"[/COLOR][COLOR= #007700].[/COLOR] [COLOR= #0000BB]$shortened[/COLOR] [COLOR= #007700].[/COLOR][COLOR= #DD0000]"</a>"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO url (id, url,shortened) 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]id[/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]url[/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]shortened[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/trigger_error"]trigger_error[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]Er is een fout opgetreden, neem contact op met de webmaster.[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$con[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/Mysql_close"]Mysql_close[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$con[/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]"Uw url is niet verkort, dit kan komen door het volgende:<br>
* Er zit een fout in ons systeem.<br>
* U heeft geen geldige URL ingevult.<br>
* Of een onbekende fout, raadpleeg hiervoor de website beheerder."[/COLOR][COLOR= #007700];
}[/COLOR]
?> Ben je wel verbonden met de MySQL server?
7
7
Ja..