Jump to content

INSERT INTO problem


djp1988

Recommended Posts

Hello, I have a problem with my user rating system:

require_once ('mysql_connect.php');$userid = $_SESSION['user_id']; // Make the user id a variable$query = "SELECT member_id, trip_id, note FROM note_trips WHERE member_id = $userid AND trip_id = 3"; // query if there is a result for this member id on this trip (this page)$result = mysql_query ($query, $dbc);$row = mysql_fetch_array ($result, MYSQL_BOTH);if($row){ //if there is a result to display then he has already voted on this page	echo 'You have already voted';	}else{		if(isset($_GET['n'])){ // otherwise if he has not voted and the $_get has a value, get the value and set it in a variable		$note = (int) $_GET['n'];		if ($note <6) {			$query = "INSERT INTO note_trips(note_id,trip_id,member_id,note) VALUES('',3,$userid,$note)"; // and insert that value along with the predefined id of the trip (page) and the member id			} 		}	echo '<form action="test.php" method="get" id="note"  > // this is the vote form	<select name="note" onchange="MM_jumpMenu(\'parent\',this,0)">	<option value="">Rate this Report</option>';	$query = "SELECT id_note	FROM note_name	ORDER BY id_note ASC";	$result = mysql_query ($query, $dbc);	while ($row = mysql_fetch_array ($result, MYSQL_BOTH)) {	echo"<option name=\"note\" value=\"test.php?n={$row['id_note']}\">{$row['id_note']}</option>\n";	}	echo '</select></form>';		}

Link to comment
Share on other sites

Err... what sort of problem?By the way, I think you'd find the mysql_num_rows() function useful.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...