Jump to content

christa

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by christa

  1. here the complete code: //print all comments... while ($row = mysql_fetch_array($result)) { $sql_user = mysql_query("SELECT u.IDuser FROM users u JOIN articles a ON a.IDuser=u.IDuser AND a.IDart=$_GET['IDart'] WHERE u.IDuser=" . $_SESSION['IDuser'] . ""); $row2 = mysql_fetch_array($sql_user); if ($_SESSION['IDuser'] == $row2['IDuser'] ) { $color = "#FFFFFF"; } else { $color = "#FF0000"; } echo '<div id="comment" style="background-color: ' . $color . '">post</div>'; }
  2. hi all, in my blog (made by me, no wordpress or similar) i would want to change the color of comments written by author of article My code is: $sql = "SELECT author WHERE art_id=..."; //print all comments... while ($row = mysql_fetch_array($result)) { if ($_SESSION['ID_user'] == $sql['ID_user'] ) { $color = "#FFFFFF"; } else { $color = "#FF0000"; } echo '<div id="comment" style="background-color: ' . $color . '">post</div>'; } but the code above print all FFFFFF or all FF0000 Where it is wrong? thanks
  3. now it works fine. One question only: if the key search is (example) "House" the code works; if the key search is "house" the code returns: Notice: Undefined offset: 1 in.... line of $back_array = explode(" ", $string_array[1]); Why? there is a case insensitive example?
  4. ok, but how can i extract or print only 50 words before and 50 words after $mykey?
  5. i try this code: while ($row = mysql_fetch_array($result)) { $my_array = explode("$mykey", $row['mytext']); $my_array[0]; $my_array[1]; $front_array = explode(" ", $my_array[0]); $back_array = explode(" ", $my_array[1]); echo $front_array[0] . " <b>$mykey</b> " . $back_array[1]; } but it returns some errors: "Notice: Undefined offset: 1" and without words nor left nor right.
  6. hi all, in mysql, how can i extract 100 words before and 100 words after my search key? example: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla est nibh, mattis eu mattis id, pulvinar eu augue. Duis ut sem nisi. Sed id ante sed orci vestibulum lacinia ac id nibh. Donec cursus, elit eget auctor semper, ipsum eros laoreet quam, nec ullamcorper" vestibulum is my search key
  7. ok. Last question: when i create a table can I omit the value between () or it is required?
  8. i'm not using zerofill, my field is unsigned. plase correct me if I'm wrong: value: 156 field: int(4) unsigned zerofill > value becomes 0000156 field: int(4) unsigned > value is 156 field: smallint(1) unsigned zerofill > value becomes 0156 field: smallint(1) unsigned > value is 156 Right?
  9. hi all, i have a db table with a field INT(4) UNSIGNED autoincrement named "person_ID". The (4) attribute means that i can store up to 9999 values or not?
  10. hi all! i have 2 tables: PRODUCTS id_prod, id_cat, date, prod_name CATEGORIES id_cat, cat_name My goal is obtain the average (day and month) of all products inserted by users in this format: category Hardware: avg daily 20, month 100 category Components: avg daily 2, month 15 and so on. PS: the 'date' field is unix timestamp (int 10). Can you help me?
  11. My db table has 2 fields: ID - Place 1 France 2 Germany My form has 2 text fields: input name=State1 input name=State2 if I digit Italy in inputname=State1 only updates ID 1 if I digit Spain in inputname=State2 only updates ID 2 So, my db table will become: ID - Place 1 Italy 2 Spain
  12. hi my db table has 2 field: ID - Place 1 France 2 Germany My form has 2 text field (printed with while cycle). mysql_query("UPDATE mytable SET Place = '" . $_POST['place'] . "' WHERE ID=". $_POST['ID']." "); This query doesn't work, because updates only the last record. Where is wrong? many thanks
  13. i tried your code but it prints every number in one line only. I would to obtain this result: 45,3455,66,8900, 2,49,88,8, 909 and so on..... What's not clear?
  14. hi everyone, i have a string as this one: 45,3455,66,8900,2,49,88,8,909 I need to print it with a new line every 4 numbers, as this one: 45,3455,66,8900, 2,49,88,8, 909 How can i do this? many thanks
  15. hi all i would select the 6 records before of my value and 6 record after my value. How can i obtain this result in a single query? thanks
  16. the web site is: http://www.n2yo.com/?s=24905 and the data to grab are in the right box (under YOUR CURRENT SELECTION): Latitude: Longitude:.... until Eclipsed? How to do?
  17. hi all, how to grab only some data from an external web site? Example: from http://www.phpfreaks.com/forums i want to obtain only some text as Home Forums Chat Help Search Profile My Messages Members Rules & TOS Logout and print it in my web page. How to do this operation? thanks!
  18. good day! I use mysql v4.1.x and, via php script, i want to execute this query: SHOW TABLE STATUS WHERE Name IN ('mytab', 'anothertab, '1234_tab') But, the syntax that works in 4.1 is: SHOW TABLE STATUS LIKE 'mytab' How can i check more tables?
  19. Hi all i have 2 question: 1. how to print a single value from parameters list by phpinfo() ? 2. to increase the script execution time, i have to use ini_set('max_execution_time', xxx) OR set_time_limit(xxx) ? thanks
  20. the directories are not placed under a database. I don't understand why nor file nor directories are deleted
  21. now, i added else at the end: the script go to else printing the directories names!. if ($handle = opendir("../$file_dir")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if(file_exists($file) && is_file($file)) { unlink($file); }elseif(is_dir($file)){ $handle = opendir($file); while (false !== ($files = readdir($handle))) { if(is_file($file.$files)){ unlink($file.$files); } } $handle = closedir($handle); rmdir($file); } else { echo $file ."<br>"; } } } } closedir($handle);
  22. $file_dir is defined: his value is "../upload" error_reporting is already setted on E_ALL in php.ini Where i wrong?
  23. simply, nothing happens: php returns no error and neither files nor folders are deleted. I want to do this operations: i have some directories (empty and not). By clicking a button on page, all directories (and files within ) must be deleted
  24. I must to delete before all the files in directories and after the directories. I use this code but it doesn't works: why? if ($handle = opendir("../$file_dir")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if(file_exists($file) && is_file($file)) { unlink($file); }elseif(is_dir($file)){ $handle = opendir($file); while (false !== ($files = readdir($handle))) { if(is_file($file.$files)){ unlink($file.$files); } } $handle = closedir($handle); rmdir($file); } } } closedir($handle); }
  25. hi, i have an array that contains some names (1,4,6,56...). Every integer is a name of a folder. I must to delete only the folders not in array, i use this code: $all_folders = array(); while ($row = mysql_fetch_array($result)) { $all_folders[] = $row['folder_id']; } function removedirfiles($all_folders){ $open=readdir($all_folders); while($files=readdir($open)){ unlink("$all_folders/$files"); } rmdir($all_folders); } removedirfiles("$all_folders"); but it returns those errors: readdir(): supplied argument is not a valid Directory resource rmdir(Array) [function.rmdir]: No such file or directory
×
×
  • 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.