Qbasicnews.com

Full Version: I'm a genius!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Made this little gallery today (photos taken over a course of time, though). http://photos.hokuten.net/

But I've got a problem that my low-level of genius cannot overcome: I can't seem to jump rows in my MySQL table! [can't do a mysql_query("SELECT * FROM ".$gallery." WHERE upID='$imageID'");]

This is the bastard that's troubling me: (gallery is passed as "scenery" in this case)
Code:
$selectRow    = mysql_query("SELECT * FROM ".$gallery);
$takenOn      = mysql_result($selectRow, $imageID, "upDate");
$comment      = mysql_result($selectRow, $imageID, "comment");
$altVer      = mysql_result($selectRow, $imageID, "altVer");

Here's a screenshot of the DB in phpMyAdmin (I cut it up in photoshop, but see? It's got all the right rows and values... I think)
[Image: sql.gif]
???

Try:

SELECT FROM $whatever WHERE upid IN [comma seperated list of the ids you want]

I don't know whether that will work, or help you, but your problem is confusing...
Quote:I can't seem to jump rows in my MySQL table! [can't do a mysql_query("SELECT * FROM ".$gallery." WHERE upID='$imageID'");]

hmm, well what exactly happens when you do this? what error is given?
Warning: mysql_result(): Unable to jump to row 1 on MySQL result index 4 in /home2/hokuten/public_html/photos/body.php on line 8

I get this error thrice, all on the lines where I'm taking the mysql_results into variables.

What my gallery does is it gets user-input via thumbs.php. There, the user selects which gallery and image they'd like to view. For example, the user is in the "scenery" gallery ($gallery = "scenery;") and they click the first thumbnail ("$imageID = 0;") Both variables are sent to body.php as part of the URL ("body.php?gallery=scenery&imageID=0").

body.php takes this input and uses it to open the table called "scenery" (selecting all data from "scenery") The problem is here. I'm selecting * (all) rows of EVERY column. Adding the "WHERE upID = '$imageID'" is supposed to take * rows of only the $imageID column (in this continuing example, only column 0).
For some reason, when I try to select only the data from that column and then take the individual data from it ("upDate", "comment", and "altVer"), I get the unable to jump error.

Right now, the database is set to take every row of every column, which is why it works. This is wasting precious bytes of bandwidth, though. I only want one column, and all of its rows.

Additionally... does anyone know what the "extract()" function do for MySQL?