Jump to content


Photo

something wrong


  • Please log in to reply
2 replies to this topic

#1 desithugg

desithugg
  • Members
  • PipPipPip
  • Advanced Member
  • 281 posts
  • LocationScarborough

Posted 26 July 2006 - 12:47 PM

<?php
mysql_connect("localhost", $my_sql_password, $my_sql_username) or
   die("Could not connect: " . mysql_error());
mysql_select_db("tpf");

$result = mysql_query("SELECT soldto FROM sold where id = '$item_id'");
if (!$result) {
   echo 'Could not run query: ' . mysql_error();
   exit;
}
$row = mysql_fetch_row($result);
$sold_for = $row[0];
?>
<?
if ($sold_for = "all") { 
$sold_for = $user_logged_in; 
}
else{
$sold_for = $sold_for;
}
?>
<?PHP
if ($sold_for != $user_logged_id){
	echo "<center>Access Denied<br>Sorry this item is not meant to be sold to you."; 
	exit();
	}
?>

umm my username is "Desithugg" and the item is sold for "Deadman" but when i go to the page it doesnt give me the error that the item is not meant to be sold for me.umm im not sure why and yes i did try removing the "()" after the "exit"

#2 Chips

Chips
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 26 July 2006 - 12:49 PM

if ($sold_for = "all") { 
$sold_for = $user_logged_in;

The sold_for =
that's assignment, NOT equality checking. Use a double ==
($sold_for == "all")


#3 desithugg

desithugg
  • Members
  • PipPipPip
  • Advanced Member
  • 281 posts
  • LocationScarborough

Posted 26 July 2006 - 12:51 PM

lol thanx i looked over that atleadst 20 times and didn't catch it.anyways thnx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users