Ik heb een klein script geschreven om te kijken of een ip bestaat in de database, en zoniet te updaten, nu begon ik met gewoon simpel if else statement voor de pagina,s en nu wil ik de num_rows echoen naar het scherm om te kijken of het werkt, en dan weergeeft hij NIKS, ook als ik iets anders echo bijv. Blaaaat dan geeft hij ook geen output hoe kan dat?
Dit is de code:
<?php
# start if else statement
if($_GET['id'] == 'index')
{
include ("content/inc_index.php");
$activepage = "index";
}
elseif($_GET['id'] == 'wzw')
{
include ("content/inc_wzw.php");
$activepage = "wzw";
}
elseif($_GET['id'] == 'apparatuur')
{
include ("content/inc_apparatuur.php");
$activepage = "apparatuur";
}
elseif($_GET['id'] == 'media')
{
include ("content/inc_media.php");
$activepage = "media";
}
elseif($_GET['id'] == 'contact')
{
include ("content/inc_contact.php");
$activepage = "contact";
}
else
{
include ("content/inc_index.php");
$activepage = "default";
# checken of ip in de database staat.
$sql_host = "localhost";
$sql_username = "starlight";
$sql_password = "mijnpw";
$sql_db = "starlight";
$sql_updateteller = "SELECT * FROM `iplog` WHERE ip='".$_SERVER['REMOTE_ADDR']."'";
$sql_connect = mysql_connect($sql_host,$sql_username,$sql_password) or die(mysql_error());
$sql_select_db = mysql_select_db($sql_db,$sql_connect) or die(mysql_error());
$sql_data = mysql_query($sql_updateteller) or die(mysql_error());
$sql_results = mysql_fetch_array($sql_data) or die(mysql_error());
$sql_num_rows = mysql_num_rows($sql_data) or die(mysql_error());
echo ("Test Test waarom zie ik niks?");
}
# end of if else statement
?>
1.380 views