5 Replies - 219 Views - Last Post: 04 July 2013 - 12:55 PM Rate Topic: -----

#1 an0x2k  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 04-July 13

Displaying images using php and mysql

Posted 04 July 2013 - 08:49 AM

Hey guys,

Im the new guy in town and i find myself very lucky to have stumbled upon this website. Basically i need help with displaying an imagine from mysql (eg if one of my users has to select a sword and has 3 to choose from) once he picks it i want it to save to the database and display the weapon of his choice when logged in.

Thanks for taking the time to read this.
Is This A Good Question/Topic? 0
  • +

Replies To: Displaying images using php and mysql

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9197
  • View blog
  • Posts: 34,551
  • Joined: 12-June 08

Re: Displaying images using php and mysql

Posted 04 July 2013 - 09:04 AM

Typically your images all have a unique name.. your database would store the path to the image(not the actual image itself)... so when you query for all the swords the return is an array of image locations you can build an 'img scr' tag around, right? When a user selects one then you just store that image name in the profile and bing-bango! You have your solution.
Was This Post Helpful? 3
  • +
  • -

#3 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4333
  • View blog
  • Posts: 12,128
  • Joined: 18-April 07

Re: Displaying images using php and mysql

Posted 04 July 2013 - 09:04 AM

Well when they pick the sword, store the URL of the image in the database for that particular user's account. This is advised over the idea of storing the image itself in the database. Databases are not that great at storing large graphic files. You also lose out on the option of searching for a file name etc. When the user then logs in, you can read the database for the URL of the sword image and display it right in a <img> tag on screen.

I hope you get the idea. :)
Was This Post Helpful? 2
  • +
  • -

#4 an0x2k  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 04-July 13

Re: Displaying images using php and mysql

Posted 04 July 2013 - 09:22 AM

Perfect, i understand now i just have one more question for now :) say i have a training page and i want to level up my sword mastery and display it via an exp bar that goes up and the exp goes up how would i go about doing that?

Thanks again.
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9197
  • View blog
  • Posts: 34,551
  • Joined: 12-June 08

Re: Displaying images using php and mysql

Posted 04 July 2013 - 09:32 AM

I am not sure if I follow - how do you display the sword, or how do you 'level up'?
Was This Post Helpful? 0
  • +
  • -

#6 an0x2k  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 04-July 13

Re: Displaying images using php and mysql

Posted 04 July 2013 - 12:55 PM

yeah sorry its kinda hard to explain but i will give it a bash: i will give you an example down below

Sword Training

Reactions ($120) <---------- [ show percentage bar here up to 100% ] ----------->
Increase your reactions by 1%

Speed ($120) <---------- [ show percentage bar here up to 100% ] ----------->
Increase your speed by 1%

Damage ($60) <---------- [ show percentage bar here up to 100% ] ----------->
Increase your damage by 1%

Every time someone trains each part the price goes up, hope this makes it clearer.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1