<?php
$s = $_GET["s"];
if($s) {
$hent_b = mysql_query("SELECT * FROM member_battles WHERE state = '1' ORDER BY id DESC LIMIT 0,200") or die(mysql_error());
}else{
$hent_b = mysql_query("SELECT * FROM member_battles WHERE state = '0' ORDER BY id DESC LIMIT 0,200") or die(mysql_error());
}
while($vis = mysql_Fetch_array($hent_b)) {
?>
I have this now i want when i enter my site (index.php) it should not come up undefined $_GET["s"];
how do i do this? but i want when you do index.php?s then it should change the query
Use
isset()
orarray_key_exists()
:or
This first checks if there really is an element in the array with a key
s
.Don't assign
$_GET['s']
to a variable before, otherwise you will have the same issue.I personally would always assign a value to a parameter, i.e. using
index.php?s=1
instead of justindex.php?s
.