Jump to content

pouncer

Members
  • Posts

    324
  • Joined

  • Last visited

    Never

Everything posted by pouncer

  1. I got a table called item_rating, fields: item_id | user_who_rated | rating e.g data: 7GD | John | 5 7GD | Suzie | 4 7GD | Tim | 5 Ratings go from 1-5.. how do i get a total number of people who rated 1, who rated 2.. etc etcc in the above case for item 7GD it should be like this rating 1: 0 people rating 2: 0 people rating 3: 0 people rating 4: 1 people rating 5: 2 people SELECT * FROM item_rating WHERE item_id='7GD' ..what next guys?
  2. i guess i could just change the x,y of the $im
  3. ah i see. any other ideas about the alignment m8?
  4. it outputs a chart, but cant get it to go centre http://img368.imageshack.us/my.php?image=picur2.jpg
  5. desn't put it in the middle for me mate? did you test it?
  6. <? /* We need this in order to return a picture */ header ("Content-type: image/png"); $graph_data = array( "question" => "Rating for this item" , "1" => 82 , "2" => 18, "3" => 0, "4" => 0, "5" => 0 ); $im = ImageCreate(400, 160); $background_color = imagecolorallocate($im, 200, 200, 200); $text_color = imagecolorallocate($im, 233, 14, 91); $bar_color = imagecolorallocate($im, 0, 0, 0); $bar_color_fill = imagecolorallocate($im, 150, 150, 255); imagefill($im, 0, 0, $background_color); ImageString ($im, 5, 95, 5, $graph_data["question"], $text_color); for ($i = 1; $i <= 5; $i++) { $space = $i * 80 - 50; $text = $i . ": " . $graph_data[$i] . "%"; ImageString ($im, 2, $space, 130, $text, $text_color); } for ($i = 1; $i <= 5; $i++) { $x1 = $i * 80 - 50; $bar_height = 120 - $graph_data[$i]; $bar_width = $x1 + 20; imagerectangle($im, $x1, $bar_height, $bar_width, 120 ,$bar_color); imagefill($im, $x1, 120, $bar_color_fill); } echo imagepng($im); ?> it shows the image in the top left corner. how do i get it to show in the centre of the page?
  7. no i found the code here, im trying to make a bar chart http://www.g4zfe.com/sqllogsearch5.html
  8. if (! ($result = mysql_query (" SELECT count(*), op_mode FROM qsos WHERE fk_dxstn IN (2,3,4,5,10) GROUP BY op_mode", $connection))) showerror(); can anyone see what its doing, im confused
  9. i've seen it, it is quite good. but does anyone have any sample codes for just creating a bar chart? without having to use any class files or anything? i've found this: http://www.g4zfe.com/sqllogsearch5.html but im not quite sure whether it's what im looking for, does it look right guys?
  10. Lets see how this goes on a web scripting forum, hehehehe! So, what have you people learnt about the opposite sex?
  11. hey guys. is it possible to make graphs to show some stats in php? e.,g SELECT name,item FROM users; and a barchart perhaps to show the usernames along the y axis, and their number of items on the x axis?
  12. ok this worked: mysql_query("ALTER TABLE `movies` CHANGE `directors` `hello` TEXT NOT NULL"); but how can i get the type of the fieldname? becasue what if the field name is int, etc.. (the page im making is for admins to edit field names)
  13. it's not working bud. echo "ALTER TABLE `$cat` " . $data; $c = mysql_query("ALTER TABLE `$cat` " . $data); the echo gives me: ALTER TABLE `movies` CHANGE `title` `title` , CHANGE `media` `media` , CHANGE `director` `directorsssss` , CHANGE `cast` `cast` , CHANGE `description` `description` ..but it's not changing the director field name to directorsssss even this didn't work mysql_query("ALTER TABLE movies CHANGE director hello");
  14. hey mate, are the `` needed?
  15. thanks bud. so is this looking ok mysql_query("ALTER TABLE `TABLE` CHANGE `name` `jpName`, CHANGE `address` `dpAddress`");
  16. do i have to have all that varchar NOT NULL stuff in, because thats already done when i created the fields beforehand. just want to change fieldnames (nothing else)
  17. thanks alot bud. TYPE(LENGTH) whats that mean? and also, cant i change both fieldnames in 1 line? r i have to have seperate queries?
  18. say my table has these 2 field: name address i want to change the field names to jpName jpAddress what would my alter query become in php guys? im a bit stuck
  19. i have a folder called "profile_images" how do I loop through the images in this folder, and echo each filename guys?
  20. if (!dir("profile_images/" . $username . "/")) { mkdir("profile_images/" . $username . "/"); } gives me errors Warning: dir(profile_images/John/) [function.dir]: failed to open dir: Invalid argument Warning: mkdir(profile_images/John/) [function.mkdir]: No such file or directory
  21. thanks alot guys, that pc_nerd guy mislead me, by telling me it was correct. Thanks guys!!!
  22. $s1 = mysql_query("SELECT * FROM collection WHERE collection_name LIKE %old% OR collection_name LIKE %houses%"); echo mysql_num_rows($s1); error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result but when i change my query to: $s1 = mysql_query("SELECT * FROM collection"); then it works fine. can someone please tell me whats wrong?
  23. i fund the problem. i was missing $ from this shud have been $this lol
×
×
  • 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.