Jump to content

jdavidbakr

Members
  • Posts

    271
  • Joined

  • Last visited

About jdavidbakr

  • Birthday 07/31/1973

Profile Information

  • Gender
    Male
  • Location
    Tulsa, OK

jdavidbakr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Not sure what you mean - what kind of data structure are each of the tables and what do you want your result set to look like?
  2. Yes. Like i said - Flash is root of the problem. If flash is calling the page in addition to the browser then that is why it's being pinged twice. You need to locate in the Flash where it's calling the page, and either remove it or, if it has to be called, account for it in your PHP code.
  3. I've done this by having PHP put the file into a storage location, and populating a database table that a cron script runs to encode the file. You probably could just as easily use the shell_exec() function in your upload script, but you might run into timeout issues if it takes too long to encode.
  4. If you remove the flash element does it increment as you expect?
  5. I don't see where you're saving the uploaded file, it looks like you're just checking to make sure it was uploaded? PHP puts the uploaded file in the temp directory, and deletes it when the script is done running. If you want to keep it you need to save it somewhere using move_uploaded_file()
  6. Do you have access to your server logs? You can check to see if the page is being requested twice, and what the referrer (if any) is. You might dump to a log file some points within your code to be able to trace what's happening, and hopefully see why your code is being executed twice instead of just once. Is this a single file or is this included in another file? Any chance that you have the "include" statement multiple times?
  7. If you have caching on your MySQL server then you're probably not going to actually use much resources when polling the database.
  8. I think you want $query1 = mysql_query("UPDATE act SET `from`='$new_un', `to`='$new_un' WHERE `to`='$un_curr' OR `from`='$un_curr'"); That will update both the 'from' and 'to' values on any row that has either 'to' or 'from' = $un_curr. If you only want to update 'from' where 'from' = $un_curr, and only update 'to' where 'to' = $un_curr, then you do have to do it in two separate queries. (Well, you _can_ do it in one, but let's just say it's a lot easier to do it in two)
  9. Probably the best way is to use XML in your Flash app, and have it call a PHP page that returns the info you need. Then you just process the info in your flash app however you need to. I've done this once or twice but am not fluent enough it how to do it to give you any pointers.
  10. I think you're wanting to use "group by" select post_id, post_subject, group_concat(like_username separator ', ') likes from forum_posts left join forum_post_likes using (post_id) group by forum_posts.post_id should return something like: post_id post_subject likes 1 'likable post' 'joe, sam, fred' 2 'stupid post' NULL
  11. Have one table that is your user table, which should have a primary key (auto-increment most likely). In the comments table, don't put the user's name, instead put the ID from the user table. Then, when you list the comments, you can perform a join to get the information from the user table, including the current name (and avitar and whatever else you might need). So your tables might be: user ------ user_id (primary autoincrement) user_name comment ------ comment_id (primary autoincrement) user_id (foreign key referencing the user table) comment_text to get the username and comment list: select user_name, comment_text from comment join user using (user_id)
  12. Javascript pushes the application logic to the client browser, so that would reduce the server load; but if you want to prevent the answer from even being on the client's computer (where they can look at the source to find the answer) you would have to do it with ajax and ping your server. However, that kind of request is not going to tax your server much; you'll just be sending back probably JSON or even just the text of the answer. And you're going to have to query the database either way to get the answer. Your web server is designed to handle tons of requests, remember each image/stylesheet/etc on your page is a separate request. The server load for pinging back to the server to get the answer won't be significant compared to the server load to get the question in the first place.
  13. I _think_ you want this: <Files ~ "^\.(jpeg|jpg|png|gif)$"> http://httpd.apache.org/docs/1.3/mod/core.html#files
  14. Put your dates in quotes: mysql> SELECT COUNT(referral_id) FROM tbl_referral_info WHERE pt = 1 AND refDate BETWEEN '2010-01-11' and '2011-01-11'; Otherwise it will evaluate 2010 minus 1 minus 11 which is why it's giving 1998/1999 as the non-dates.
  15. There's an error in my code, I incremented the wrong value inside the loop $statement = "select id from table order by id"; $result = mysql_query($statement); $id = 1; while ($row = mysql_fetch_row($result)) { $statement = "update table set id = '$id' where id = '{$row[0]}'"; if(!mysql_query($statement)) { echo mysql_error(); exit; } $id++; } I made some changes to include an error dump. If you try this again you will probably get an error. If you want to do it the first way, after you empty the table you can reset the auto increment value to 1 in phpMYAdmin, go to the table and click on 'operations', it's on that page.
×
×
  • 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.