Jump to content

triphis

Members
  • Posts

    62
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

triphis's Achievements

Member

Member (2/5)

0

Reputation

  1. Lol sorry. I always get impatient @_@ But that is exactly what I needed! Thank you SO much
  2. Hi! This is what I have: a vote tabulation system that has ballots entered twice to ensure correctness. Then, if the program finds any discrepancies between the 1st or 2nd entries, it will force a third verification. We assume that the ballotID is always entered correctly, and it is used to drive this verification process. My table: Columns(id, ballotID, politicianID, choice, entry) [all are ints] Let us pretend that I am only tabulating 50 votes. There will be 50 rows with entry=1. 50 rows with entry=2. And then some smaller number (say 5) of entry=3. So, for 5 of those votes, there will be 3 rows with the same ballotID. For any ballotIDs that DO NOT have a entry=3 row, then entry=1 and entry=2 are EQUIVALENT. The entry=3 rows are the most correct, and trump their ballotID equivalents with entry=1 and entry=2. I now need to select a "full set" of ballots. Where possible choosing the entry=3 equivalent, and where not possible, either the 1st or 2nd entry (since they are the same). I regret that this is part of a group project and we are too far into development to change the tables and other setups now... so I ask that you limit your suggestions to how I can deal with this situation, assuming I can't change anything else. Thank you for any help you can offer
  3. It's good that you were able to figure it all out... but I'm wondering why you wanted to echo all of that in the first place? I love PHP because you can just... exit it whenever you want, and go back to writing HTML... and then use <?=$VARIABLE?> when you need to. I find that makes things so much easier
  4. Okay, You still didn't provide all the details I need (mysql table structure for example...) But, I'll try one more time Hopefully you can adjust it how you want. <form action="search_result.php" method="post"> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="25%"class="gensmall">Search by:</td> <td class="gensmall"> <input type="radio" name="searchType" value="username">Username <input type="radio" name="searchType" value="email">Email <input type="radio" name="searchType" value="state">State </td> </tr> <tr> <td> </td> <td ><input type="text" name="searchTerm" size="35" ></td> <td width="25%" ><input type="submit" name="search" class="submit" value="Search"></td> </tr> </table> </form> <?php if (isset($_POST['search'])) // They have just tried the search { $searchType = $_POST['searchType']; $searchTerm = $_POST['searchTerm']; switch($searchType) { case 'username': $sql = "SELECT user_name FROM members_info WHERE user_name='$searchTerm' break; case 'email': $sql = "SELECT user_name FROM members_info WHERE email='$searchTerm' break; case 'state': $sql = "SELECT user_name FROM members_info WHERE state='$searchTerm' break; } $res = mysql_query($sql); $num_results = mysql_num_rows($res); for ($i = 0; $i < $num_results; $i++) { $row = mysql_fetch_array($res); $user_name = htmlspecialchars( stripslashes($row["user_name"])); echo " <div class=\"friendtable\"> <table width=\"100%\" border=\"0\" cellspacing=\"0\"> <tr> <td class=\"image\"> <img src=\"http:// \"> </td> <td class=\"info\"> <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td class=\"name\">Name:</td> <td class=\"name\">$user_name</td> <td class=\"actions\"><a style=\"text-decoration:none;\" href=\"http://\">View Profile</a></td> </tr> <tr> <td class=\"label\"> Network: </td> <td> <a href=\" \">Lander '09</a><br /> </td> <td class=\"actions\"> <a style=\"text-decoration:none;\" href=\"http://\">Send Message</a> <a style=\"text-decoration:none;\" href=\"\">Poke Dolores!</a> <a style=\"text-decoration:none;\" href=\"http://\">View Friends</a> <a style=\"text-decoration:none;\" href=\"http://\">Add to Friends</a> </td> </tr> </table> </td> </tr> </table> </div>"; } } ?> I suggest not using "radio1" "radio2" etc for the names of your radio buttons... I hope what I have done makes sense. Depending on the user choice, the code i offered runs 3 different mysql queries... If you don't understand it, I suggest you look up SWITCH, and maybe other php tutorials because you might not understand all you need to. Also, be careful with the email search box... special characters can cause issues
  5. Okay then Won't this work? <?php $searchType = $_POST['searchType']; $searchTerm = $_POST['searchTerm']; $sql = "SELECT * FROM members_info WHERE user_name='$searchType' AND something = '$searchTerm'"; ?> If not, how about something like this: <?php $searchType = $_POST['searchType']; $searchTerm = $_POST['searchTerm']; switch($searchType) { case radio1: $sql = some query... break; case radio2: $sql = some different query... break; case radio3: $sql = some other different query... break; default: $sql = not NEEDED, but nice to have a backup } // carry on with your code ?> o.O; If that doesn't work, please provide a few more details, because I don't really know how anything is structured
  6. Hrm, I don't think I fully understand what you mean. And your code partially confuses me, because searchType is in a mysql query as username? That would imply you only have 3 usernames, litterally names "radio1", "radio2", and "radio3" What I think you might be trying to do is have 3 different queries, each searching something different, depending on what the radio selection is. Is this correct?
  7. I'm sorry, I checked all the forums and didn't know where to ask this @_@ I really wanted to ask on phpfreaks.com though because everyone here answers 1) fast, and 2) correctly So I'm ACTUALLY working on a Java assignment... but the language shouldn't matter here... UML should be the same for all OO languages right? I am just wondering, what do I put as the return type for constructors (in the method/3rd box of a class diagram)? Constructors technically "return" an object of type CLASS (whatever it is constructing for) right? So do I put... + thisConstructor() : CLASS or should it be VOID? **OR** do I not even include constructors in UML diagrams? Thanks so much to anyone who can help me out
  8. boo_lolly gave you all the code you need. first off, your pages should PROBABLY be .php not .html, unless your server parses PHP on .html extension pages.... then, use the code boo gave you right in front of the text, but after the link... if that if statement is true, it will change the font color. and you can add <b> there too. if that statement is false (ie, that page isnt the current page) the text will be displayed exactly as your CSS or page settings want
  9. See PHPexperts? This would be a good thing to help with *nudge*
  10. Actually, I rethought my answer, and I decided I don't like it haha. I wouldn't even go that far. This can have such a simple solution... Why have 3 submit buttons? Why not have ONE submit button, and just make use of 3 radio buttons, one for each action you want? <input type="radio" name="uploadwhere" value="pictures"> Pictures<br> <input type="radio" name="uploadwhere" value="school"> School<br> <input type="radio" name="uploadwhere" value="random"> Random<br> Then, one the process page, just use: $_GET['uploadwhere']; to find out which of the 3 was chosen, and build your if/switch statements around that I'm sorry, I'm not very good at giving exact answers with codes... I just explain how I would solve it. Hopefully you understand what I outlined above. If you want to wait a bit, I am sure another person will help you out here
  11. You would need to incorporate javascript, and have the form actions depend on the button pushed. the school submit button could have a onClick="submitSchool()" attribute, and so on. The javascript functions could make the browser submit the info to formprocess.php?type=school type=random type=pictures etc And then you could pull that variable from the URL and have your process.php page know which branch to upload to, based on that variable
  12. Should I be offering more information? lol I don't know what else I can tell you
  13. Hey everyone I have managed in the past to do simple image uploading and resizing... but now I want to extend one of my scripts to make a THUMBNAIL of the newly resized image. I am having trouble "capturing" the just-resized image and running it through the same process again. Hopefully someone here can help The code seen below is on a page that accepts image uploads as an array... Thanks in advance! foreach($_FILES['images']['tmp_name'] as $temp) { if($temp != NULL) { $result = mysql_query("SELECT * FROM pictures WHERE productcode = '$productcode'") or die(mysql_error()); $number = mysql_num_rows($result) + 1; if($number == 1) { $main = 1; } else { $main = 0; } $directory = '../uploads/'; $filename = $productcode . "_" . $number . ".jpg"; $newfile = $directory . $filename; $uploadedfile = $temp; $src = imagecreatefromjpeg($uploadedfile); list($width,$height)=getimagesize($uploadedfile); $newwidth=250; $newheight=304; $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $justresized = imagejpeg($tmp,$newfile,100); // is this right??? $thumbdirectory = '../uploads/thumbs/'; $Tfilename = $productcode . "_" . $number . ".jpg"; // same name as before $Tnewfile = $thumbdirectory . $Tfilename; $uploadedfilethumb = $justresized; // I think this is where the problem is $srcthumb = imagecreatefromjpeg($uploadedfilethumb); list($Twidth,$Theight)=getimagesize($uploadedfilethumb); $Tnewwidth=100; $Tnewheight=100; $tmpthumb=imagecreatetruecolor($Tnewwidth,$Tnewheight); imagecopyresampled($tmpthumb,$srcthumb,0,0,0,0,$Tnewwidth,$Tnewheight,$Twidth,$Theight); if (imagejpeg($tmpthumb,$Tnewfile,100)) { echo "The image was uploaded, and the thumbnail was created!"; $entry = "INSERT INTO pictures(id,productcode,image,main) VALUES(NULL,'$productcode','$filename','$main')"; mysql_query($entry) or die(mysql_error()); imagedestroy($src); imagedestroy($tmp); } } } Also, if anyone can write a better confirmation-checker (ie: that both images were uploaded successfully) that would be great! Right now, the confirmation message is based only off the thumb... Which kinda makes sense since the thumb is created from the first one, but I think there must be a better way! Thanks again!
  14. you could save yourself some time by simply storing the times plainly (without all your formatting) like, just a timestamp... but then PULL IT OUT with the formatting. You would pull from your mysql table with: SELECT DATE_FORMAT('date_column','%Y-%M-%d') AS date.....
×
×
  • 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.