Jump to content


  • Posts

  • Joined

  • Last visited

About Morsusy2k

  • Birthday 10/30/1993

Previous Fields

  • Languages
    Pascal, ActionScript, php, and a little bit of others..

Morsusy2k's Achievements


Newbie (1/7)



  1. I managed to make it right. Thanks for the help
  2. Can you help me out with this,I can't seem to find a way to send the data to mysql through ajax/php..:S
  3. Okay so I installed raty to my webs. It works but I can't get it to change the rating in my DB. Take a look: $string = $row['RATE']; $expl = explode(',',$string); $size = count($expl); $rating = 0; $zbir = 0; for ($i=0; $i < $size; $i++) { $zbir = $zbir + $expl[$i]; } $rating = round($zbir/$size,2); echo "<script type='text/javascript'>", "$(function() {"; echo "$('#star').raty({ half: true , score: " . $rating . " , "; echo "starOff: 'source/raty/star-off.png',starOn : 'source/raty/star-on.png',starHalf: 'source/raty/star-half.png',", "click: function(score, evt) {", "alert(score);"; //add code here echo "}", "});", "$('#ocena').html(" . $rating . ");", "});", "</script>"; This works,but this only alerts the selected score,how could I add it to the existing values in my DB? This is what I tried but it does not work. $new = $string.","./* I need variable 'score' here */;$sq9 = "insert into " . $row['ID'] . " (RATE) values ('$new')";$result9 = mysql_query($sql9));
  4. Hehe that was easy,thanks bunch
  5. Well I wanted to make it more dynamic so people could click on eg. 3.15 instead of only 1,2,3,4,5. Something like this http://demos.myjqueryplugins.com/jrating/
  6. Morsusy2k

    Selecting tables

    Okay so I would need to select all tables with prefix 'c' and list their names in php. This is how far i've come: <?php include 'source/connect.php'; $sql3 = "SHOW TABLES FROM mydb LIKE 'c%'"; $result3 = mysql_query($sql3) or die ("Could not access DB: " . mysql_error()); while ($row3 = mysql_fetch_assoc($result2)) { echo $row3; //echoes nothing,how could I echo the table name? }?> Also I would like if that could be done for only first 10 tables. (Only 10 tables select).
  7. Okay so I am trying to make a star rating system on my website,but I am having problems with JS. The problem is that I can't get the coordinates of the mouse INSIDE the div,I can only get screen coordinates. :S This is my code: <div id='stars'><div id='stars1'></div></div><div id='mark'>0</div> $(document).ready(function(){ $(function(){ $("#stars").mouseenter(function(){ $("#stars1").show(); $(document).bind('mousemove', function(e){ //1 //var parentOffset = $(this).parent().offset(); //var x = e.pageX - parentOffset.left; //2 var center = (window.screen.width - 1122)/2+283; var x = e.pageX - center; $('#stars1').css('width',x); }); }); $("#stars").mouseleave(function(){ $("#stars1").hide(); }); });}); I found a solution online but it is not working,that is why its commented out,the error is: Uncaught TypeError: Cannot read property 'left' of undefined and I get this error every time I move the cursor. And in the other example (2) I tried to calculate the distance from the left border of the browser,but this one works only for me..Since I have used percentage (%) instead of solid units (pixels) its kinda hard to achieve.. I hope you understand what is the problem. Thanks.
  8. It seems like it works now,I knew its something simple,so no quotes in table names anymore. Thanks Ingolme
  9. Okay I got a headache because of this So basically I am trying to get if table exists in my DB,if yes echo '1'; and if not echo '0'; This one keeps loading forever: <?php include 'connect.php'; $mytable = 'c27'; $table ='select * from c27'; //$table ='show tables'; while ($row = mysql_query($table)) { if ($row == $mytable) { echo "1"; } else { echo '0'; } }?> This fails too: $sql2 = "select * from 'c27'";echo $sql2."<br/>";$result2 = mysql_query($sql2);echo $result2."<br/>";//this is line 84while ($row2 = mysql_fetch_assoc($result2)){echo '1';} if (!$result2) {echo "0";} else {echo "1";} In this test first loop (while) gives this error: select * from 'c27'Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in ......./page.php on line 85 As you can see echoing result outputs nothing... And in the second loop (if) it always ends up with echoing 0. 'c27' table really exists in my DB and I can detect it in SQL query box but not in php.. F1,thanks
  10. I suppose I don't need arrays anymore. Seems like its not working again :S for(i = 1; i <= 10; i++) { $("#pictures" + i).click(function(){ alert(i); //this alert always outputs '11' :S $("#roll" + i).show(); });}
  11. I thought it would be simple. But there is something wrong again,look: var pictures = [ "#picture1", "#picture2", "#picture3", "#picture4", "#picture5", "#picture6", "#picture7", "#picture8", "#picture9", "#picture10" ];var info = [ "#roll1", "#roll2", "#roll3", "#roll4", "#roll5", "#roll6", "#roll7", "#roll8", "#roll9", "#roll10" ]; alert(pictures[1]); alert(info[1]); //these alerts works for(i = 0; i < pictures.length; i++) { $(pictures[i]).click(function(){ alert(pictures[i]); alert(info[i]); //these dont :S //output is 'undefined' $(info[i]).show(); }); }
  12. I have 10 divs with pictures,named picture1,picture2,...,picture10. And I have 10 divs with info on these pictures,named info1,info2,..,info10. Is it possible to do something like this: var pictures = [ "#picture1,..,#picture10];var info = ["#info1",...,"#info10"];jQuery.each(pictures, function() { $(pictures).click(function(){//info with same index$(info).fadeIn(200); });}); Instead of doing this 10 times: $("#picture1").click(function(){ $('#info1').fadeIn(200);}); I hope you understand what I meant to say Thanks.
  13. Morsusy2k


    Hi, I am having trouble with creating thumbnails of the pictures uploaded on my website. This script on the first sight works perfectly but when I opened some of the files,some were ok but some lost too much of their color and become almost white,some almost black,others lost quality (on some you can't even say what is on them)..etc.. function thumbnail($image_path,$thumb_path,$image_name,$thumb_width) { $src_img = imagecreatefromjpeg("$image_path/$image_name"); $origw=imagesx($src_img); $origh=imagesy($src_img); $new_w = $thumb_width; $diff=$origw/$new_w; $new_h=$new_w; $dst_img = imagecreate($new_w,$new_h); imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img)); imagejpeg($dst_img, "$thumb_path/$image_name"); RETURN TRUE; } Is there any way to do this in function like this but better working? Thanks.
  14. Thanks for the tip I made it work
  • Create New...