Jump to content

jdavidbakr

Members
  • Posts

    271
  • Joined

  • Last visited

Everything posted by jdavidbakr

  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.
  16. If you use FireBug you can see how exactly each element is styled and where it's coming from. Sounds like you may have a size directive in your anchor tag.
  17. That's not space between the columns, that's the width of the columns. If you have the FireFox developer tools, turn on table outlines and you'll see what I mean. Or, turn on borders on your table. It looks like your table width is set to 100%. I this case, the columns will stretch to fit the table based on their content. You'll either need to explicitly set the size of td.label, or make sure your table width is not 100%.
  18. If you can live without IE showing the rounded corners, use the border-radius directive. Even IE9 will obey that. To do rounded corners with images, I've done this: CSS: div.roundbox { background-color: white; padding: 5px 10px; margin: 0 20px; } div.roundbox_wrapper { padding: 0px 5px; clear: both; } div.roundbox_top, div.roundbox_bottom { height: 20px; } div.roundbox_top_left, div.roundbox_top_right, div.roundbox_bottom_left, div.roundbox_bottom_right { float: left; height: 20px; width: 20px; background: url('../images/styles/boxes/rounded_corners.png'); } div.roundbox_top_right { background-position: 20px 0; } div.roundbox_bottom_left { background-position: 0 20px; } div.roundbox_bottom_right { background-position: 20px 20px; } div.roundbox_top_center, div.roundbox_bottom_center { background-color: #c6c6c6; float: left; height: 20px; } div.roundbox_center { background-color: #c6c6c6; } (rounded_corners.png is a 40x40 pixel circle with color #c6c6c6, so breaking it up into 4 quadrants makes the 4 corners) then my box looks like this: <div class="roundbox"> <div class="roundbox_wrapper"> <div class="roundbox_top"> <div class="roundbox_top_left"></div> <div class='roundbox_top_center"></div> <div class="roundbox_top_right"></div> </div> <div class="roundbox_center"> <!-- Content will go here --> </div> <div class="roundbox_bottom"> <div class='roundbox_bottom_left"></div> <div class="roundbox_bottom_center"></div> <div class="roundbox_bottom_right"></div> </div> </div> </div> I have two wrapper classes (roundbox and roundbox_wrapper) because I actually use javascript to do all this inserting (so in my html I just use "<div class="roundbox">...</div>" and JS wraps it all nicely for me as seen above)
  19. You can define multiple classes separated by a comma and then separately define any changes: TABLE.RightTable, TABLE.RightTableBad { float:center; border-collapse:collapse; border:3px Solid Green; border-style:ridge; } TABLE.RightTable th, TABLE.RightTableBad th {text-align:center; font-size:large; border:3px Solid Green; border-style:ridge;} TABLE.RightTable td, TABLE.RightTableBad td {font-size:normal; border:3px Solid Green; border-style:ridge;} TABLE.RightTableBad { border:3px Solid Red; } TABLE.RightTableBad th {border:3px Solid Red;} TABLE.RightTableBad td {border:3px Solid Red;} OR, make an additional class that just handles color. You can apply multiple styles to an element, just separate them by a space: <style> TABLE.RightTable { ... } .Bad td, Bad.th { border: 3px Solid Red; } ... </style> <table class="RightTable Bad">...</table>
  20. Also be sure you have a DOCTYPE and I would also recommend starting off with a reset stylesheet (google "reset stylesheet" and you should find a slew of them) I started doing this a while back and IE suddenly became much more compliant.
  21. I'd say create the permissions as minimal as you think you'd need, attempt to run mysqldump with that user and see what you get, then add permissions if it doesn't work right. My backup user has SELECT, SHOW DATABASES, LOCK TABLES, TRIGGER, SHOW VIEW, EXECUTE
  22. It may be more efficient, if you're not using the id column at all, to make a primary key from other columns? To do what you're wanting to do, I'd write a script that is something like this (psudocode): $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]}'"; mysql_query($statement); $i++; }
  23. jdavidbakr

    Email Piping

    Look at http://code.google.com/p/php-mime-mail-parser/ for a possible solution - I use this in a PHP script that handles incoming mail piped to it.
  24. What do you mean? Perhaps an example of a row in the first table and how you would like it to be inserted into the second table would be helpful.
×
×
  • 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.