View Full Version : [Help] PHP/SQL
ThisNameWillDo!
21-12-2009, 04:09 PM
Hello, I'm in need of help again. I have been coding a couple of scripts in PHP using SQL databases. One of them is a photo album script.
Some of the script:
<? $getphotos = mysql_query("SELECT * FROM photos WHERE albumid = '$albumid3' ORDER BY 'photoid' ASC");
while($photos = mysql_fetch_array($getphotos)) {
echo "$photoname - $photodesc<br /><br /><img src='$photoloca'><br /><br />";
}
?>
This shows all of the photos that the user has in that album, I need it so it only shows one photo at a time, then you can press next and it shows the next photo and go through all the photos in the album.
Any help appreciated, +rep if I can.
Thank you very much,
Vince.
Kristianw
22-12-2009, 12:04 PM
Hi there!
Try a dynamic solution with PHP's $_GET function.
I havent tested this but it should work.
In the URL (example): mydynamicalbum.com/index.php?imagenumber=2
Then run a query wich wil post the image with ID 2.
The link can be created dynamicly by adding +1 to the imageID you are already visiting.
Good luck :)
ThisNameWillDo!
22-12-2009, 01:17 PM
Hi there!
Try a dynamic solution with PHP's $_GET function.
I havent tested this but it should work.
In the URL (example): mydynamicalbum.com/index.php?imagenumber=2
Then run a query wich wil post the image with ID 2.
The link can be created dynamicly by adding +1 to the imageID you are already visiting.
Good luck :)
Thanks, but I don't think this fixes my problem just yet. I'll give you another example. I have a script that displays a user's friends, but I only want it to display 4 of all their friends, like it does on facebook and bebo for example, any idea how I could do this? +Rep :)
LMS16
22-12-2009, 01:45 PM
mysql_query("SELECT * FROM `friends` WHERE `friend`='$username' LIMIT 4");
Hope that helped.
Lew.
ThisNameWillDo!
22-12-2009, 02:53 PM
mysql_query("SELECT * FROM `friends` WHERE `friend`='$username' LIMIT 4");
Hope that helped.
Lew.
That's done it, thanks a lot! :) +Rep if I can.
LMS16
22-12-2009, 09:19 PM
No probs, next time google ;) XD
Lew.
Dentafrice
23-12-2009, 05:49 PM
Next time Google? That's amazing advice. Not. Sometimes asking someone for help is 50x better then just using Google to find something.
You learn a lot more when someone posts the code to a specific situation, and helps you learn that way. That way you know how to modify that code, and use it in the future.
LMS16
24-12-2009, 02:55 PM
Well, most people dont check google. And I mean, you dont learn if you dont explore...
It isnt hard to search for something and put 2 and 2 toegther to get 4... i mean stop complaining and get on with life.
Lew.
Dentafrice
24-12-2009, 03:58 PM
Well, most people dont check google. And I mean, you dont learn if you dont explore...
It isnt hard to search for something and put 2 and 2 toegther to get 4... i mean stop complaining and get on with life.
Lew.
It's hard to quit complaining when the only advice that is given around here is "check Google".
If everyone checked Google all the time, there wouldn't be a need for this section of the forum.
From 90% of your posts, at least one part of your post has something to do with checking Google, even if you have no idea what the post/topic is about.
In the words of you, quit complaining people don't use Google and get on with life ;)
Boonzeet
24-12-2009, 10:14 PM
A lot of the time when I encounter a problem, it's a CSS or xHTML markup issue. Google can't help me with that, the searches return useless tutorials.
However, you did help him out, so I can't be too critical.
ThisNameWillDo!
25-12-2009, 01:28 PM
If I post on here, basically it means I haven't found the answer on Google and I need help, and I got it, thanks guys :)
Protege
25-12-2009, 03:58 PM
A lot of the time when I encounter a problem, it's a CSS or xHTML markup issue. Google can't help me with that, the searches return useless tutorials.
However, you did help him out, so I can't be too critical.
Yes you can actually, if you use your common sense with what you type in google, I bet some one has posted on a forum (Oh thats what youre doing here, oh damn) an issue similiar to yours, and google's spider has found & recorded it.
Boonzeet
26-12-2009, 10:17 AM
Yes you can actually, if you use your common sense with what you type in google, I bet some one has posted on a forum (Oh thats what youre doing here, oh damn) an issue similiar to yours, and google's spider has found & recorded it.
Right. So it's a lack of common sense that after Googling everything under the sun it was a specific theme-set CSS class defined in an external stylesheet that grouped body and table together?
I think I'm the only person to have had that problem so far. Google is **** for finding specific problems, and don't accuse someone of a lack of sense for something that doesn't exist on Google.
Also, if you'd read the thread unlike a complete moron, you'd realise that this isn't my thread, so that's not what I'm doing here, because I'm not the one asking for help.
Well done, you're a total moron.
(For the record, *someone, *that's, *you're)
Protege
26-12-2009, 11:01 AM
I bet I could find your issue on google if I was motivated to do so, as thats how I fix my problems which guess what, I dont get cause I use common sense...
"Moron", my days... let me guess you watch anime, and ********** over hentai and I know you have an interest in cosplay... I lulz in real life bro. Oh and just to add I looked at one of your pictures on deviantart, Lulz hahha my ******* god Im pissing myself man... just to add that chick dont look gorgeous, she has like a butt chin thats bigger than my ass crack and I could imagine without that hair, she'd look like a dude.
If you want to correct my grammar, please read over my website and tell me what errors you find cause to be honest I could fix two of the errors using firefox spellcheck, but I really couldnt be ******.
Have a good Christmas and New Year, cosplaying-******-grammar-checking-******
Now, go back to your room and get that chick with a **** to **** you solid.
Edited by iAdam (Forum Super Moderator); Please do not be rude to other forum members.
Boonzeet
26-12-2009, 11:24 AM
Lol? Way to respond to trolling like a 4-year-old.
Protege
26-12-2009, 11:33 AM
It worked though, and thanks for the P/m, I accept your apologies. Nice signature change, what happened to deviantart one?
Boonzeet
26-12-2009, 11:36 AM
I haven't used deviantart since september. Where's the point in an out-dated link?
Anyway, the fact you mentioned it reminded me to advertise TekCube a little more. Thanks, anyway.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.