3 selection is there: "sn_text_year" (which year is text wroten) "sn_text_author" (who is the author of the text - this is a cookie whith name of the user) "TextSearch" (if the user want to find some word in database)
<?php // UsrIdentify $query_user = mysql_query("SELECT * FROM `sn_users` WHERE `sn_users_username` = '".$_COOKIE['loggedin']."'");
if(!$query_user){ print mysql_error(); exit; }
$RequestUsrID = mysql_fetch_array($query_user);
$UsrID = $RequestUsrID['sn_users_id']; // HERE I CAN TAKE THE USERS ID ?>
<?php
if ( $TextSearch == '' && $UsrID ) { $QeryUsr = "SELECT * FROM `sn_text` WHERE `sn_text_godina` = '" . $_POST['sn_text_year'] . "' AND `sn_text_author` = '" . $UsrID . "' ORDER BY `sn_text_id` DESC"; }
if ( $TextSearch == '' && $UsrID == '' ) { $QeryUsr = "SELECT * FROM `sn_text` WHERE `sn_text_year` = '".$_POST['sn_text_year']."' ORDER BY `sn_text_id` DESC"; }
if ( $TextSearch && $UsrID == '' ) { $QeryUsr = "SELECT * FROM `sn_text` WHERE ucase(`area1`) LIKE '%".$TextSearch."%' OR lcase(`area1`) LIKE '%".$TextSearch."%' AND `sn_text_year` = '".$_POST['sn_text_year']."' ORDER BY `sn_text_id` DESC"; }
if ( $TextSearch && $UsrID ) { $QeryUsr = "SELECT * FROM `sn_text` WHERE ucase(`area1`) LIKE '%".$TextSearch."%' OR lcase(`area1`) LIKE '%".$TextSearch."%' AND `sn_text_year` = '".$_POST['sn_text_year']."' AND `sn_text_author` = '" . $UsrID . "' ORDER BY `sn_text_id` DESC";
1. Only year of text wroten 2. No text search, but identify User 3. No text search, no User identification - mean ilst all text 4. Search text, and identify User (mean searching word only in Users texts)
So, something is wrong, because: 1. when I choose Year, and list all text - list only my texts 2 when I choose Year, and list my texts - list only my texts 3. when I choose Year, and list my texts, with searching text - list only my text without choose 4. when I choos Year, and list all text, with serching text - its work fine
I see its a complicated, I hope, that You can give mi a solution