Jump to content

dj-kenpo

Members
  • Posts

    155
  • Joined

  • Last visited

    Never

Everything posted by dj-kenpo

  1. doing it that way is really heavy on the server cpu if you're getting even moderate hits. your site will slow down fast unless you have a dedicated server.
  2. he biggest concern you'll face non php related is cpu usage if your app grows. $100/yr will get you 1tb bandwidth and 200gb space these days, oh sure, but use even a smidge of the servers cpu and your site will be shut down temporarily.
  3. # Adam added a new photo to 'Loki the ferret' - Tuesday, April 3 # Adam added a new journal entry entitled 'VNV Nation - Judgement' - Monday, April 2 # Adam added a new photo to 'Loki the ferret' - Friday, March 30 # Adam added a new photo to 'Loki the ferret' - Friday, March 30 # Adam added a new photo to 'Loki the ferret' - Friday, March 30 would be adam added 3 photos to ... not 4 photos
  4. so I have a query that grabs the 10 latest updates to my site (it's a seperate table that tracks inserts) as of now, you can see in the example output if I add 3 photos, it lists each, I'd much prefer to to have the system say, Adam added 3 new photos... (only if they happen one after the other though with no breaks inbetween!) but how would I do this? load the result into another array and then sort? I'm having trouble wrapping my head around it. here's the normal call $sql_update_pings = "SELECT * FROM update_pings WHERE User_ID = $User_ID ORDER BY Timestamp DESC, ID DESC LIMIT 10"; $result_update_pings = mysql_query($sql_update_pings); while ($row_update_pings = mysql_fetch_array($result_update_pings)) { $update_pings_ID = $row_update_pings["ID"]; $update_pings_Title = $row_update_pings["Title"]; $update_pings_Mode = $row_update_pings["Mode"]; $update_pings_Parent = $row_update_pings["Parent"]; $update_pings_Timestamp = $row_update_pings["Timestamp"]; .......etc....... result: # Adam added a new journal entry entitled 'How to - Wireless hand crank mouse' - Wednesday, April 11 # Adam added a new journal entry entitled 'Ferrets hide things better than bunnies.' - Tuesday, April 3 # Adam added a new photo to 'Loki the ferret' - Tuesday, April 3 # Adam added a new journal entry entitled 'VNV Nation - Judgement' - Monday, April 2 # Adam added a new photo to 'Loki the ferret' - Friday, March 30 # Adam added a new photo to 'Loki the ferret' - Friday, March 30 # Adam added a new photo to 'Loki the ferret' - Friday, March 30 # Adam added a new CV item 'Chicago Tribune "Bio-artists bridge the gaps between arts and sciences" March 8th 2007' - Friday, March 30 the actual query can be seen running at brandejs.ca/journal.php if it helps cheers!
  5. $sql=" SELECT journal_comments.ID, journal_comments.rel_id, journal_comments.User_ID, journal_comments.Name, journal_comments.Email, journal_comments.Comment, journal_comments.URL, journal_comments.Timestamp, photo_album_comments.ID AS photo_ID, photo_album_comments.rel_id AS photo_rel_id, photo_album_comments.User_ID AS photo_User_ID, photo_album_comments.Name AS photo_Name, photo_album_comments.Email AS photo_Email, photo_album_comments.Comment AS photo_Comment, photo_album_comments.URL AS photo_URL, photo_album_comments.Timestamp AS photo_Timestamp FROM journal_comments, photo_album_comments WHERE journal_comments.User_ID=$User_ID AND journal_comments.comment_approved=0 AND photo_album_comments.User_ID=$User_ID AND photo_album_comments.comment_approved=0 ORDER BY journal_comments.Timestamp DESC, photo_album_comments.Timestamp DESC LIMIT 5 "; just caused nothing to show.. no error, just.. nothing... any ideas? there's tons of info in both tables
  6. but then the while loop won't work, how do I still list all the data, (sorry, I'm getting the feeling this is a dumb question) while($row3 = mysql_fetch_array($result3)) { $ID = $row3["ID"]; $rel_id = $row3["rel_id"]; $Name = $row3["Name"]; $Comment = $row3["Comment"]; $Date = Date("F d Y",$row3["Timestamp"]); etc.... naming them as an aliase changes this, how do I get the data from both and still spit them into my layout?
  7. "So, any idea how I would do this through Javascript?" there's a javascript section of the forum, but your best bet is to join a specific js forum. also, you could simply have your php script allow the submt, but then return an error if it was left blank. you will HAVE to (not must, but should) do this ANYWAYS. as some users disable javascript etc different browser incompatibilites (ie web browser on xbox, palm pilot, etc). javascript isn't foolproof, so you should really always double check after submit
  8. I'm having trouble making a query to both tables simultaneously. I want to grab the rows and sort them, but I'm only getting ONE set of data not the two, so the query is deffinetly wrong. if the second table has 2 rows, all 5 reslts still show, and it simply REPEATS 1,2,1,2,1 (as in row1 etc from table2) the query I wrote is: $sql="SELECT journal_comments.*, photo_album_comments.* FROM journal_comments, photo_album_comments WHERE journal_comments.User_ID=$User_ID AND journal_comments.comment_approved=0 AND photo_album_comments.User_ID=$User_ID AND photo_album_comments.comment_approved=0 ORDER BY journal_comments.Timestamp DESC, photo_album_comments.Timestamp DESC LIMIT 5"; table structure is: journal_comments.id journal_comments.rel_id journal_comments.User_ID journal_comments.name journal_comments.comment journal_comments.url photo_album_comments.id photo_album_comments.rel_id photo_album_comments.User_ID photo_album_comments.name photo_album_comments.comment photo_album_comments.url I tried google, but I'm not looking right, I just got results where people needed the 'like' command, and that's not what I need as far as I know. output I want. if photo_album_comments has 2 rows and journal_comments has 3 rows I want all 5 rows, listed out into the $result array, and sorted by timestamp. what simple mess up did I make? Thanks guys!
  9. hmmm, ok, thanks barand! that's really quick, so it really does just come down to scaling then. this was all so great, I'm glad this side and all of you (especially barand!!) are here
  10. this is true, thanks barand. on a seperate but related question, (seperate as I'll stick with two) what's your estimate of the performance difference between having one or two, I have no idea how to begin gauging benchmarks like that (nor is the db large enough ). does an extra where clause make a huge performace hit even with indexing? thanks!
  11. sorry. no. there is no relationship between blog and photos. one is for posting a blog, the other is for a photo album, they look different. but they both have the same comment system, and the table structure for the comments table is the same. ie journal_comments.id journal_comments.rel_id journal_comments.User_ID journal_comments.name journal_comments.comment journal_comments.url photo_album_comments.id photo_album_comments.rel_id photo_album_comments.User_ID photo_album_comments.name photo_album_comments.comment photo_album_comments.url hope that helps, I'm not trying to be cryptic, it's just sort of a more theoretical question than a code question. speed is my main concern, but it seems silly to have too tables exactly the same
  12. blog entries and photos themselves are in 2 different tables. I'm not worried about deleting, and if I did, I'd run an auto script and delete everythign where mode=blog or photo. if it matters, the query also has User_ID, so it looks for all the comments for a certain user first, then wittles down by photo/blog then by entry. I'm not sure if that makes it better or worse for say... lets imagine 400k rows....
  13. cool, that makes joint queries where I want data from both faster, but my only question then, what's the performance hit? it's an extra where clause, does it matter at all? is the difference so tiny I need not worry? again I'm thinking of the comment table once it hits say 400k records, and it now sorting what ones are needed and not, rather than not having to at all
  14. so ANdy B is suggesting one table, and you guys are suggesting 2? any oppinions on speed?
  15. I'm not storing anything large in the database, I don't use blobs. no blobs. it's just comments. name, email, comment. my thinking is, it's easier for me to have one large table for these, the downside I see in that is that queries for specific , say blog comments have to be searched more. it's an extra where clause, I'm not sure if the impact of the where clause and extra indexing size is worth it. I wouldn't know how to begin comparing so I'm hoping someone here with experience in larger db management could say.
  16. ok, so I'm building a multi user site (for fun) and I on the blog and photo sections you can leave comments. right now I have 2 comment tables, one for blog, one for photos. they're both the same. I'm worried about things once theres lots of entries, so what's optimal? the 2 comment tables are exactly the same, should I have both, or have one comment table and then add an extra row to describe whether it's for the photo or blog. thanks, sorry if this is an ignorant question, both ways work, but I'm wondering if there's a clear advantage. I very rarely need to call results from both at the same time.
  17. Thanks Dsaba! the cURL libarary was EXACTLY what I needed and it worked perfectly!
  18. anyone? the only thing I found was http://username:password@www.domain.com/dir but with $content=file_get_contents("http://username:password@www.domain.com/dir",FALSE,NULL,0,200); that simply returns "failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required".
  19. you can do it with java. facebook uses a java file explorer.
  20. if you look at your code both rows say class as "odd". $class = $class == 'even' ? 'odd' : 'even'; is in the wrong place. it's outside of your loop, therefore it never changes value
  21. No, what I'm asking is if there's a way to send the login information via the headers or a post and skip the grey box via an automated login script.
  22. I realize that, but as I said, this is a built in application to my webhost. I cannot remove the ugly grey box.
  23. psd files are photoshop files, it has nothing to do with php, the clients browser must support them. which I don't believe any browser does.. as it's not a standard image file, it's made up of vector/raster and multi layers.
  24. the first example echo's into a table. you need to echo your results into a table as well. and then possibly style it with css. echo "<table width='100%' border='0' bgcolor=#CCCCCC cellpadding='2' cellspacing='1'> <tr> <td width='135'><font size=1.5><b>$makes[$current]</b></font></td> <td width='55'><font size=1.5><b>DISP</b></font></td> <td width='60'><font size=1.5><b>FUEL</b></font></td> <td width='55'><font size=1.5><b>CLASS</b></font></td> <td width='110'><font size=1.5><b>EMISSION STD</b></font></td> <td width='90'><font size=1.5><b>TEST GROUP</b></font></td> <td width='90'><font size=1.5><b>EO NUMBER</b></font></td> </tr> <br>"; in the firs tone is what does this. you only have br's (line breaks) in yours.
×
×
  • 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.