Jump to content
php.lv forumi

problēma ar funkcijas izveidošanu


stencilz

Recommended Posts

function add($user) {
 $x = mysql_query("SELECT user1,user2 FROM single WHERE user1='".$user."'");
 $q = mysql_fetch_array($x);
 $z = mysql_query("SELECT COUNT(*) FROM single WHERE user1='".$user."'");
 $a = mysql_fetch_row($z);
 if($a[0] == "0") {
 echo '1';
 mysql_query("INSERT INTO single (user1) VALUES ('".$user."')");
 echo 'please be patient <a href="s_f.php?page=add">refresh page</a>'; }
 if($a[0] == "1") {
 if($q['user1'] == $user && $q['user2'] == "") {
echo '2';
echo 'please be patient <a href="s_f.php?page=add">refresh page</a>'; }
 if($q['user1'] == $user && $q['user2'] != "") {
echo ''.$q['user1'].' accepted  <a href="s_f.php?page=1">start play</a>'; } } }

 

kad pirmo reizi ieiet lapā un izpildās insert kverijs viss ir ok, bet ja mēģina refreshot tad lapa neveras vaļā, kas varētu būt par probēmu?

Link to comment
Share on other sites

×
×
  • Create New...