Jump to content

Archived

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

desithugg

something wrong

Recommended Posts

[code]
<?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();
}
?>
[/code]

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"

Share this post


Link to post
Share on other sites
[quote][code]if ($sold_for = "all") {
$sold_for = $user_logged_in; [/code][/quote]
The sold_for =
that's assignment, NOT equality checking. Use a double ==
[code]
($sold_for == "all")
[/code]

Share this post


Link to post
Share on other sites
lol thanx i looked over that atleadst 20 times and didn't catch it.anyways thnx

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.