Jump to content

eran

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.binpress.com

Profile Information

  • Gender
    Male
  • Location
    Israel

eran's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You could have check your mysql_error() and let us know yourself... It seems you are using dynamic variables for columns names in both the column list and ON clause. Those are usually static values - what is the value of $egroup and $managerId? why are those variables? what are the contents of mysql_error()?
  2. You'll find it much easier to achieve if you normalize your database. Have a table for topics and a table for posts Something like: topics - id - title posts - id - topic_id - message
  3. The dot '.' operator is used to concatenate string in PHP. http://php.net/manual/en/language.operators.string.php
  4. eran

    mysql error

    You have failing queries. mysql_query() returns a resource or a boolean false - the error is telling you that you trying to pass a failed query result into mysql_num_rows() which expects a mysql result resource. You need to perform a check before passing a mysql_query(), something of the form $result = mysql_query(...); if($result) { //use result in mysql_num_rows or any other relevant function } else { // debug / log error using mysql_error() }
  5. Writing your own is well and good and does has some learning value, but at least have a look at mature packages that have been developed and tested by many seasoned developers. You can learn a lot from reading the Zend_Db classes as phpfreak suggested
  6. eran

    Whats best?

    Don't index blindly. Understand how indexes work and how you should apply them. I suggest going over this excellent presentation on indexing strategies - http://www.scribd.com/doc/2376115/Coding-and-Indexing-Strategies-for-Optimal-Performance
  7. mysql_query() returns a resource if the query was successful. To get database rows, you need to use fetch function such as mysql_fetch_assoc() on the result $result = mysql_query($query); i($result) { $row = mysql_fetch_assoc($result); } http://php.net/manual/en/function.mysql-fetch-assoc.php
  8. You should use a document-based text indexing solution such as Lucene or Sphinx. Both are highly performant (especially sphinx) and fit your need much better than MySQL.
  9. There is a reason, and that is if you are not always expecting the data to come from a superglobal. If you pass in an array, you can create the same object using a form submission, from inside another object, from database data and so forth. By passing the data as an array instead of relying on it existing in superglobals you are increasing the re-usability of the class.
  10. No, it should be $info['posts']. var_dump($info) to see what it contains
  11. Left join the ads table SELECT y.*,COUNT(ads.UID) AS posts FROM YBK_Login AS y LEFT JOIN YBK_Ads AS ads ON ads.UID=y.ID GROUP BY y.ID
  12. I showed you exactly how in my previous response. You join the first two tables using the implicit syntax (separating them with a comma) and the rest using the explicit (specifying the join type and on clause). I suggested you change the implicit syntax to the explicit syntax and wrote the exact statements to use
  13. This is why you shouldn't mix join syntax. Try fenway's suggestion, or change all the joins to explicit joins - Change: FROM tplss_seasons S, tplss_seasonnames SE To: FROM tplss_seasons AS S INNER JOIN tplss_seasonnames AS SE ON SE.SeasonID = S.SeasonID And make sure to remove that condition from the WHERE clause
  14. Sessions in the database or in the filesystem is not much a question of security as thorpe says, but more a question of scalability. For most sites having the sessions in the filesystem is the easiest and best option, however when you grow beyond a single server, sharing filesystem sessions between servers becomes very problematic. In this case sessions are usually moved to a database to which all servers have access to
  15. GROUP BY Department? You can also use SELECT DISTINCT Department FROM $table
×
×
  • 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.