Jump to content


Photo

Help


  • Please log in to reply
2 replies to this topic

#1 dprayer

dprayer
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 09 June 2006 - 09:37 AM

Hi all

I cant get a grab part of my website to work.. Basically, when you go to this part of the site you can press the grab button and you take over the object which you have pressed grab on.

This part of the script is the grab part for an airport :

elseif ($grab == "Airport"){

$check = mysql_query("SELECT * FROM airport WHERE owner= '0' AND location='$fetch->location'");
$num_rows = mysql_num_rows($check);

if ($num_rows != "0"){

if ($fetch->location == $location){

mysql_query("UPDATE airport SET owner='$username', profit='0-0-0-0-0-0' WHERE location='$fetch->location'");
echo "You got the Airport!";
}}}

Here is the php script for that partof the site wich includes the grab:

<?php if ($airport->owner == ""){ echo "No owner-<a href='?grab=airport&location=$locations[$i]'>Grab it </a>"; }else{ echo "<a href='profile.php?viewuser=$airport->owner'>$airport->owner</a>"; } ?>

Thanks if you can help me out in any way

#2 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 09 June 2006 - 10:08 AM

Hi, new, but not new to php just looking for something to do at work in free time when my strength for coding has run out.

Are $grab and $location actually defined here as $HTTP_GET_VARS ?

if (isset ($_GET['grab'])) $grab = $_GET['grab'];

same for location.

In any case you should clean up the code a bit maybe cut out some excess variables and add some spaces it's slightly unclear
z..z..z..z..z..z..z..z..

#3 dprayer

dprayer
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 09 June 2006 - 10:30 AM

[!--quoteo(post=381783:date=Jun 9 2006, 11:08 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 9 2006, 11:08 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hi, new, but not new to php just looking for something to do at work in free time when my strength for coding has run out.

Are $grab and $location actually defined here as $HTTP_GET_VARS ?

if (isset ($_GET['grab'])) $grab = $_GET['grab'];

same for location.

In any case you should clean up the code a bit maybe cut out some excess variables and add some spaces it's slightly unclear
[/quote]

he he.. i can imagine me trying to clean it up.. Im not great with php and scripts.. i know ill end updeleting bits and it wont work again..lol

If you have MSN add me please : rayer_gangland@hotmail.co.uk

Thanks





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users