Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
Can you tell me what's wrong with this statement: $lock = mysql_query("SELECT * FROM `maintopics` WHERE `id` = '$topicid' AND `Lock` = '$lock' LIMIT 1")or die(mysql_error()); perhaps the variable $lock?
-
Oh boy, your error is easy to spot: if ($lock == `locked`){ echo "<table><tr><th>Sorry This Topic is Locked to New Replies</th></table>" elseif ($lock == `unlocked`){ <p></p> echo "<form action="" method="post"> <input type="hidden" name="forum" value="<? print $forum; ?>"> <table width="45%" align="center" class="tbl"> <tr><td align="center" class="hdr">Reply</td></tr> <tr><td align="center" class="sub">Message</td></tr> <tr><td align="center" class="tbl"> <textarea name="reply_message" cols="30" rows="3"></textarea> </td></tr> <tr><td align="center" class="sub"></td></tr> <tr><td align="center" class="tbl"> <? sub(submit,"Post Reply"); ?> </td></tr> </table> </form>" } There is a lot wrong with that code, try this: if ($lock == 'locked'){ echo "<table><tr><th>Sorry This Topic is Locked to New Replies</th></table>"; // add semicolon } else { // had no echo for the <p> tags // and the quotes were not escaped. Easy solution, take the html out of PHP. ?> <p></p> <form action="" method="post"> <input type="hidden" name="forum" value="<?php echo $forum; ?>"> <table width="45%" align="center" class="tbl"> <tr><td align="center" class="hdr">Reply</td></tr> <tr><td align="center" class="sub">Message</td></tr> <tr><td align="center" class="tbl"> <textarea name="reply_message" cols="30" rows="3"></textarea> </td></tr> <tr><td align="center" class="sub"></td></tr> <tr><td align="center" class="tbl"> <?php sub(submit,"Post Reply"); ?> </td></tr> </table> </form> <?php } Also, be careful using short tags (<?). I replaced them with normal tags (<?php), but there are still some in your code. Edit: I'm looking through the rest of your code, and there are a lot of typos. $numm = mysql_numrows($chk); should be $numm = mysql_num_rows($chk);, etc. Take a look over your code again.
-
Show more code please. Also, Enum ('Unlocked','locked') and $lock == "unlocked" can cause problems (case wise)
-
See here
-
I feel like you're not even trying to do this on your own. I have given you the separate code snippits, and explained what they are used for. I then showed you how to combine them, to what your original question was. Which I should remind you was: My code does exactly that. Now, I'll give you this pseudocode: Use the code I gave you, and try to accomplish that. Edit: correction to pseudocode.
-
They just need to re-count the post counts in the admin area. It probably happened since the db server went down
-
Okay, I don't think you understand your own logic. I'm going to put it with generic field names, so you will need to change the field names You want: "Passwords do not match" Thus, generically your logic statement would be: if($_POST['password1'] != $_POST['password2']) // Passwords didn't match "Password is too short, less than 4 character": if(strlen($_POST['password1'])<=4) // Password is too short Putting them together: if(($_POST['password1'] != $_POST['password2']) || (strlen($_POST['password1'])<=4)) // Password either doesn't match or is too short Now, to explain "if two variables are same they have same length." This is a correct statement. Think about it, if I type in "abcdef" and "abcdef", they are considered to be equal, correct? Thus, they will have the same length. Now, if they don't match, let's say "phil_was_here" and "hello" - they are not equal (passwords don't match), and you won't have to really worry about making sure they are the correct length (since they don't match)
-
You need this: if((trim($_POST['psswrd']) != trim($_POST['repsswrd'])) || strlen(trim($_POST['psswrd'])) <=4)
-
So, this reads: if (trim($_POST['psswrd']) != trim($_POST['repsswrd']) or strlen(trim($_POST['psswrd'])) >=4) If the trimmed passwords don't match or the length of the password is greater than or equal to 4...
-
Yup, whenever you come across that, take a look at your html source code when viewing the page. You'll notice it pretty quick
-
Because when it printed, it would print <liclass="selected" compared to: <li class="selected"
-
When looking at the source do you see the class="selected" ? Try this: echo "<li"; if($subject["id"] == $sel_subj) { echo " class=\"selected\""; } echo "><a href=\"content.php?subj=" . urlencode($subject["id"]) . "\"> {$subject["menu_name"]} </a></li>"; If that doesn't work, do this: if($subject["id"] == $sel_subj) { echo " class=\"selected\""; } echo "><a href=\"content.php?subj=" . urlencode($subject["id"]) . "\"> {$subject["menu_name"]} </a>"; echo " subjID: ".$subject["id"]." - getID: ".$sel_subj."</li>"; // debugging
-
You can do an array of characters to clean $array = array('\'', ',', '?'); str_replace($array, '_', $title);
-
Where is this coming from "$sel_subj"?
-
>=4 Read's "greater than or equal to 4". Think you want it the other way <=4
-
Replace echo '<li onselect="this.text.value = '.$name.'; document.getElementById(\'schoolID\').value ='.$id.'; ">$name</li>n'; with: echo '<li onselect="this.text.value = '.$name.'; document.getElementById(\'schoolID\').value ='.$id.'; ">'.$name.'</li>n'; You need to take the variable out of the quotes Syntax highlighting will help you in this case.
-
lol yeah I don't really look like the "computer" type, either. Most people think I'm some mafia hitman. Wouldn't surprise me...
-
Yup - reason was "item_id,)" - the extra comma
-
Change: $query1 = "INSERT INTO mailbox_insert_queue(sender_guid, receiver_guid, subject, body, stationary, money, item_id,) VALUES('$sender_guid', '$guid', '$subject', '$body', '$stationary', '$money', '$item_id')"; to: $query1 = "INSERT INTO `mailbox_insert_queue` (`sender_guid`, `receiver_guid`, `subject`, `body`, `stationary`, `money`, `item_id`) VALUES ('$sender_guid', '$guid', '$subject', '$body', '$stationary', '$money', '$item_id')"; echo $query1; I think I took care of the error, but echoing it would show where the error is if it is still in there.
-
Well, first you're using the exact comparison, when really a normal comparison (==) would do fine. Next, "NULL" shuld be NULL, without quotes. Finally, why not just use the is_null() function?
-
Having jQuery has nothing to do with this IMO. There aren't too many other ways to do this. A database, or flat files. As mentioned before, a database would 99% of the time be more efficient. There are probably things to do to streamline your current code, so you didn't have as many queries, but again, that's getting offtopic. I'd go with the database solution. You could try out both methods and test which creates less stress. Ultimately, it's up to you.
-
Help.. I Keep getting an Invalid Argument Error
Philip replied to conman90's topic in PHP Coding Help
Because you're not utilizing the return correctly. Try: $imageResized = resizeImage($oldimage, 100, 100); $filename = "pics/thumbnails/".$_FILES['uploadfile']['name']; imagejpeg($imageResized,$filename,100); -
Oh and to add onto what thorpe and I have said, take a look at the footer of this page for example: Yes, this is a dedicated server and all. However, think about how many hits this forum gets. Just some food for thought
-
I'm not trying to shoot you down, but I'd like to challenge your opinion. If you're using a database, you'd have to use a file. Wouldn't that use the same, if not more memory for each time you have to write to that log? Look into optimizing your current database, but if you can't have you considered a dedicated mysql server?
-
Netbooks because they may not have the processing power. Still, I should have the power to tell my PC to overwork itself. lol