Jump to content

runeveryday

Members
  • Posts

    122
  • Joined

  • Last visited

    Never

Everything posted by runeveryday

  1. the home page is ok. but the inner page still doesn't work. could you see http://www.scarvesonsale.com/index.php/sweet-long-chiffon-scarf.html this page. thank you
  2. when i click the left/right arrow which locates at the center of the home page. the image can't remove.but ok under firefox. why? how to correct it. thank you. it works ok under Chrome and firefox. but doesn't work when under Internet Explorer 8. when under Internet Explorer 8, the products under NEW PRODUCTS are all dispayed
  3. the default html output: the php code: i am sorry . i see the foreach loop. and feel all the code is the same, don't know how to alter it to output the country and city part in the same li like the firstname and lastname.
  4. There are 50 csv files. each csv file have the same column's name. some content in the column are the same, some don't. egļ¼štest1.csv, example1.csv, hello.csv, world.csv.......test70.csv. now, i want to make a change to two column's content. a, all csv files have a column named qty. whose rows content are all 0. now, i want to change it into 888 b, all csv files have a column named image. whose rows content are all upload/img1.jpg upload/img2.jpg upload/img3.jpg upload/img01.jpg upload/img14.jpg upload/img01.jpg ....... If i open each csv file then do a search and replace. i fell it too bored. Thank you in advance. i want to delete Uploadin the image column, change 0 to 888 in the qty column. i using the file change.php to update the record. one csv file. http://phplist.xxmn.com/women.csv the code: <?php $dir = getcwd(); $files = array_diff(scandir($dir), array('..', '.','change.php')); foreach ($files as $file) { if (($handle = fopen($file, "r")) !== FALSE) { $new_content = ''; while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) { //var_dump($data); $data[2]=888; $new_content .= implode(',', $data); //var_dump($new_content); } file_put_contents($file, $new_content); echo 'down'; } } ?> the code doesn't work how to correct it . thank u
  5. setInterval((function() { var index = -1; return function() { var all = $('#latest a'); if (index >= 0) { all.eq(index).hide(); } index++; if (index == all.length) { index = 0; } all.eq(index).show(); }; })(), 1000); how the code is executed? when index = -1; it not fit the first if condition, then execute index++; then which step the code will be executed? if (index >= 0) or if (index == all.length) why?
  6. $col = 0; if ($num_products_count > 0) { while (!$specials_index->EOF) { $list_box_contents[$row][$col] = array('params' =>'<a href="#">' .zen_image(..). '</a>'), $col ++; } } now i want to pass some values<img src="1.jpg">,<img src="1.jpg">,<img src="2.jpg">,<img src="3.jpg">,<img src="4.jpg">,<img src="5.jpg"> to zen_image(..). how should i do? namely, if there are five loops.i want to change zen_image(..) output result to (<img src="1.jpg">,<img src="1.jpg">,<img src="2.jpg">,<img src="3.jpg">,<img src="4.jpg">,<img src="5.jpg">)
  7. many thanks. but there are some points i am still confused. 1, how do i know the port number is 43 2, what's the aim of writting the $domain to the $conn
  8. what's the purpose of writes the domain string (plus a carriage return and new line feed characters) to the stream? thank you.
  9. if ($conn = fsockopen ("whois.internic.net", 43)) { fputs($conn, $domain."\r\n"); while(!feof($conn)) { $output .= fgets($conn,128); } fclose($conn); what those code meaning? how to know what ther result of the $conn. thank you. the code is form http://www.codesphp.com/php-category/http/php-whois-query-function-to-query-some-nic-databases.html fputs($conn, $domain."\r\n"); why he write the $domain."\r\n" to $conn
  10. i am sorry,i am a newbie of php, i have read some tutorial of them, but still don't know when and how i should use them. expect someone can make me a simple example to demonstrate them. many thanks.
  11. the system is window xp.now,i made the following test. test code: putenv('GDFONTPATH=C:\WINDOWS\Fonts'); $fontname='arial'; $char="test"; $size=20; $bbox=imagettfbbox($size,0,$fontname,$char); it show invalidate font filename...., but the arial is actually in C:\WINDOWS\Fonts
  12. the sql command is right, i added print_r($result); there are some output of it. may be the font path is wrong? but how to correct it. thank you. i added the $bar_height =20, the code still doesn't run.
  13. the database is right: DATABASE `poll`; TABLE `results` CREATE TABLE `results` ( book_type VARCHAR(50), num_votes INT ); INSERT INTO `results` values ('Classic', 15), ('Fantasy', 7), ('Humor', 32), ('Mystery', 12), ('Poetry', 25); the code: <?php $dbhandle = mysql_connect("localhost","root","123") or die("unable to connect to mysql"); $selected = mysql_select_db("poll",$dbhandle); $result = mysql_query("SELECT * FORM results"); $num_poller = mysql_num_rows($result); $total_votes = 0; while($row = mysql_fetch_array($result)){ $total_votes += $row{'num_votes'}; } mysql_data_seek($result,0); mysql_close($dbhandle); putenv('GDFONTPATH=C:\WINDOWS\Fonts'); $font = 'arial'; $y = 50; $width =700; $height = $num_poller * $bar_height *1.5 + 70; $bar_unit = ($width - 400)/100; $image = imagecreate($width,$height); $white = imagecolorallocate($image,255,255,255); $black = imagecolorallocate($image,0,0,0); $red = imagecolorallocate($image,255,0,0); $blue = imagecolorallocate($image,0,0,255); imagefill($image,$width,$height,$white); imagerectangle($image,0,0,$width-1,$height-1,$black); imagettftext($image,16,0,$width/3+50,$y-20,$black,$font,'poll results'); while($row = mysql_fetch_object($result)){ if($total_votes > 0){ $percent = intval(round(($row->num_votes/$total_votes)*100)); }else{ $percent =0; } imagettftext($image,12,0,10, $y+($bar_height/2), $black, $font, $row->book_type); //Output percentage for a particular value imagettftext($image, 12, 0, 170, $y + ($bar_height/2),$red,$font,$percent.'%'); $bar_length = $percent * $bar_unit; //Draw a shape that corresponds to 100% imagerectangle($image, $bar_length+221, $y-2, (220+(100*$bar_unit)), $y+$bar_height, $black); //Output a bar for a particular value imagefilledrectangle($image,220,$y-2,220+$bar_length, $y+$bar_height, $blue); //Output the number of votes imagettftext($image, 12, 0, 250+100*$bar_unit, $y+($bar_height/2), $black, $font, $row->num_votes.' votes cast.'); $y = $y + ($bar_height * 1.5); } header("Content-Type: image/jpeg"); imagejpeg($image); imagedestroy($image); it shows an error: the image...cannot be displayed because it contains errors?. what's wrong with the code? thank you
  14. Hi, I'm trying to use Zeroclipboard. http://code.google.com/p/zeroclipboard/. Zeroclipboard to copy stuff to the clipboard and add a tooltip when the mouse hover on the flash. but it doesn't seem to be working. my html code: <div rel="<?php echo $url;?>" class="cp-code">copied code</div> <div class="test" style="display: none; border: 1px solid #ccc; padding: 8px;">click copy,test,test</div> My js code: i have added the jquery library. ZeroClipboard.setMoviePath("http://example.com/js/ZeroClipboard.swf"); var clip = null; var url = ''; function init() { clip = new ZeroClipboard.Client(); clip.setHandCursor( true ); $('.cp-code').mouseover( function() { clip.setText(this.innerHTML); $('test').style.display = 'block'; if (clip.div) { clip.receiveEvent('mouseout', null); clip.reposition(this); } else { clip.glue(this); } clip.receiveEvent('mouseover', null); url = $(this).attr('rel'); }); clip.addEventListener('mouseUp', function(client) { window.open(url); }); clip.addEventListener('mouseOut', function (client) { $('test').style.display = 'none'; }); } $(document).ready(function() { init(); });
  15. what's the difference between them? how to use them. i print_r($_SERVER). there are no result of $_SERVER['PATH_INFO'] and $_SERVER['PORIG_PATH_INFO'] .why? how to enable it.i have read the php manual about them, but still don't understand . expect someone can explain them.thank you
  16. <div id="nav"> <ul> <li class="item"><a href="/">Home</a>/</li> <li class="item"><a href="/one">one</a></li> <li class="item"><a href="/two>two</a></li> <li class="item"><a href="/three">three</a></li> </ul> <div> i want to add class='active' to the a tags . when the menu is the current page. namely.when i on the home page. the a label is <li class="item"><a href="/" class="active">Home</a>/</li> .but the others a label are not have class="active". when i on the one page. it is is <li class="item"><a href="one" class="active">one</a>/</li> .the others a label are not have class="active".
  17. the print_r($a)'s result is views_handle_field_node Object ( [view]=>view Object ( [db_table] => views_view [base_table] => node [args] => Array ( [0] => My entry 1 ) [use_ajax] => [result] => Array ( [0] => stdClass Object ( [nid] => 5 [node_title] => Title of a test entry [node_revisions_body] => [node_revisions_format] => 1 [node_vid] => 5 [term_data_name] => My first test term name [term_data_vid] => 1 [term_data_tid] => 1 [vocabulary_name] => Vocabulary 1 [node_revisions_vid] => 5 ) [1]=> stdClass Object ( [nid] => 8 [node_title] => Title of a test entry [node_revisions_body] => [node_revisions_format] => 1 [node_vid] => 5 [term_data_name] => My first test term name [term_data_vid] => 1 [term_data_tid] => 1 [vocabulary_name] => Vocabulary 1 [node_revisions_vid] => 5 .. [2].. .. now i want to output the [nid]=>5 and[nid]=>8.....and all the nid's value.i use this, but can't work. $views_handle_field_node->$view->$result[]->nid. what's the correct output of it.
  18. it's an examploe form here . http://php.about.com/od/phpwithmysql/ss/php_search_3.htm there are something wrong with this search code.but i don't know how to correct it.
  19. i don't know, it's from here, how to correct the code?
  20. this is the creation table code.the database is testing. CREATE TABLE users (fname VARCHAR(30), lname VARCHAR(30), info BLOB); INSERT INTO users VALUES ( "Jim", "Jones", "In his spare time Jim enjoys biking, eating pizza, and classical music" ), ( "Peggy", "Smith", "Peggy is a water sports enthusiast who also enjoys making soap and selling cheese" ),( "Maggie", "Martin", "Maggie loves to cook itallian food including spagetti and pizza" ),( "Tex", "Moncom", "Tex is the owner and operator of The Pizza Palace, a local hang out joint" ) the html code: <h2>Search</h2> <form name="search" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <Option VALUE="fname">First Name</option> <Option VALUE="lname">Last Name</option> <Option VALUE="info">Profile</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> the search code: <?php if ($searching =="yes") { echo "<h2>Results</h2><p>"; if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } mysql_connect("localhost", "root", "123") or die(mysql_error()); mysql_select_db("database_name") or die(mysql_error()); $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'"); while($result = mysql_fetch_array( $data )) { echo $result['fname']; echo " "; echo $result['lname']; echo "<br>"; echo $result['info']; echo "<br>"; echo "<br>"; } $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } echo "<b>Searched For:</b> " .$find; } ?>
  21. function garland_separate_terms($node_taxonomy) { if ($node_taxonomy) { //separating terms by vocabularies foreach ($node_taxonomy AS $term) { $links[$term->vid]['taxonomy_term_'. $term->tid] = array( 'title' => $term->name, 'href' => taxonomy_term_path($term), 'attributes' => array( 'rel' => 'tag', 'title' => strip_tags($term->description) ), ); } //theming terms out foreach ($links AS $key => $vid) { $terms[$key] = theme_links($vid); } } return $terms; } this is a function from someone, i couldn't know it very well,sincerely expect someone can explain it to me .thank you. first, the function put an array $node_taxonomy as the parameter. why he didn't declare this ($node_taxonomy = array() then in the foreach loop's statement, why there is no echo to output somethig.but the fact is giving a two-dimension array to $links[$term->vid]['taxonomy_term_'. $term->tid].
  22. <?php for ($count = 0; $count < 10; $count++) { $randomNumber = rand(1,50); if ($randomNumber < 10) goto less; else echo "Number greater than 10: $randomNumber<br />"; } less: echo "Number less than 10: $randomNumber<br />"; ?> i checked this code again and again,but couldn't find any error. who can help me,thank you.
×
×
  • 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.