Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. Have you tried google? http://www.codewalkers.com/c/a/Database-Articles/Creating-a-Search-Application/ http://www.plus2net.com/sql_tutorial/search-keyword.php http://aspn.activestate.com/ASPN/Cookbook/PHP/Recipe/125901 There are plenty more too.
  2. Okay, manually put something in the URL. Just add this ?id=1 Then submit the form. That makes them different, I just tested it.
  3. Well, the URL holds the community ID, right? Well...that code checks if the ID in the URL is equal to 43, and if it is, it will display the link. Have you tried it yet?
  4. You are using a question mark to separate them, you need to use (&). <?php echo "<a href=editzip.php?groupid=$groupid_sent&zipid=$acc3[search_id]>Edit</a> || <a href=deletezip.php?zipid=$acc3[search_id]>Delete</a> - $acc3[zipcode] - $acc3[city] <br>"; ?>
  5. wildteen88 - If you changed your form method to GET they wouldn't end up the same.
  6. Wherever you want it on that page, just put this code there: <?php if ($_GET['ID'] == 43){ //put link here } ?>
  7. It is because $_REQUEST holds the values for both GET and POST.
  8. The images I have been testing with are GIF files. BEFORE they are resized, they are perfectly transparent...it's just when they are converted to thumbnails the parts that are supposed to be transparent come out black.
  9. Here is the updated code with Barands modifications in it: <?php function uploadThumb($name, $filename, $new_w, $new_h, $ext) { if ($ext == 'jpg'){ $src_img = imagecreatefromjpeg($name); } else if ($ext == 'gif'){ $src_img = imagecreatefromgif($name); } else if ($ext == 'png'){ $src_img = imagecreatefrompng($name); } $old_x=imageSX($src_img); $old_y=imageSY($src_img); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } if ($thumb_w > $old_x && $thumb_h > $old_y){ $thumb_w = $old_x; $thumb_h = $old_y; } $transparentColor = imagecolortransparent($src_img); // get transparent color in source $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); imagecolortransparent($dst_img, $transparentColor); // apply it to the dest image if ($ext == 'jpg'){ imagejpeg($dst_img,$filename); } else if ($ext == 'gif'){ imagegif($dst_img,$filename); } else if ($ext == 'png'){ imagepng($dst_img,$filename); } imagedestroy($dst_img); imagedestroy($src_img); } ?> Without Barands modifications: <?php <?php function uploadThumb($name, $filename, $new_w, $new_h, $ext) { if ($ext == 'jpg'){ $src_img = imagecreatefromjpeg($name); } else if ($ext == 'gif'){ $src_img = imagecreatefromgif($name); } else if ($ext == 'png'){ $src_img = imagecreatefrompng($name); } $old_x=imageSX($src_img); $old_y=imageSY($src_img); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } if ($thumb_w > $old_x && $thumb_h > $old_y){ $thumb_w = $old_x; $thumb_h = $old_y; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if ($ext == 'jpg'){ imagejpeg($dst_img,$filename); } else if ($ext == 'gif'){ imagegif($dst_img,$filename); } else if ($ext == 'png'){ imagepng($dst_img,$filename); } imagedestroy($dst_img); imagedestroy($src_img); } ?>
  10. You can do it this way: <?php print<<<HERE All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. All your HTML/text goes here. HERE; ?>
  11. <?php $string = "adfsgfa23aa13aa21a"; $letters = str_split($string); $count = 0; foreach ($letters as $letter){ if ($letter == 'a') $count++; } echo "There were <b>$count</b> a's in the string"; ?>
  12. Still giving me the black background. Thanks for the help
  13. I have a script that will upload an image, then create a thumbnail of that image. When I upload an image with a transparent background the normal sized image comes out with a transparent background, but the thumbnail image comes out with a black background. I am thinking I need the function imagecolortransparent(), but I'm not really sure how to incorporate it into the thumbnail generation code. <?php function uploadThumb($name, $filename, $new_w, $new_h, $ext) { if ($ext == 'jpg'){ $src_img = imagecreatefromjpeg($name); } else if ($ext == 'gif'){ $src_img = imagecreatefromgif($name); } else if ($ext == 'png'){ $src_img = imagecreatefrompng($name); } $old_x=imageSX($src_img); $old_y=imageSY($src_img); if ($old_x > $old_y) { $thumb_w=$new_w; $thumb_h=$old_y*($new_h/$old_x); } if ($old_x < $old_y) { $thumb_w=$old_x*($new_w/$old_y); $thumb_h=$new_h; } if ($old_x == $old_y) { $thumb_w=$new_w; $thumb_h=$new_h; } $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); if ($ext == 'jpg'){ imagejpeg($dst_img,$filename); } else if ($ext == 'gif'){ imagegif($dst_img,$filename); } else if ($ext == 'png'){ imagepng($dst_img,$filename); } imagedestroy($dst_img); imagedestroy($src_img); } ?> Any help with getting the thumbnail image to come out transparent, if the original picture is transparent, will be much appreciated =] Thanks
  14. It means that there is something wrong with your query. Put a die statement at the end of it. EX. $result = mysql_query($query)or die(mysql_error()); That will tell you what went wrong.
  15. Look, I gave you the code showing you how to do it.
  16. Now all you need to do is add a query to the profile page that gets info from the database according to whos ID is in the URL. <?php $id = mysql_real_escape_string($_GET['id']); $query = "SELECT * FROM members WHERE memberID='$id'"; $result = mysql_query($query)or die(mysql_error()); $row = mysql_fetch_assoc($result); //Now echo their information //You will need to replace inside of $row array with your db field names echo $row['col1'].'<br>'; echo $row['col2'].'<br>'; echo $row['col3'].'<br>'; echo $row['col4'].'<br>'; ?>
  17. Give This a try. <?php $query = "SELECT COUNT(*) FROM search WHERE (price BETWEEN $min_price AND $max_price": if (!empty($minBeds)) $query .= " AND bedrooms >= $min_bedrooms"; $query .= " AND location = '$location' AND type = '$property_type' AND `keywords` LIKE '%$keywords%') OR (price BETWEEN $min_price AND $max_price"; if (!empty($minBeds)){ $query .= " AND bedrooms >= $min_bedrooms"; $query .= " AND location = '$location' AND type = '$property_type')"; $result = mysql_query($query)or die(mysql_error()); ?>
  18. Take a look at this tutorial http://php.about.com/od/advancedphp/ss/rename_upload.htm It shows you exactly how to do it. Google brings up a lot of different tutorials, so you might want to try that if the tut I gave you doesn't work.
  19. There is something wrong with one of your queries. Put a die statement at the end of all of them. Example $result = mysql_query($query)or die(mysql_error()); This will give you an error telling you what went wrong.
  20. I took this HTML straight from your page source and edited it. <table height="100%" align='center' valign='center'> <td> <form action="login.php" method="post"> <table border="0" align='center' valign='center'> <tr> <td align="center" style="color: #fff;">Username:</td> <td align="center"><input type="text" name="username" /></td> </tr> <tr> <td align="center" style="color: #fff;">Password:</td> <td align="center"><input type="password" name="password" /></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" value="Submit" /></td> </tr> </table> </form> </td> </table>
  21. You could resort to OOP, but that all depends on how big this script is. If it isn't very big, I would just write a simple function. <?php function display_news(){ //query database while ($row = mysql_fetch_assoc($result)){ <div class="boxtop"><h4> <?php echo $row['news_title']; ?> </h4></div> <div class="boxbottom"><br /> <?php echo $lang_id . $row['news_id'].'<br />'; echo $lang_author . $row['news_author'].'<br>'; echo $lang_date. $row['news_date'].'<br />'; echo $row['news_body'];</div> } } ?> Now, wherever you want to display the news, all you have to do is display_news(); Obviously that function needs to be changed up depending on how you want it to work. You could add parameters to the function to only display a certain amount of results, or whatever.
  22. <?php $user = $_POST['user']; $query = "SELECT col FROM users WHERE user='$user'"; $result = mysql_query($query)or die(mysql_error()); if (mysql_num_rows($result) > 0){ echo "Found a match!"; } else { echo "No results found."; } ?>
  23. This isn't PHP. You either need to use HTML, or CSS. http://www.tizag.com/cssT/font.php http://webdesign.about.com/od/fonts/a/aa082400a.htm
×
×
  • 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.