Jump to content

[SOLVED] Dont Display Link if already clicked


jnerotrix

Recommended Posts

  • Replies 76
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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>

Link to comment
Share on other sites

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());  

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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> ";
}

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

<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>

Link to comment
Share on other sites

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>";
}
?>

Link to comment
Share on other sites

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>";
}
?>

Link to comment
Share on other sites

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>";
}
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>";
}
?>

Link to comment
Share on other sites

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>";
}
?>

Link to comment
Share on other sites

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.