pocobueno1388
Members-
Posts
3,369 -
Joined
-
Last visited
Never
Everything posted by pocobueno1388
-
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.
-
[SOLVED] $_POST is different from $_REQUEST
pocobueno1388 replied to Xeoncross's topic in PHP Coding Help
Okay, manually put something in the URL. Just add this ?id=1 Then submit the form. That makes them different, I just tested it. -
[SOLVED] PHP if statement for specifc criteria
pocobueno1388 replied to jiggens's topic in PHP Coding Help
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? -
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>"; ?>
-
[SOLVED] $_POST is different from $_REQUEST
pocobueno1388 replied to Xeoncross's topic in PHP Coding Help
wildteen88 - If you changed your form method to GET they wouldn't end up the same. -
[SOLVED] PHP if statement for specifc criteria
pocobueno1388 replied to jiggens's topic in PHP Coding Help
Wherever you want it on that page, just put this code there: <?php if ($_GET['ID'] == 43){ //put link here } ?> -
[SOLVED] $_POST is different from $_REQUEST
pocobueno1388 replied to Xeoncross's topic in PHP Coding Help
It is because $_REQUEST holds the values for both GET and POST. -
[SOLVED] Make thumbnail transparent help
pocobueno1388 replied to pocobueno1388's topic in PHP Coding Help
Nope, still getting the same result :/ -
[SOLVED] Make thumbnail transparent help
pocobueno1388 replied to pocobueno1388's topic in PHP Coding Help
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. -
[SOLVED] Really Easy Question - PHP ECHO
pocobueno1388 replied to C4talyst's topic in PHP Coding Help
Don't forget to solve the topic -
[SOLVED] Make thumbnail transparent help
pocobueno1388 replied to pocobueno1388's topic in PHP Coding Help
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); } ?> -
[SOLVED] Really Easy Question - PHP ECHO
pocobueno1388 replied to C4talyst's topic in PHP Coding Help
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; ?> -
[SOLVED] Return number of characters in a string
pocobueno1388 replied to gigantorTRON's topic in PHP Coding Help
<?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"; ?> -
[SOLVED] Make thumbnail transparent help
pocobueno1388 replied to pocobueno1388's topic in PHP Coding Help
Still giving me the black background. Thanks for the help -
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
-
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.
-
Look, I gave you the code showing you how to do it.
-
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>'; ?>
-
How to eliminate drop down selections from SQL query
pocobueno1388 replied to AdRock's topic in PHP Coding Help
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()); ?> -
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.
-
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.
-
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>
-
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.
-
<?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."; } ?>
-
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