Search results

  1. M

    PHP Shopping Cart

    So it's just a restricted format leading to poor technical writing? The author shouldn't have written a misleading example, as it will be copied and live on in reader's code (Joshua Bloch mentions this in the context of API design; if the google video link doesn't work, try youtube). Misusing...
  2. M

    PHP Shopping Cart

    Either the book was written for a very old version of PHP or the author doesn't know what zhe's talking about in that example.
  3. M

    scgiwrap: Caller must be the nobody user

    scgiwrap doesn't appear to work on x10. If you want to use it, open the ticket. If you don't need it, put your scripts in cgi-bin rather than scgi-bin.
  4. M

    PHP Shopping Cart

    As long as you're using PHP sessions, you don't need to serialize or unserialize data, even if you're using user sessions. You'll only need serialize & unserialize if you storing persistent data outside of PHP sessions. When does the book say to use serialize/unserialize?
  5. M

    mysql_query(select) result improperly empty

    There could still be a typo in the name of some MySQL entity, such as the DB name or table name. The PHP code would be valid and the SQL queries could be valid. Not too likely, but possible. One of those things you don't see because you're too close to the code and your brain filters it out. It...
  6. M

    PHP Shopping Cart

    array_push returns the new array size, not a new array. That's what's replacing the serialized arrays in the session variables with serialized ints. You don't have to serialize session data. PHP will handle that for you. Also, you should use associative arrays to store cart data. It's much...
  7. M

    Being a trusted publisher

    "Configuring ClickOnce Trusted Publishers". Basically, you need to get your app certificate signed by a trusted certificate authority (e.g. Verisign, Comodo). Google directory has a list of CAs.
  8. M

    mysql_query(select) result improperly empty

    mysql_fetch_row() is equivalent to calling mysql_fetch_array() with a $result_type of MYSQL_NUM, which returns an integer indexed array (rather than associative array) in the order of fields defined by the SELECT statement. The while loop form isn't any more correct, it's just simpler, hence...
  9. M

    mysql_query(select) result improperly empty

    One mistake (though probably not the one causing the problem you're seeing) is you've switched names for the $s_array variable and the array constructor when filling $s_array: I believe you meant "$s_array[] = array($fetch_s[0], $fetch_s[1], $fetch_s[2]);", though this seems redundant. Why not...
  10. M

    more multiple queries

    For the line $query = mysql_query("SELECT * FROM games $restraints") or die(mysql_error());, am I right in assuming the query succeeds, but it returns an empty result set? What's the query? Try creating a simple PHP script that runs that query. There are still some missing pieces to this puzzle...
  11. M

    Dreamweaver cs4 MySQL code does not recognise db

    Take a closer look. The error message tells you PHP was processing a statement that ended early. If your editor supports paren balancing, you'll quickly see that the opening parenthesis for the "ceil" call is never closed. The "=10" also looks suspicious. Every table is in a database. When you...
  12. M

    Dreamweaver cs4 MySQL code does not recognise db

    If something isn't working the way you want it to, say what it's doing in addition to what you want it to do. If you're getting an error message, post the exact error message. If the error message indicates a line of code, indicate which line from your source code is that line. Saying "[it] does...
  13. M

    Iframe and imagemap links - anyone know?

    The tricky thing is sometimes they are treated the same. For <a> elements (and thus fragment identifiers), name and id share the same namespace. The difference here is that name attribute values can contain some characters that ids can't. This means you shouldn't have two different elements...
  14. M

    Sort Data

    A table is most appropriate as the data is tabular in nature. Structure before layout. The CSS is immaterial for this problem. To sort the data, you'll need to do it server side when the page is generated or client side using JS. How is the page generated? Is all the data shown on one page, or...
  15. M

    how to create a link that download...

    Usually it's because the server sends a MIME type for the image that the browser can't handle, so the browser prompts to save the file. You usually can't get the browser to display such media itself, as the MIME types the browser (and plugins) can handle are hard coded.
  16. M

    PHP Warning! -.-

    They're basically the same when it comes to how much they'll compress data. ob_gzhandler uses the zlib extension. The differences are that zlib output compression lets you set the compression level (ob_gzhandler doesn't) and ob_gzhandler requires that you use output buffering. To me...
  17. M

    PHP Warning! -.-

    Your site is using both zlib output compression and output buffering's compression handler. As you shouldn't compress output twice, this is a mistake. Look for the line that starts output buffering ("ob_start('ob_gzhandler');") and replace it with something like: if...
  18. M

    scary code to debug

    The statement preg_replace('/([^"])(1-0|0-1|1\/2-1\/2)([^"])/', '\1\2~\3', $string); will only replace results that do not begin or end with double quotes, which should skip all [result "..."] tags. You could also try a negative lookbehind: preg_replace('/(?<!result ")(1-0|0-1|1\/2-1\/2)/'...
  19. M

    scary code to debug

    The result and the end of moves for the last game gets replaced with '~', like all the others. This means after the explode, there's an empty string after all the game data (try explode('~', 'a~b~')). When you call preg_match_all('/\[(\w+) "([^"]+)"\]/', $game, $matches, PREG_SET_ORDER); on an...
  20. M

    extracting from a string

    Note that you don't need to do the parsing server side. It's easier to develop & run the converter client side. The converter should output CSV or an SQL insert statement. $matches[0] contains every matched string, $matches[1] every match for the 1st group and $matches[2] every match for the...
Top