xyn Posted November 15, 2006 Share Posted November 15, 2006 Hey,I've got a small problem, which i'm confused myself over...and i wanted to count the amount of IMAGES havebeen stoed for someones bio...basically I have the structure, but the way i have done it iswhen they upload an image they can upload a max of 3 imagespremium gets 5... but i make this limit using mysql_num_rowschecking if they have 3 rows etc..So i have 3 images in my table and now it's time to display eachimage in my table (i've got this sorted) but my problem is withwhether i should use, AN ARRAY or MYSQL_RESULT();IF i use an array. how would I extract my images?OR if i use mysql_result($result, $row, 'field');how could i get this to work correctly?My sql table is set-out as;- id <Uploaded ID- user <User uploaded this img- image_name < Image Name- time < Time uploaded... Link to comment https://forums.phpfreaks.com/topic/27370-help-mysql_result-arrays/ Share on other sites More sharing options...
craygo Posted November 15, 2006 Share Posted November 15, 2006 Where are the images stored??The images are in teh tables as the exact name of the file??here is something quick[code]<?php$user = $_POST['username']; //Or however you are getting the username or userid$sql = "SELECT * FROM tablename WHERE user = '$user'"; $res = mysql_query($res) or die (mysql_error()); while($r = mysql_fetch_assoc($res)){ echo "<img src=\"/path/to/pictures/".$r['image_name']." width=xxx height=xxx\"><br>\n";}?>[/code]Ray Link to comment https://forums.phpfreaks.com/topic/27370-help-mysql_result-arrays/#findComment-125163 Share on other sites More sharing options...
xyn Posted November 15, 2006 Author Share Posted November 15, 2006 yeh but tha's the problem... If i use that method the images will be confused ie:id image_name user date0 img1.gif abc 00/00/001 img2.gif abc 00/00/002 img3.gif abc 00/00/00which means using your method which is what i needed anARRAY or Mysql_result for to organise these images. becausei will get them by id Link to comment https://forums.phpfreaks.com/topic/27370-help-mysql_result-arrays/#findComment-125201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.