Jump to content

pmiller624

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pmiller624's Achievements

Member

Member (2/5)

0

Reputation

  1. I have three tables that when simplified are set up like below. tag_map +--------+--------+ | user_id | tag_id | +--------+--------+ | 1 | 1 | | 2 | 1 | | 2 | 2 | /*etc*/ tags +--+---------+ | id | name | +--+---------+ | 1 | PHP | | 2 | mySQL | /*etc*/ user +--+ | id | +--+ | 1 | | 2 | I have an sql query that looks like: SELECT * FROM tag_map JOIN `users` ON tag_map.user_id = users.id WHERE tag_id = 1 OR tag_id = 2 If you were to run this query on the data above user 2 would come up twice because he has the tags of 1 and 2. So my question is how can I make it so the query only selects a users id number once, no matter how many times his tag pops up?
  2. Thank you so much, I wasn't aware that there are more parameters in ImageJpeg, worked perfect.
  3. Hello, I'm trying to create a simple 'not available' image with a dynamic width and height. My problem is that above the text, in the image, the colors get a little distorted/blurred. I have attached an example of the problem... Here's my code... $width = $_GET['w']; $height = $_GET['h']; $font = "arial.ttf"; $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 204, 204, 204); $background = ImageColorAllocate($image, 46, 46, 46); ImageFill($image, 0, 0, $background); $box = @imageTTFBbox(11,0,$font,'NOT AVAILABLE YET'); imagettftext ( $image, 11, 0, $width/2-($box[4]/2), $height/2-($box[6]/2)+20, $grey, $font, 'NOT AVAILABLE YET' ); $box = @imageTTFBbox(15,0,$font,'?'); imagettftext ( $image, 15, 0, $width/2-($box[4]/2), $height/2-($box[6]/2), $grey, $font, '?' ); header("Content-Type: image/jpeg"); ImageJpeg($image); ImageDestroy($image); Anyone know why this is happening? Thanks [attachment deleted by admin]
  4. In my PHP application I receive a date and time string in the format like so... Wed, 03 Mar 2010 22:07:46 +0000 what would be the best way to store this in mysql? what would be the best way pull it from mysql and be able to use PHP's date()? I'm asking this because 'Wed, 03 Mar 2010 22:07:46 +0000' isn't a valid date string (at lest I don't think it is) so when I use date(), it's formatting the date wrong. Thanks ps sorry if this belongs in the mysql section
  5. Alright on my site I will be giving reviews, screen shots, and walkthroughs on games (yes its a game site). Not every game review will have screen shot or walkthroughs, but on the other side they could also have multiples of both. I'm trying to make my review pages dynamically change based on the review id giving. My question is, using the lest amount of tables what would be the best way to organize mysql tables. for example should I have one table that holds all the reviews? but then how would I store the URL to the screenshots or walkthroughs (if there are any) or should each review get its own table. if I have not explained myself well enough or I gave to little information I will be happy to give more. Thanks
  6. thanks for the help but it didnt work
  7. ok, what my code does take a image that the user uploaded then takes in and width and height then resizes it. it gets the width and height from the user through textboxes and what is happening is when a user put either zero or nothing into the boxes the image is turned black does anyone know why this is happening. here is what i got <?php session_start(); ?> <?php $filename = $_SESSION['imagename']; $width = $_SESSION['width']; $height = $_SESSION['height']; list($getWidth, $getHeight) = getimagesize("userimages/" . $filename); if($width > 0){ $newWidth = $width; }else{ $newWidth = $getWidth; } if($height > 0){ $newHeight = $height; }else{ $newHeight = $getHeight; } $image_p = imagecreatetruecolor($newWidth, $newHeight); $image = imagecreatefromjpeg("userimages/".$filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); imagejpeg( $image_p, "userimages/".$filename, 100 ); header( 'Location: setup.php' ) ; ?>
  8. how would i read from a database backwards with a while loop my php reads an id in the database and I wan't it to put id number 1 and the bottem and go up
  9. Thank you, never would have thought of the second one
  10. how would i display flash based on a php variable with a if statement
  11. it still comes up with "The image “http://website.net/image.php” cannot be displayed, because it contains errors."
  12. I would to add text to a picture using info from mysql. I am able to make the text over the image work but then i try to make a mysql connection it say the image has errors. Heres what I got This one works <?php Header ("Content-type: image/png"); $img_handle = imageCreateFromPNG ("http://www.icemelon.com/images/tutorials/bannerboy.png"); $color = ImageColorAllocate ($img_handle, 100, 100, 100); ImageString ($img_handle, 3, 10, 9, "Your IP: 5", $color); ImagePng ($img_handle); ImageDestroy ($img_handle); ?> This one doesn't and I don't know why <?php mysql_connect("localhost", "*****", "******") or die(mysql_error()); echo "Connected to MySQL<br />"; Header ("Content-type: image/png"); $img_handle = imageCreateFromPNG ("http://www.icemelon.com/images/tutorials/bannerboy.png"); $color = ImageColorAllocate ($img_handle, 100, 100, 100); ImageString ($img_handle, 3, 10, 9, "Your number: 5", $color); ImagePng ($img_handle); ImageDestroy ($img_handle); ?>
  13. how to i check a username and password using $_GET and if its a true user and pass then it updates a part in mysql
×
×
  • 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.