Jump to content

2sharp

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

2sharp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oh man... sometimes I go blind doing this stuff. Thanks peranha. Sorry for being a doofus everyone... J
  2. Sorry if this is dumb-ass but I can't see where the problem is with this. Just a simple page where I'm trying to understand arrays but my while loop fails. I'm just closing the while loop ! Parse error: syntax error, unexpected '}' in /Users/jon/Sites/brokenbench.dev/web/array.php on line 43 J 1: <?php 2: 3: $images = array( 4: array('id' => '01', 'width' => '600', 'height' =>'405'), 5: array('id' => '02', 'width' => '600', 'height' =>'405'), 6: array('id' => '03', 'width' => '600', 'height' =>'405'), 7: array('id' => '04', 'width' => '600', 'height' =>'405'), 8: array('id' => '05', 'width' => '600', 'height' =>'405'), 9: array('id' => '06', 'width' => '600', 'height' =>'405'), 10: array('id' => '07', 'width' => '600', 'height' =>'405'), 11: array('id' => '08', 'width' => '600', 'height' =>'405'), 12: array('id' => '09', 'width' => '600', 'height' =>'405'), 13: array('id' => '10', 'width' => '600', 'height' =>'405'), 14: array('id' => '11', 'width' => '600', 'height' =>'405'), 15: array('id' => '12', 'width' => '600', 'height' =>'405'), 16: array('id' => '13', 'width' => '600', 'height' =>'405'), 17: array('id' => '14', 'width' => '600', 'height' =>'405'), 18: array('id' => '15', 'width' => '600', 'height' =>'405'), 19: array('id' => '16', 'width' => '600', 'height' =>'405'), 20: array('id' => '17', 'width' => '600', 'height' =>'405'), 21: array('id' => '18', 'width' => '600', 'height' =>'405'), 22: array('id' => '19', 'width' => '600', 'height' =>'405'), 23: array('id' => '20', 'width' => '600', 'height' =>'405') 24: ); //closes images array 25: //$image_id = $images["$i"]['id']; 26: //echo "$image_id"; 27: echo $images['3']['id']; // Outputs 04 28: echo "<br />"; 29: echo $images['4']['height']; 30: echo "start experiment"; 31: echo "<br />"; 32: $i=0; 33: while($i <= 12) { 34: 35: 36: $image_id = $images["$i"]['id']; 37: $width = $images["$i"]['width']; 38: $height = $images["$i"]['height']; 39: $images["$i"]['height']; 40: echo "Image id is $image_id and width is $width and height is $height<br />"; 41: 42: $i++ 43: } 44: 45: 46: ?> EDIT by zanus: please learn to use the code tags
  3. Hi all, I have two tables in the database for my photographic website: [a href=\"http://www.sharperstill.com/\" target=\"_blank\"]http://www.sharperstill.com/[/a] One is Categories and contains three fields: a unique id, category_anme, and category_path The other is Photos and contains four fields: a unique id, photo_filename, photo_caption, and c_id (which links to category tables id field.... What I want to do, with one SELECT query, is extract the names and paths of all categories (for building a list of links) as well as getting a count of the number of pictures in each category (for building 'smart' next/previous links. All has been going well except that the count returned is always for the number of categories, not the number of pics in each category. Have been playing with lots of code lately but follwing will show the direction I am heading in: SELECT category_name, category_path, photo_filename, photo_caption, COUNT(*) FROM category, photos WHERE category.id = photos.c_id GROUP BY category.id ORDER BY id DESC"; The number of pics shown in each category is correct on the output for the links list, but when I use it to show pic x of xx total it is wrong and does not change between categories... Jon
×
×
  • 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.