xWastedMindx
Technical User
Hello again.
I've seen this asked before.. but it was never clearly answered.
When pulling multiple tables (2 of them), and a bunch of information out of each through a query...
Is there a way to just use the Auto-Incrementing "ID" to grab all the info, instead of appending each and every field onto my query statement?
eg. -- I'd like to do something like this:
$result = mysql_query
("SELECT dvd.dvd_ID, images.img_id, FROM dvd, images WHERE dvd.dvd_ID = images.img_id" or die(mysql_error());
And this for my main HREF link to pull the info.
echo ("<a href='./spread.php?dvd_ID&img_id'>link</a>"
And the above query would then pull everything from the database and I could then insert what I need wherever in the following pages.
But instead, I have to use this:
$result = mysql_query
("SELECT dvd.dvd_ID, dvd.dvd_Name, dvd.dvd_Price, dvd.release_Date, images.img_id, images.img_file
FROM dvd, images WHERE dvd.dvd_ID = images.img_id" or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$dvdID = $row["dvd_ID"];
$dvdName = $row["dvd_Name"];
$dvdPrice = $row["dvd_Price"];
$img_id = $row["img_id"];
$img_file = $row["img_file"];
$releaseDate = $row["release_Date"];
echo ("<a href='./spread.php?dvdID=$dvd_ID&dvd_Name=$dvd_Name&dvd_Price=$dvd_Price&img_file=$img_file&release_Date=$release_Date'>link</a>"
}
I just find it very tedious, because I'm still adding to my database little by little.. as it grows...with new colums and information to be inserted, and I find that I have to go back and edit all the different queries and such. It'd be much easier if I could just use the ID to grab everything, especially for my main HREF link (above)
So is it possible, or no? I'm thinking Sessions.. but I don't know much about that yet.
"Hey...Where are all the chicks?" -- unknown
I've seen this asked before.. but it was never clearly answered.
When pulling multiple tables (2 of them), and a bunch of information out of each through a query...
Is there a way to just use the Auto-Incrementing "ID" to grab all the info, instead of appending each and every field onto my query statement?
eg. -- I'd like to do something like this:
$result = mysql_query
("SELECT dvd.dvd_ID, images.img_id, FROM dvd, images WHERE dvd.dvd_ID = images.img_id" or die(mysql_error());
And this for my main HREF link to pull the info.
echo ("<a href='./spread.php?dvd_ID&img_id'>link</a>"
And the above query would then pull everything from the database and I could then insert what I need wherever in the following pages.
But instead, I have to use this:
$result = mysql_query
("SELECT dvd.dvd_ID, dvd.dvd_Name, dvd.dvd_Price, dvd.release_Date, images.img_id, images.img_file
FROM dvd, images WHERE dvd.dvd_ID = images.img_id" or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$dvdID = $row["dvd_ID"];
$dvdName = $row["dvd_Name"];
$dvdPrice = $row["dvd_Price"];
$img_id = $row["img_id"];
$img_file = $row["img_file"];
$releaseDate = $row["release_Date"];
echo ("<a href='./spread.php?dvdID=$dvd_ID&dvd_Name=$dvd_Name&dvd_Price=$dvd_Price&img_file=$img_file&release_Date=$release_Date'>link</a>"
}
I just find it very tedious, because I'm still adding to my database little by little.. as it grows...with new colums and information to be inserted, and I find that I have to go back and edit all the different queries and such. It'd be much easier if I could just use the ID to grab everything, especially for my main HREF link (above)
So is it possible, or no? I'm thinking Sessions.. but I don't know much about that yet.
"Hey...Where are all the chicks?" -- unknown