[PHP-DB] serving up images
I have about 25 or so images that I would like to serve up on my site's home page. I would like the image to change every 3 days or so. Does anyone have a hint as to how I might go about doing this in a simple fashion? I don't want it to be random, but I do want it to cycle through the images and then start over again. Some initial thoughts: I could just set up a custom index rather than a simple series (1,2,3...). I could then serve up the image that matches the current day of the month or matches a day range. But this gets tricky because I don't have exactly 31 images, and there are obviously shorter months. AND, I want to be able to enter more images without breaking the code. I could do it randomly, and also store an "exclusion list", so every three days, my page gets a new random image whose index is not stored in this exclusion list. This seems like the most likely approach, but sounds like extra work. Any ideas? tnks Matthew J. Horn Principal Spielboy.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] dynamic image generation
Hello, I want to generate information graphics on the fly using MySQL and PHP. I've played with the GD package and been able to generate images, but my problem going forward is that the amount of text in each graphic will be variable (some have 10 lines, some have 5), which affects the size of the image and the height of each text-area. Does anyone know of a package of functions or a source that I can look at that describes how to do more than the standard graphic-gen stuff in PHP? Help appreciated. Matthew J. Horn Principal Spielboy.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] in-line function?
Donny wrote: > can we make simple codes "in-line" instead of function > calls? > > or, it makes no help in PHP? Donny, can you please explain what you mean by this, perhaps with a code sample? I am not really sure what you are asking. Matthew Horn Principal Spielboy.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Page Use
> So yes, it's possible with PHP. Is it worthwhile? Eh, maybe. But just > realize the overhead that you'll be putting on a busy site > with a DB entry > for EVERY page view - even for pages with no dynamic content > (not to mention > any pages that might require real DB querying). Why not use click-stream analysis software that is out there? My ISP offers the log-analyzer FunnelWeb from Quest. It does not add any overhead because it parses the log files offline (and makes some assumptions about sessions) to track individual users through my site. I dont know how expensive it is, but there is a free download. I am not affiliated with Quest, but I have become a big fan of FunnelWeb. matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Problem when using browder back button
> It's an issue of using POST instead of GET and has nothing to do with > PHP. Most browsers won't "re-post" POST data for you for security > reasons. GET, however, is just a URL with a query string, so it simply > requests it. Assuming you can't re-write the POST inputs as GETs, is there a way around this so users don't have to see that error? matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] hotornot functionality [resolved]
My apologies for the large email, but I wanted to include all the source code for interested folks and thank everyone who provided suggestions for implementing "hot or not"-like functionality. Here is what I ended up doing. I've stripped out alot of the formatting to make it as readable as possible, but it's a little messy. Tried to comment it to help you see what is going on. Basically, it builds a comma separated list of images that have been rated and using "NOT IN" in the query, gets a random one that hasn't been seen yet. Feel free to contact me off list if you want to see the beta page that implements this. Matt --- based on votes You rated it: '; } ?> Start Over'; } else { ?> Rate from 1 through 10 to see the next picture 1 2 3 4 5 6 7 8 9 10 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] redirecting to a page
Remember, though, you can't set an HTTP header after you've sent output to the client, so you needc to do your redirecting (assuming there's a condition) before you display ANYTHING. BAD: if (somecondition) { Redirect(www.mypage.com); } ... GOOD: } else { Redirect(www.mypage.com); } HTH, matt > -Original Message- > From: Hutchins, Richard [mailto:[EMAIL PROTECTED] > Sent: Friday, May 30, 2003 10:26 AM > To: 'Rick Dahl'; [EMAIL PROTECTED] > Subject: RE: [PHP-DB] redirecting to a page > > > Redirect(www.mypage.com); > > > -Original Message- > > From: Rick Dahl [mailto:[EMAIL PROTECTED] > > Sent: Friday, May 30, 2003 10:23 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP-DB] redirecting to a page > > > > > > I need to redirect to another page once some scripts that I > > can't alter run. > > > > I have this function at the top of my page: > > > > > function Redirect ($url) { > > Header ("Location: " . $url); > > exit; > > } > > ?> > > > > How do I call the function? > > > > Rick > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] hotornot functionality
I am toying with the idea of implementing functionality similar to the hotornot.com site -- for a different purpose, mind you, but the same kind of user experience. Here's what it does: 1. A picture is served up. 2. User clicks on a radio button scale from 1 to 10 to "rate" the picture. 3. The page refreshes. The rating is re-computed with the user's rating for the original picture. The original picture becomes that "last rated" pic, and a new one is served up. 4. The user can cycle through as many pictures this way as they want. I have MySQL and PHP to work with. What I am trying to do is figure out the best approach to implementing it. Specifically, when the user clicks on the radio button, that triggers the form submit via JavaScript. The form submit updates the database with the rating and then fetches the next row. The problem that occurred to me as I was putting together a prototype is: I don't want the user to get the entire result set of all the images in the database at once. I really want them to get just the two images (the one they just rated and the one they are about to rate). Is there a way to "remember" the last row they selected and then use that number to fetch the next one on the subsequent request? I can keep recycling hidden form fields with a number, which should work ok, but the problems come up when they reach the last row. Anyway, just looking to see if you folks have some ideas. I would prefer to roll my own rather than use one of the available "hotornot-style" PHP scripts to do this. Matthew J. Horn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Supress MySQL error messages...
> Ex. > $number = @mysql_num_rows($result_var); > > Having a bit of a brain cramp right now as I normally do not suppress > errors. My apologies if I'm wrong. The at sign works fine for suppressing error messages from mysql, but I usually have it at the beginning of the assignment, as in: @ $number = mysql_num_rows($result_var); Is there any reason to do this versus the way Richard mentioned (having the @ before the mysql statement)? Are there any downsides to doing this at all? I understand it can make you lazy later on and not bother doing error checking, for one... matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php