Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. Whenever i delete a row using this query below i always get overhead - some tables have over 5 MB overhead, why is this? mysql_query( "DELETE FROM links WHERE id='5' ") ;
  2. I want to subtract rate and com_num (within the query) then only select rows with a value less than 30 Is this possible?
  3. I did maths B...and physics, was a b+ student. Sometimes i get writers block - programming style. Thats why u see me asking all the stupid questions - Im not stupod hunust Check my profile to see how old i am....
  4. Ive hit a block with this...I need to subtract 2 columns within a select then see if its less than 30 Heres what ive got mysql_query( "SELECT * FROM table WHERE rate !=0 and com_num !=0 and ((rate - com_num) < 30 )" )
  5. Yeah thats why its crazy. I need to show a percentage like 63% with max of 100% not 1347.84% Can anyone see a simple way of doing it? Ok if theres 10 ppl and 7 say yes and 3 say no - what percentage says yes Answer : 23% But what if theres 1230 ppl and 14 say yes and 1216 say no , what percentage says yes. This is what im after
  6. Ive done it! Took me a few hours to work it out. A div parent with a background image and a image content $with = 150; echo "<div width=\"320px\" style=\"height:20px; background: url(http://img.site.com/progress_bar_white.gif) top;\" > <img border=\"0\" src=\"http://img.site.com/progress_bar_blue.gif\" width=\"".$width."\" height=\"20\" align=\"left\"></div>"; I feel so spcial
  7. I know ive done this in school but im trying to get a percentage of 100 i have always 2 numbers: 7 and 3 $total = (7 * 3 ) /100 ; // is 0.21 aka 21% Bt what happens with larger numbers like this below the same function goes crazy 3456 and 39
  8. dreamwest

    Display bar

    I wanted to have an image repeat to a certain width based on an input: $input = 30; echo "<div width=\"100px\" style=\"background: url(http://img.site.com/bar.gif) left repeat {$input}px\"></div>"; So the the input of 30 should fill the div 30% because the div has a width of 100px. Im not sure about how to set a background to repeat by a certain width
  9. Yeah it looks good - its a gif
  10. You mean the dropdown at the top. Its Ajax httprequest and css styles.
  11. Who owns phpfreaks. Is it owned by a company or ppl here with administrator status?
  12. So all i can do is manually stretch the image then try it as a background....DAMMIT! :'(
  13. Users can deposit money into thier phpfreak account from paypal, then have a mod under each post that enables users to donate money to other members who have solved thier issues - something like a dropdown with 50c increments. Phpfreaks will automatically take 20% of all money transfered. Scriptlance has a similar feature where they charge both programmers and buyers $5 each for a job posting Doing it this way gives the user the choice of donating , and most will be happy to dump a few shillings if they have a deposit within their phpfreaks account already there it will be a convenient way of donating -- this is the key
  14. i have an image thats 650px wide is there a way i can stretch or fill the background cell which is 1050px wide .subindex { background: white url("http://img.site.com/bgcnormal.gif") top no-repeat; border-bottom: 1px #d2d2d2 solid; font-size: 80%; list-style: none; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 5px 0px; width: 100%; }
  15. What's wrong with explode? It might have more or less than 2 words in the string So if the string is 1 word, this code will search for tags with a zero value because $pieces[1] is nothing : $sql4 = "SELECT * from tags where (tag like '%".$pieces[0]."%' OR tag like '%".$pieces[1]."%')";
  16. Creates perfect resized images: class SimpleImage { var $image; var $image_type; function load($filename) { $image_info = getimagesize($filename); $this->image_type = $image_info[2]; if( $this->image_type == IMAGETYPE_JPEG ) { $this->image = imagecreatefromjpeg($filename); } elseif( $this->image_type == IMAGETYPE_GIF ) { $this->image = imagecreatefromgif($filename); } elseif( $this->image_type == IMAGETYPE_PNG ) { $this->image = imagecreatefrompng($filename); } } function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image,$filename,$compression); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image,$filename); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image,$filename); } if( $permissions != null) { chmod($filename,$permissions); } } function output($image_type=IMAGETYPE_JPEG) { if( $image_type == IMAGETYPE_JPEG ) { imagejpeg($this->image); } elseif( $image_type == IMAGETYPE_GIF ) { imagegif($this->image); } elseif( $image_type == IMAGETYPE_PNG ) { imagepng($this->image); } } function getWidth() { return imagesx($this->image); } function getHeight() { return imagesy($this->image); } function resizeToHeight($height) { $ratio = $height / $this->getHeight(); $width = $this->getWidth() * $ratio; $this->resize($width,$height); } function resizeToWidth($width) { $ratio = $width / $this->getWidth(); $height = $this->getheight() * $ratio; $this->resize($width,$height); } function scale($scale) { $width = $this->getWidth() * $scale/100; $height = $this->getheight() * $scale/100; $this->resize($width,$height); } function resize($width,$height) { $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); $this->image = $new_image; } } //******************settings below*****************// // resize $image = new SimpleImage(); $image->load(pic.jpg); $image->resize(140,110); //wxh $image->save(pics/pic.jpg);
  17. Thanks. But is there a way to search each word individually without using explode to separate the string The only solution i can think of is to strreplace the spaces and set it as a variable $search = "looking anything" $search = str_replace( " ", "%', '%", $search ); SELECT * FROM `tags` WHERE tag IN('%$search%');
  18. Simple solution: $pieces = explode(" ", $search); $sql4 = "SELECT * from tags where (tag like '%".$pieces[0]."%' OR tag like '%".$pieces[1]."%')"; If someone knows a proper sql way i would love to see it...
  19. How can i split up a string into seperate words and use that to search a database $search = "im following you"; //here i need to split up $search into individual words so it outputs: im following you
  20. I cant seem to get this to work... Im trying to use wildcards within a search string: SELECT * FROM `tags` WHERE tag like '%looking%anything%' I want to match anything either side of each word, so logically it would look like this: SELECT * FROM `tags` WHERE tag like '%looking%' And SELECT * FROM `tags` WHERE tag like '%anything%'
  21. Create another htacces and upload to your directory www.example.com/chaiwei/.htaccess Then in this htaccess file add: Options +FollowSymLinks RewriteEngine on RewriteRule ^chaiwei/login login.php
  22. Youll only need $_POST if you have a form to submit, otherwise use get ....'RequireAjaxData("/submit.php?id=Get_id_here", "MyDIV");...... And in submit.php $id = $_GET['id'];
×
×
  • 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.