PHP Code or MYSQL query?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blade_922
Forum Contributor
Posts: 132
Joined: Wed Jul 12, 2006 4:57 pm

PHP Code or MYSQL query?

Post by blade_922 »

Hi all,

Im a beginner with PHP code, but have written quite a few data entry scripts in my time. Its been a while so i will explain what im trying to do, and if someone could tell me the best way to go about writing the code. i will try write it and ask for someone to check for mistakes.

I have a mysql DB with a long(xxxx) list of games with there id and console they go with and so on. Now i have a large collection of single image per game in a folder. Instead of using the current CMS script to upload each individually i have already uploaded all the images. Now ALL the images are named in this format:

gameid-gamename-console.jpg

so for example

3434-Fifa 11-ps3.jpg

The game id and game name is exactly the same as its game id and game name in the database. Now out of the 9999 games there are say around 600 games already filled in. The url of the game is stored like this in the db:

images/uploads/ps3/3434-Fifa 11-ps3.jpg
images/uploads/xbox360/3434-Fifa 11-xbox360.jpg

Now that i have uploaded all the images, how would i go about entering all the url and names of the images into the "box" field?

I presume it would be a string put together by pulling information from the database for each row?
blade_922
Forum Contributor
Posts: 132
Joined: Wed Jul 12, 2006 4:57 pm

Re: PHP Code or MYSQL query?

Post by blade_922 »

Okay, got the list of games coming up in a list with their id and name and console.

Now im echoing the url first of the game. So need a bit of help. I have

Code: Select all

$id=$row['id'];
$name=$row['title'];
$console=$row['category'];

$boxart="$id-$name-$console.jpg";

echo $boxart;

And i get 0jpg coming up. I can output/echo $id $name $console individually, how do i get it to echo as a proper image name file?
blade_922
Forum Contributor
Posts: 132
Joined: Wed Jul 12, 2006 4:57 pm

Re: PHP Code or MYSQL query?

Post by blade_922 »

Okay worked it out.

BUT

when i echo image out as <img src"..."> SOME images show up and some dont even though the URL is spot on. Why is this?

Like

images/uploads/ds/1419-LEGO Indiana Jones The Original Adventures-ds.jpg

It wont show up
Post Reply