Jump to content

Archived

This topic is now archived and is closed to further replies.

dprayer

Help

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[!--quoteo(post=381783:date=Jun 9 2006, 11:08 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 9 2006, 11:08 AM) [snapback]381783[/snapback][/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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.