Jump to content

aschk

Staff Alumni
  • Posts

    1,245
  • Joined

  • Last visited

    Never

Everything posted by aschk

  1. I hope you're going to close that socket
  2. Does it exist at the time you are attempting to read it? Also is the size greater than nothing? fread b0rks when filesize is 0...
  3. I'm guessing that this will be running as the Apache user unless you have the PHP equivalent of suexec (suPHP anyone?) so all your files/permissions will be written or done as that user. Thus you cannot chown (to my knowledge) as Apache, because if you could, you would be able to chown apache:apache / bringing the whole server to a standstill.
  4. file size is easy enough to do in PHP, however I think in order to process dimensions you'll need to utilise GD which SHOULD now be part of the standard PHP build. Also, the dimensions are specified in pixels not mm for GD
  5. Are your rows uniquely identified in your database (i.e. auto_inc id) ? Then delete by id. If not you will have to find another primary key to go by in order to delete them.
  6. I should ask why you're not doing the summation in the database query? SELECT (SUM(fin_record_debit)-SUM(fin_record_credit)) as fin_record_bal1 FROM fin_records WHERE (fin_record_date<='$data') AND (id_production_unit='$pu') AND (id_bank_account='$ba') GROUP BY id_production_unit, fin_record_date, id_bank_account;
  7. Seems to me like you have a non-normalised database layout. You have duplicate data there that should not be. Secondly do NOT do a query inside a query while still using mysql_... functions. They overwrite each other... $sql1 = "select * from ..."; $res1 = mysql_query($sql1,$conn); while($row1 = mysql_fetch_assoc($res1){ $sql2 = "select * from ..."; $res2 = mysql_query($sql1,$conn); while($row2 = mysql_fetch_assoc($res2){ /// BLAM!!!! /// WE JUST OVERWROTE OUR OUTER LOOP... } } So you're probably wondering what you should do about this. Use arrays... $sql1 = "select * from ..."; $res1 = mysql_query($sql1,$conn); $data1 = array(); while($row1 = mysql_fetch_assoc($res1){ $data1[] = $row1; } $sql2 = "select * from ..."; $res2 = mysql_query($sql2,$conn); while($row2 = mysql_fetch_assoc($res2){ // Use data1 array or do something else. } If you don't understand why the first loop is being messed then you best read up on mysql_fetch...
  8. Because ttl is an alias, and you also can't use an alias in the LIMIT clause especially when it's inline with the query. Nor can you use a subquery in the limit clause (before you try it).
  9. In answer to your single question : yes I hope you're not talking about iframes. You might also want to consider some nifty javascript instead. Google jquery, you might not even need another page Basically you need to have a unique identifier for each image in question and have the text related to it (probably want a database for this storage). So when you click on your particular image it calls a page like : myimage.php?id=1235 , which is then interpreted by PHP, does the lookup on the database, loads up the information and present it with the html. Simple...
  10. Here's my version : echo "<a href={$zeb} onclick='window.open(\'{$zeb}\',\'popup\',\'width=440,height=290,left=165,top=140\'); return false'> <img src={$ICON} border='0'> </a>";
  11. You should be testing $_FILES['userfile']['type'] to see whether you want the file or not. If in doubt do a few sample tests and echo out the type to see what it thinks the css files you're giving it are.
  12. If you are doing a GET request then you need to make them arrays, e.g. ?order[]=1&id_mod[]=2&order[]=2&id_mod[]=4&order[]=3&id_mod[]=5 Then you can utilise them in PHP properly. To see what you're passing over : print_r($_GET['order]; print_r($_GET['id_mod'];
  13. Can you give us some sample arrays for $test and $main_table and the starting value for $x. You probably find once you've intepreted the arrays the value you are looking for is in fact not set. Hence the loop termination. If $x is 0; What is $test[0] ? If $test[0] = "myvalue"; Then what does $main_table["myvalue"] equal?
  14. Session timeout is determined by the settings in your php.ini file. However I believe there is a way to change the session timeout on a per domain basis (for virtual hosts). In PHP you can try ini_set("session.gc_maxlifetime", 60*60); The above sets the timeout to 1 hour.
  15. Setting that in the header shouldn't matter. What you need is the encoding in your html head tag. Also YES, you will need to store the data as UTF8 format in your database in order to maintain cross language integrity, otherwise you'll be dropping a lot of characters if you store in another format.
  16. The answer to your question is most likely the following : Your host has disabled the fsockopen function in the PHP.ini file, and too rightly too. Imagine what happens when lots of amateur programmers start creating sockets and not closing them...
  17. You need to register your session information in a database most probably to be able to count such information. Then it's a nice simple SQL statement
  18. Don't use cookies, there is no guarantee that the user has not modified them, let alone allowed them to be utilised. I imagine they're just as efficient as each other. As for disk access; it would be at both ends. SESSION on the server and cookies on the local machine, however the overhead from writing a SESSION would be negligble to be honest unless you're planning on writing MBs worth of information. Alternatively you could utilised a database to store the information instead of a session, but relate it to session_id and to the lookup. Either way it's disk access, although there is a good chance that your database system will have cached the query in memory for use in subsequent requests.
×
×
  • 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.