Jump to content

webdogjcn

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by webdogjcn

  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
  15. okay thak you so much. I got it working. One Last Question: I want users to be able to post articles/tutorials on my site, but I dont want them to have to enter in stuff like "<p class=scripting></p>" to get their stuff to look right. So, I was wondering how I can process the form they send in and replace all things like [SCRIPT] with "<p class=scripting>" or [FONTCOL=blue] with "<font color='blue'>" etc. Anyways so the user would fill out a form like this: [code]<form action=articlepost.php method=post> <input type=text name="artname"> <textarea name="article"></textarea>[/code] And take whatever is in "article" and replace all occurances of BB style coding with the actual html before inserting it into the db
  16. I have no clue how I want to do this, but I am putting up some tutorials on my website and I want users to be able to write their own reviews of them. However, I am limited to one db for my whole site which means user accounts, articles, everything. Anyways I do not want to use a table for every article. I was even hoping I could have the users fill out a form and create a text file from the information and then just include it in my page. How would I do this. I am not sure where to start so if you could be as specific as possible.
  17. Alright, thanks for all the help, but I managed to figure it out by myself. I have a new problem, shouldn't be as big of a deal..... [code]if ($getrating < 6 || $getrating > 0) { $numrates ++; //Adds one to the total number of times this file has been rated $ccc = $ratesum; //Used to update the db below $ratesum += $getrating; //adds the user's own rating to the total $ratesum /= $numrates; //find the average $sqlquery = "UPDATE user_files SET file_rates='$numrates',file_ratesum='$ccc',file_rating='$ratesum' WHERE file_id='$id'"; mysql_query($sqlquery) or die("Error: ". mysql_error(). " with query ". $sqlquery); }[/code] $getrating come from $_GET[]. This script is used to rate a file. Okay so I want to find the average of all the ratings that have been made on the file so, everytime I rate the file it takes the # (1-5) (found in $getrating) and adds it to the total then takes that number and divides it by the times teh file has been rated. PROBLEM: The only part that gets updated in the db is the file_rates nothing else.
  18. alright samshell's idea has passed the value of ID onto the script so it works now, thx. The only problem is that it is still not returning the value of $content from the database. Here is the column info for file_desc: type: varchar maxlength: 100 null: no Here is the specific info for the entry with file_id equal to 3: file_id: 3 file_name: ag5.png file_size: 34394 file_type: Images file_path: ... file_creator: webdogjcn file_desc: This is the default logo for the Alternative Gaming Website. Copyright 2006. All rights reserved. It is returning this error: The value of id is 3 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''user_files' WHERE file_id='3'' at line 1 with query SELECT * FROM user_files WHERE file_id='3' $content=mysql_query("SELECT 'file_desc' FROM 'user_files' WHERE file_id='$id'") or die("Error: ". mysql_error(). " with query ". $sql); The $sql is where I ran the query earlier just w/o the SELECT 'file_desc' aprt and just SELECT * (I did that for different reasons as I was trying to find a way to get this working). n/m I took out the single quotes ('.') around the file_desc and user files. However I now just get "The value of id is 3" and it never displays the text stored in file_desc
  19. Crayon Violent: No, it still doesn't work. I am going to try samshell's suggestion as I think it should work...I will edit later if the problem is still not solved
  20. I dont see how that would be the problem, the description page URL looks like this: [a href=\"http://mysite.com/members/upload/files/filepage.htm?id=3\" target=\"_blank\"]http://mysite.com/members/upl...lepage.htm?id=3[/a] not [a href=\"http://mysite.com/members/upload/files/filepage.htm?id=\" target=\"_blank\"]http://mysite.com/members/upl...ilepage.htm?id=[/a]
  21. Yea it comes from a link. I have a list of files uploaded, where each file's info is stored in a db and on a page filelist.htm I display all the uploaded files. Well, I want a description page for each file so I did this: echo"<a href='http://mysite.com/members/upload/files/filepage.htm?id=$fileid'>$filename</a>"; and when the user clicks on the link it will send them to [a href=\"http://mysite.com/members/upload/files/filepage.htm?id=3\" target=\"_blank\"]http://mysite.com/members/upload/files/filepage.htm?id=3[/a] (in this example).
  22. Wow, this is really starting to frustrate me. I put exactly what you have in there Andy B. (except for the db info which I added in there) and it returned simply this: "The value of id is "
  23. Alright I played around with the code some and here's what I have (filepage.php): [code]<?php $name=""; $lock=""; $database=""; $id = @$_GET['id']; echo "$id"; mysql_connect("",$name,$lock) or die(mysql_error()); @mysql_select_db($database) or die( "Unable to select database"); $sql = "SELECT * FROM user_files WHERE file_id='$id'"; $query = mysql_query($sql); $info = mysql_fetch_array($query); $content = $info['file_desc']; $thumburl = $info['file_pic']; if ($content='0')    {echo "The user has not supplied a description for this file"; } else    {echo "$content";} ?>[/code] It is displaying 0 which I believe is the echoed value of $id. So apparently it is not being passed. How can I fix this problem?
  24. woops...sorry. I have a line in filepage.htm like this: <?php include('http://mysite.com/filepage.php'); ?> and then the $_GET code is in the filepage.php file Crayon_violet: I will try what you suggested and repost the error. This time I got no error at all. Nothing showed up whatsoever, and I know that there is information in that row on my database. Here is the filepage.php coding [code]<?php $name=""; $lock=""; $database=""; $id = @$_GET['id']; mysql_connect("",$name,$lock); @mysql_select_db($database) or die( "Unable to select database"); $sql = mysql_query("SELECT * FROM user_files WHERE file_id='$id'") or die or die (mysql_error()); $info = mysql_fetch_array( $sql ); $content = $info['file_desc']; $thumburl = $info['file_pic']; if ($content='')    {echo "The user has not supplied a description for this file"; } else    {echo "$content";} ?>[/code]
×
×
  • 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.