Jump to content

webdogjcn

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

webdogjcn's Achievements

Member

Member (2/5)

0

Reputation

  1. alright thanks i feel really dumb. One more question...This code is being used to search a database for specific entries so Im using this right now elseif ($_POST["desc"] == 'info') { $query=mysql_query("SELECT * from classes WHERE Category=$_POST[subject] && Number=$_POST[course]"); if (mysql_num_rows($query) > 0){ echo" Entry Found Redirecting to Class Page..."; } else{ header('Location: http://somesite.com/search_classes.php?error=dne'); } I search for values I know exist in the database and it still redirects me. If I eliminate the $_POST[subject] search however, it can find it. I think it has to do with the type of variables in the table. the $_POST[course] is an integer value in the table and I converted it early using if (isset($_POST["course"])) {$_POST["course"] = intval ($_POST["course"]);} //converts form value to integer however the Category field is classified as a VARCHAR string in the table. Could this be the reason why it cannot locate the entry? if so how do I convert a $_POST string to VARCHAR? or am I making another simple error
  2. I could just be over looking something incredibly simple here but im processing this form from one page: <form action="search_classes_process.php" method="post"> <input name="desc" type="hidden" value="number"> Unique KU Class Number: <input type="text" name="classid"><br> <input type="Submit" value="Search"> </form> NOTE: the purpose of the hidden input value is because there are several forms on this page all being processed through the same "search_classes_process.php" file. And the hidden value is to identify which form we are processing. Now on our "search_classes_process.php" file we have: mysql_select_db($database, $con); if ($_Post["desc"] == "number") { $query="Select KUclassID from classes where KUclassID='$_Post[number]'"; if ($query){ echo" Exists"; } else{ echo"DNE"; } } else { echo "error"; echo $_Post["desc"]; } Now Im not getting any PHP errors or anything. I have tried eliminating all the db checking and gone with simple isset($_Post["desc"]) checks and it isset but if i try echo $_Post["desc"]; I still get nothing. NOTE: I have tried changing the type of field out of hidden as well
  3. Yea, nevermind I figured it out...thanks everyone for the help
  4. Okay I did that and I noticed I wasn't adding in the hour to the query which caused some wierd problems. However, now it just displays nothing with the error: Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource Which obviously means that nothing is being returned by the query Here is the current code: [code]$minute_other= ($minute - 16); $minute++; $query=mysql_query("SELECT user_name FROM user_info WHERE log_year='$year' AND log_month='$month' AND log_day='$day' AND $log_hour='$hour' AND log_minute BETWEEN '$minute_other' AND '$minute'"); $online=mysql_numrows($query); $i = 0; while($i < $online) { $users = mysql_result($query,$i,'user_name'); echo $users['user_name']. " "; $i++; }[/code] It should work b/c what is set as the users log time is this: +-Year----Month----Day----Hour----Minute----+ +--2006----06--------08------17--------55-------+ And the current timestamp is +--2006----06--------08------17--------56-------+ So why is it not working?
  5. Now I am just getting: Warning: implode(): Bad arguments. in /home/www/altgames.awardspace.com/members/forums/index.htm on line 118 [code]line 118: $all=implode(",", $users);[/code] I really need help!
  6. [code] $year = date(Y); $month = date(m); $day = date(d); $hour = date(H); $minute = date(i); // Do this everythime I view a page in the forum mysql_query("UPDATE user_info SET log_year='$year' WHERE user_name='$user'"); mysql_query("UPDATE user_info SET log_month='$month' WHERE user_name='$user'"); mysql_query("UPDATE user_info SET log_day='$day' WHERE user_name='$user'"); mysql_query("UPDATE user_info SET log_hour='$hour' WHERE user_name='$user'"); mysql_query("UPDATE user_info SET log_minute='$minute' WHERE user_name='$user'"); [/code] [code] $minute_other= ($minute - 16); $minute++; $query=mysql_query("SELECT user_name FROM user_info WHERE log_year='$year' AND log_month='$month' AND log_day='$day' AND log_minute BETWEEN '$minute_other' AND '$minute'"); if (!$query){ echo"mysql_error()"; } echo"username: $user and minutes: $minute and $minute_other<br>"; $users=mysql_fetch_array($query); $all=implode(",", $users); echo"$all";[/code] Okay I have tried logging in as three different users but only the first one is listed and it gets listed twice. I have displayed the values of the different users login times and compaired them and they fit within the range defined in the BETWEEN statement.
  7. Okay, thanks for the help. But one more question, what about convereting user entered line breaks to <br>? Because when someone presses enter in a textarea it will just recognize it as a space not a line break.
  8. okay so I have a fast reply form and a link that lets you insert emoticons. well i have everything working where a pop-up appears and the emoticon text is displayed like ";sad;" (replace ; with :) and now I want to convert all instances (when they submit the form) of ;sad; with <image src="sad.gif" alt=sad>
  9. alright, thanks everyone I will post later if I have anymore questions
  10. okay...ill use the htmlentities... I think I understand buyocat, but if I get a lot of users and end up with a lot of posts this will use a great deal of db space
  11. the problem with that is that if several posts were made since you've been online...they will all appear as though they have been read
  12. alright, I will look into AJAX and stiptags, the main problem with cookies is Im not sure how I can store all of the information into one cookies w/o it being huge I thought of this: [code]$temp=$_COOKIE['topicsread']; $topic_id=",$_GET['id'];" $cookie_life = 365*24*3600; Setcookie(topicsread,$temp.$topic_id,time()+$cookie_life); [/code] Then expanding it up with EXPLODE where "," is found and somehow searching the resulting array for the newest topic id and if it is there then display the "No New Posts image" and else display the "New Posts Image". Two problems arise: 1. I do not think I can add a "," in there like that 2. I do not know how to search an array
  13. Okay so, I need to know how to do the following with my forum:[ol type=\'1\'][*]Figuring out whether or not the user has viewed the newest post or not[*]Creating a Quick Reply box (im guessing I will have to do this w/ javascript if I want it without having to reload the page)[*]removing html from the title entry (so the user cant put in like <b><image src=''>HEY LOOK AT ME</b> to make their post title stand out)[/ol] I have four tables in my db: categories, forums, topics, replies You should be able to figure out how I am trying to do it from there. I really need this so if you can help out at all that would be really appreciated
  14. alright I'll take a look at them, thanks for the help
×
×
  • 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.