Jump to content

ngreenwood6

Members
  • Posts

    1,356
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

ngreenwood6's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Well this first problem I see is this: $query = "select * from iesnews"; $rows = $result->num_rows; Where is result coming from? It is not defined anywhere in the code you provided and maybe that is your first problem. Also if you have alot of rows or data in that table that query is going to take a long time to complete. I would recommend updating that to query to "SELECT COUNT(*) FROM iesnews" and then getting the result of that as the count (will be much much faster). Now the next problem i see is that your query is doing a range of -10,10. Running that in a query tells it to fail itself because there is no -10. Which is why your query is failing. Which is also stemming from the problem above i believe because it is not actually getting the number of rows. The last part is the query : $query = "SELECT * from iesnews ORDER BY 'posted' DESC $max"; I don't think that you meant to have the single quotes around posted. I would remove those unless they are ticks that got converted here somehow. If you fix the issue above with the rows being the incorrect number i believe that your query will start working with the exception off the "posted" issue maybe not sorting properly.
  2. Hello all, I need to be able to create file backups on different types of servers running php (windows or linux). I was hoping that there was a good php class out there that would already handle this for me but I have not come across anything as of yet. I can do it perfectly fine in the linux environment but was hoping to find something that would work on a variety of servers running php. I was hoping that it would support php 4 for older sites. If anyone has any good resources for this please let me know. Thanks
  3. That is what you wanted correct?
  4. try this then : $newPay = number_format($oldPay + $distance * .40, 2); $newPay = sprintf("%01.2f", $newPay);
  5. He is correct in saying number_format doesn't quite do what youre expecting. It will only keep the decimal points if there are more than two it will limit them to two places. A solution for you would be: $newPay = round($oldPay + $distance * .40, 2);
  6. Maybe you can take a look at this to see if it will work for you or if there is something you can build off of it : //the original string $string = 'PostInfo,color-main,Newman,not-collapsed;Friends,color-main2,Top Friends,not-collapsed||Twitter,color-main2,Twitter,not-collapsed;Signature,color-main2,Signature,not-collapsed;AboutMe,color-transparent,About Me,not-collapsed'; //could be wrong but seems like this should just be a semi-colon $string = str_replace('||',';',$string); //explode them by the ; as it seems that is the separator of the content $ex_string = explode(';',$string); //count them (faster than doing it in the loop) $ex_count = count($ex_string); //loop through each of the sets for($i=0;$i<$ex_count;$i++){ //now you can explode them on the comma to get there data $ex_string[$i] = explode(',',$ex_string[$i]); //you can either check the data here if($ex_string[$i][0] == 'PostInfo' && $ex_string[$i][3] == 'not-collapsed'){ //it is not collapsed so do something } } //print it out so you can see the data print_r($ex_string);
  7. Ok so here is my opinion on it with a quick review of it without really looking too deeply into it. First of all I would add more normalization to the tables. For instance in the stories table you have two fields in there for totalThumbUp and totalThumbDown. I would probably separate them out into another table storing the user id that gave it a thumbs up/down. This will allow them to change there vote in the future and you will still be able to find those values when you need them which you may not always need them. Another thing that I would do is separate out the actual content for the stories. Because that field is storing a large amount of data it will make your queries slower and most of the time you will not need all of that information unless you are viewing the actual story (depending on your scenario). It also seems as if you have some fields in there that dont really need to be. For example in the stories table you have a field for totalViews but there is a table for StoryViews which seems to just be storing the views which you should just be able to count the views from that table if needed. One last thing is it seems as if you are storing the dates as timestamps since you are using int fields. Why not just store them as dates? It is alot easier to look through the data in the table and find articles within a specific date range. Also in the future if you decide to do horizontal partitioning (which dates work perfectly for, especially with "stories") you will be able to do them by the year that they were posted which will greatly improve the speed of your queries with alot of entries in the database.
  8. Thanks for the response Pikachu2000. Never thought about doing a calculation to see how long it would take to reach that value. That pretty much eliminates that from being a problem.
  9. I dont think that really answers my question. I understand the replication process of storing it across multiple servers so that access to the data is faster but it still uses the same id's in all of those tables so the id would still hit the max number at some point.
  10. I am trying to find out what the maximum number of entries in a mysql database would be. I read online at multiple sources saying that there is no limit on the size of the information or the number of entries in the database. However, that is kind of confusing to me as integer fields obviously have a maximum number that they can store. For example in the mysql documentation it states that the maximum value for an unsigned bigint field is 18446744073709551615. In most cases you will have an auto-increment field with an int or bigint type. So wouldnt the maximum number of entries be this value since eventually you could hit that number. If so then what would you do at that point, would you have to delete some data from the table or split the table into now two tables and start the indexes over. I just want some clarification on what you would do if you were say facebook/twitter/google and stored that amount of information and could potentially reach that number. Any help is appreciated.
  11. Looking at the data that you posted it seems to me that this will accomplish what you are trying to do giving you all of the information: //get the data $data = file_get_contents('http://www.datafeed.com/data.txt'); //first of all explode them on new lines to get all of the info $lines = explode("\r\n",$data); // you must use double quotes and it might just need to be \r or just \n test it until you get a full array of all the lines as there own entry //setup a holder for the type of data you are getting - (general, clients, prefile, servers) $type = ''; //setup a holder for all of the data $content = array(); //go through each line and explode the data if(is_array($lines)){ foreach($lines as $line){ //setup holder for line data $line_data = explode(':',$line); //check to make sure there is data if(is_array($line_data)){ //if there is only one item it is a type so change the type and continue if(count($line_data) == 1){ $type = $line_data[0]; } else { $content[$type][] = $line_data; } } else { continue; } } } //now you can print out the data to make sure that you have it in the way you need print_r($content); When you run this code it should give you back a multi-dimensional array with the type of data as the key for the array and all of the fields with numeric indexes based on there position. Here is an ex. [!GENERAL] [0] => [some data] [!CLIENTS] [0] => array() [0] => username [1] => memberID [2] => John Smith [3] => PILOT [2] => array() [0] => username [1] => memberID [2] => Harry Potter [3] => ATC So you can then just do a loop on the data that you need and check its type if(is_array($content['!CLIENTS'])){ foreach($content['!CLIENTS'] as $client){ if($client[3] == 'PILOT'){ //do something here } } } Hopefully that is not too confusing and will solve your problem.
  12. I am not sure what you mean by it is giving you a whole page of errors. This should work exactly the same but remove the warning about split: list($ptno,$ptname,$num,$price) = explode(':', $inline);
  13. No that is a warning because your error reporting is turned on. The split function is deprecated in php (see here http://http://us2.php.net/split. You should use explode() instead of split().
  14. You do not want to use * because you will have column name conflicts. In your case you will want to use l.*, li.imagepath which will give you all of the listings information and the image associated. Also I think that you are not getting the last row because there are no images associated with it. To fix this problem you should be able to change JOIN to LEFT JOIN and it should work.
  15. Maybe its this line: $this->round_cr = ceil($this->count_query) / $this->page_limit; Should be this: $this->round_cr = ceil($this->count_query / $this->page_limit);
×
×
  • 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.