Jump to content

Recommended Posts

<?
if(isset($_POST['travel']))

$id = secure($_SESSION['user_id']);
$id = $id[0];

        $sql = "SELECT location_id FROM user_stats WHERE user_id='$id'";
	$result = mysql_query($sql); 

	$firstcheck = "SELECT ticketprice FROM airport WHERE id='1' ";
	$firstcheck1 = "SELECT ticketprice FROM airport WHERE id='2' ";
	$firstcheck2 = "SELECT ticketprice FROM airport WHERE id='3' ";
	$firstcheck3 = "SELECT ticketprice FROM airport WHERE id='4' ";

	$secondcheck = mysql_query($firstcheck);
	$secondcheck1 = mysql_query($firstcheck1);
	$secondcheck2 = mysql_query($firstcheck2);
	$secondcheck3 = mysql_query($firstcheck3);

	$price = mysql_result($firstcheck);
	$price1 = mysql_result($firstcheck1);
	$price2 = mysql_result($firstcheck2);
	$price3 = mysql_result($firstcheck3);


  
if ($_POST['radio'])
{
$radio=strip_tags($_POST['radio']);

if (!ereg('[^0-9]',$radio))
{
	if ($radio == "1")
	{
		$costs = $price ;
		$to = "Chicago";
	}
	elseif ($radio == "2")
	{
		$costs = $price1;
		$to = "Detroit";
	}
	elseif ($radio == "3")
	{
		$costs = $price2 ;
		$to = "New York";
	}
	elseif ($radio == "4")
	{
		$costs = $price3 ;
		$to = "Washington";
	}
}
if ($fetch->lasttravel > time())
	echo "You cannot travel for another ".maketime($result->lasttravel)." "; 
elseif ($costs > $result->money)
	echo " You don't have enough money for this ticket" ; 
}
elseif ($costs <= $result->money)
{
}
elseif ($to == $result->location_id)
	echo " You are already in this city. " ;
{
}
if ($to != $result->city)
{
$flightcosts = $sql->money - $costs;
$now = time() + 3600;

mysql_query("UPDATE user_stats SET location_id='$to', money='$flightcosts' , lasttravel='$now'  WHERE user_id='$id'");
}
?>


 

These are the errors it shows

 

Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 37

18:35 pm:

Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 38

18:35 pm:

Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 39

18:35 pm:

Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 40

18:35 pm:

Notice: Undefined index: radio in /home/djwdesi/public_html/gangster/airport.php on line 44

18:35 pm:

Notice: Trying to get property of non-object in /home/djwdesi/public_html/gangster/airport.php on line 76

18:35 pm:

Notice: Undefined variable: costs in /home/djwdesi/public_html/gangster/airport.php on line 76

18:35 pm:

Notice: Trying to get property of non-object in /home/djwdesi/public_html/gangster/airport.php on line 83

18:35 pm:

Notice: Undefined variable: to in /home/djwdesi/public_html/gangster/airport.php on line 83

 

 

Error lines respectively are:

 

$price = mysql_result($firstcheck);

$price1 = mysql_result($firstcheck1);

$price2 = mysql_result($firstcheck2);

$price3 = mysql_result($firstcheck3);

 

 

if ($_POST['radio'])

 

 

}

elseif ($costs <= $result->money)

{

 

}

if ($to != $result->city)

{

 

 

 

Need some general help and pointers please :) im pretty new you see :P

Take a look at mysql_result in the manual, you're missing 2 parameters.

 

Try making all your mysql_result calls this:

 

$price = mysql_result($firstcheck, 0, 'ticketprice');

 

Actually, you don't need ticketprice, so only put the 0 there.

Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 37

Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 38

Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 39

Warning: Wrong parameter count for mysql_result() in /home/djwdesi/public_html/gangster/airport.php on line 40

All lines above i am going to guess your not connecting to the database first..

to check try this

$secondcheck = mysql_query($firstcheck) or die(mysql_error());

 

Notice: Undefined index: radio in /home/djwdesi/public_html/gangster/airport.php on line 44

if ($_POST['radio'])

to

if (isset($_POST['radio']))

 

Notice: Trying to get property of non-object in /home/djwdesi/public_html/gangster/airport.php on line 76

see 83

Notice: Undefined variable: costs in /home/djwdesi/public_html/gangster/airport.php on line 76

$cost =0; //<---Add cost here so its set
$to =0; //<---Add cost here so its set
if (isset($_POST['radio']))

Notice: Trying to get property of non-object in /home/djwdesi/public_html/gangster/airport.php on line 83

This is also to do with the SQL problem

$sql = "SELECT location_id FROM user_stats WHERE user_id='$id'";

to

$sql = "SELECT * FROM user_stats WHERE user_id='$id'";

Notice: Undefined variable: to in /home/djwdesi/public_html/gangster/airport.php on line 83

see line  76 correction

 

Last error you probably haven't go to yet is

$flightcosts = $sql->money - $costs;

should be

$flightcosts = $result->money - $costs;

 

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.