Jump to content

[SOLVED] Dont Display Link if already clicked


jnerotrix

Recommended Posts

  • Replies 76
  • Created
  • Last Reply

ok one last piece to edit

 

the index.php where it displays available surveys

 

===================================

 

Heres the code We need to make it so if it is in the complete_surveys then dont show that survey

 

<td><font size="6"> Surveys Available </font></td>
<td>
<?php
mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM survey";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<a href=\"survey.php?id={$row['id']}\">{$row['title']}</a><br>\n";
}
?>
</td></tr>
</table>

Heres The Code I have to Do This

 

mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error());
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$member = mysql_real_escape_string($_SESSION['userid']);
$survey = mysql_real_escape_string($_GET['id']);

mysql_query("INSERT INTO completed_surveys 
(member_id, survey_id) VALUES('$member', '$survey') ") 
or die(mysql_error());  

 

All we need to do is edit this code to only show surveys that havent been completed

 

 

<td><font size="6"> Surveys Available </font></td>
<td>
<?php
mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM survey";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<a href=\"survey.php?id={$row['id']}\">{$row['title']}</a><br>\n";
}
?>
</td></tr>
</table>

change this;

 

</tr>

<?php
mysql_connect("localhost", "sex1800_admin", "****") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM surveys";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href="survey.php?id={$row['id']}">{$row['title']}</a></td></tr> ";
}

 

to this;

 

</tr>

<?php
mysql_connect("localhost", "sex1800_admin", "****") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM surveys JOIN completed_surveys ON surveys.id!=completed_surveys.survey_id AND memberid={$_SESSION['userid']}";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href="survey.php?id={$row['id']}">{$row['title']}</a></td></tr> ";
}

Now i get this Error

 

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home3/sex1800/public_html/epicbux/index.php on line 95

 

Heres lines 85 - 100

 

<tr>
<td><font size="6"> Surveys Available </font></td>
<td>
<?php
mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM surveys JOIN completed_surveys ON surveys.id!=completed_surveys.survey_id AND memberid={$_SESSION['userid']}";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href="survey.php?id={$row['id']}">{$row['title']}</a></td></tr>";
}
?>
</td></tr>
</table>

<tr>
<td><font size="6"> Surveys Available </font></td>
<td>
<?php
mysql_connect("localhost", "sex1800_admin", "****") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM surveys JOIN completed_surveys ON surveys.id!=completed_surveys.survey_id AND memberid={$_SESSION['userid']}";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href="survey.php?id={$row['id']}">{$row['title']}</a></td></tr>";
}
?>
</td></tr>
</table>

now it displays the page but where it should display the surveys it displays

 

Unknown column 'df1063585e41cc161b358347877f900c' in 'on clause'

 

Heres the code though i fixed it to match my tables

 

<?php
mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM survey JOIN completed_surveys ON survey.id!=completed_surveys.survey_id AND member_id={$_SESSION['userid']}";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>";
}
?>

put this in for an error check;

 

<?php
mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM survey JOIN completed_surveys ON survey.id!=completed_surveys.survey_id AND member_id={$_SESSION['userid']}";
echo $query;
die();
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>";
}
?>

what should i put for the mysql code

 

instead of this

<?php
mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM survey JOIN completed_surveys ON survey.id!=completed_surveys.survey_id AND member_id={$_SESSION['userid']}";
echo $query;
die();
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>";
}
?>

ok, having a little error :P

 

didn't realise that the member_id was hashed.

 

in the table completed_surveys change member_id from INT to VARCHAR 32

 

 

did you do that??

 

If you did delete all the entries in the table and it should work fine

ok, change this

 

<?php
mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM survey JOIN completed_surveys ON survey.id!=completed_surveys.survey_id AND member_id={$_SESSION['userid']}";
echo $query;
die();
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>";
}
?>

 

back to this

 

<?php
mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM survey JOIN completed_surveys ON survey.id!=completed_surveys.survey_id AND member_id={$_SESSION['userid']}";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>";
}
?>

try this;

 

<?php
mysql_connect("localhost", "sex1800_admin", "12921993") or die(mysql_error()); //add you password
mysql_select_db("sex1800_loginbux") or die(mysql_error());

$query = "SELECT * FROM survey JOIN completed_surveys ON survey.id!=completed_surveys.survey_id WHERE member_id={$_SESSION['userid']}";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>";
}
?>

Archived

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

×
×
  • 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.