Jump to content

Unknown column 'member' in 'where clause' Help PHP

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
coated_pill

coated_pill

    Newbie

  • Members
  • PipPip
  • 12 posts
this error message pop up every time i click the download link.. where seems i made a mistake.. please help me..

here is the download.php script
<?php

//fetch variables

$vid_id = $_REQUEST['id'];

$usr_ip = $_SERVER['REMOTE_ADDR'];

$state = "false";

$date = date("Y-m-d");


$member_id = $_REQUEST['member'];include ("includes/connect.inc");


//validation 1: if more that 10 dls

$ret_history = mysql_query("SELECT * FROM members WHERE member = '$member_id'") or die(mysql_error());

$count = mysql_num_rows($ret_history);


//validation 2: verify repeated downloads - di pede

$dl_file = mysql_query("SELECT * FROM members WHERE member = '$member_id' AND vid_id = '$vid_id'") or die(mysql_error());

$dl_count = mysql_num_rows($dl_file);


//validation 1

if ($count >= 10) {

?>

  <span class="style7">You have reached your maximum downloads for this month!</span>

<?php

//validation 2

} else if ($dl_count > 0) {

?>

<span class="style7">You have already downloaded this file!</span>

<?php

} else {



//get video url

$dl_vid = mysql_query("SELECT * FROM members WHERE vid_id = '$vid_id'") or die(mysql_error());

$file = mysql_fetch_array($dl_vid);

?>

<div align="center"<a href="file/?fileid=<?php echo $file['vid_id']; ?>" class="style1 style2"><br /><br /><br /><br /><br />Download Now</a><br /><br />

<span class="style4">Warning !!! </span><br />

<span class="style3">Don't refresh this page or click back button while downloading.. The validation will expire after the download finish.</span>

<?php

//note this valid download to database


mysql_query("INSERT INTO members VALUES ('$member_id','$vid_id','$date')") or die(mysql_error());


}

?>

here is my table
Posted Image

Edited by TcM, 25 July 2008 - 03:47 AM.


#2
chili5

chili5

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 7,247 posts
First use code tags :D

The problem is these lines:

$ret_history = mysql_query("SELECT * FROM members WHERE member = '$member_id'") or die(mysql_error());

...

$dl_file = mysql_query("SELECT * FROM members WHERE member = '$member_id' AND vid_id = '$vid_id'") or die(mysql_error());

their is no "member" field in your database, so your trying to select from a field that doesn't exist.

change to:

$ret_history = mysql_query("SELECT * FROM members WHERE member_id = '$member_id'") or die(mysql_error());

....

$dl_file = mysql_query("SELECT * FROM members WHERE member_id = '$member_id' AND vid_id = '$vid_id'") or die(mysql_error());

:D

Edited by chili5, 25 July 2008 - 12:20 PM.


#3
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
Added code tags.

Great help.