Jump to content

Help


dprayer

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.