Jump to content

Reading Mysql Table Correctly


jnerotrix

Recommended Posts

Its supposed to check if $memberid is in there and check if  $memberid matches member_id and if they match do not display that survey id

 

This is They Query i have so far but it doesnt do what i want it to do

 

$query = "select survey.id, survey.title, survey.adlink from survey left join completed_surveys on ( survey.id = completed_surveys.survey_id ) WHERE completed_surveys.survey_id IS NULL AND completed_surveys.member_id=$memberid";

 

and heres the whole code

 

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

$memberid = (is_numeric($_GET['id'])) ? $_GET['id'] : 0;
$query = "select survey.id, survey.title, survey.adlink from survey left join completed_surveys on ( survey.id = completed_surveys.survey_id ) WHERE completed_surveys.survey_id IS NULL AND completed_surveys.member_id=$memberid";
$result = mysql_query($query) or die(mysql_error());
?>
Number Of Surveys Available = <?php echo mysql_num_rows($result); ?>

<?php
while($row = mysql_fetch_array($result)){
echo "<tr><td><a href=\"survey.php?id={$row['id']}\">{$row['title']}</a></td></tr>";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/136139-reading-mysql-table-correctly/
Share on other sites

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.