Jump to content

seandon01

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling
  • Location
    San Francisco

seandon01's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ~n[EO]n~, can you explain this please.. I often run into trouble when relating two tables together and returning data.. Thanks in advance
  2. Thank you for taking the time to help me.. i really appreciate it.. I'll give this a shot and post the results.. Thanks again!!!!!!!!!
  3. [!--quoteo(post=385202:date=Jun 17 2006, 07:20 PM:name=Fyorl)--][div class=\'quotetop\']QUOTE(Fyorl @ Jun 17 2006, 07:20 PM) [snapback]385202[/snapback][/div][div class=\'quotemain\'][!--quotec--] Files can be accessed using the $_FILES variable. All you need to do is check whether $_FILES['artistimage'] exists or not and if it does, upload the file (I assume that's what you want or you wouldn't use the 'file' type) and add it to the update query. I don't think file info can be accessed with $_POST which was probably what was givin you the headache. [/quote] Thats exactly what i am having trouble with.. checking if only the artistimage file is set, then adding that to the update query, checking if only the mp3_file is set and adding that to the query, and checking if both are set and adding that to the query.. i would think to use IF statements to do this.. but im having trouble with the syntax.. (as you can tell im failry new with php)
  4. [!--quoteo(post=385198:date=Jun 17 2006, 07:09 PM:name=Fyorl)--][div class=\'quotetop\']QUOTE(Fyorl @ Jun 17 2006, 07:09 PM) [snapback]385198[/snapback][/div][div class=\'quotemain\'][!--quotec--] The short answer is: don't. But I'll explain. Basically, if you have filled out the data already with the values currently in the database. Then when you run an UPDATE query on all the form data, only the ones that the user actually changed will be updated, the rest will stay the same because they weren't changed and so are just exactly what the database had already. [/quote] Thanks for the quick reply... what you said makes perfect sense, but if you notice there are two file fields in my form, those are not auto populated with the current file, so therefore when updating, it enters 0 value doesnt it? Thanks again.. this forum is amazing
  5. i am creating a section that allows the user to add / delete / modify records in the database.. so far ive worked out the add and delete pages, but the modify page is giving me nothing but trouble. so the modify page has a form with fields that are populated with the current data by the record chosen (this works fine). what i dont know how to do is - suppose that they only want to modify the text field, and not change any of the files, how to only insert that data, or if they only want to update one of the files, or both of the files.. I hope this makes sense.. Thank you so much in advance.. any advice is helpful. [code] <? $modify_artist=mysql_query("SELECT * FROM artists WHERE id = $_GET[artist_id]");    $modify_results = mysql_fetch_array($modify_artist); ?> <form action="action_modify.php" method="post" enctype="multipart/form-data" name="modify_record" id="modify_record"> <input name="action" type="hidden" value="modify" /> <input name="artist_id" type="hidden" value="<? echo $modify_results[id]; ?>" />   <p>     Artist Name     <input name="artistname" type="text" id="artistname" value="<? echo $modify_results[artist_name]; ?>" /> </p>   <p>Artist Bio </p>   <p>     <textarea name="artistbio" cols="50" rows="10" id="artistbio"><? echo $modify_results[artist_bio]; ?> </textarea>   </p>   <p>     Artist Image     <input name="artistimage" type="file" id="artistimage" />   </p>   <p>     Track Name     <input name="trackname" type="text" id="trackname" value="<? echo $modify_results[track_name] ?>" />     Track File (mp3 format)     <input name="mp3_file" type="file" id="mp3_file" />   </p>   <p>Burn Lounge Link     <input name="burnlink" type="text" id="burnlink" value="<? echo $modify_results[burn_link]; ?>" />   </p>   <p>     Official Site Link     <input name="officiallink" type="text" id="officiallink" value="<? echo $modify_results[official_link]; ?>" />   </p>   <p>     Myspace Link     <input name="myspacelink" type="text" id="myspacelink" value="<? echo $modify_results[official_link]; ?>" />   </p>   <p>     <input type="submit" name="Submit" value="Submit" />   </p> </form> Current Image: <br /> <? echo "<img src=\"../../images/artists/$modify_results[artist_image].jpg\">"; ?>[/code]
  6. [!--quoteo(post=383701:date=Jun 14 2006, 03:06 AM:name=sanfly)--][div class=\'quotetop\']QUOTE(sanfly @ Jun 14 2006, 03:06 AM) [snapback]383701[/snapback][/div][div class=\'quotemain\'][!--quotec--] So are you wanting to loop through the results of the first query as well? If so, try this: [code]<?    $chptrfile_query = mysql_query("SELECT DISTINCT file_name,chapter_id FROM video_file WHERE listing_id=1");         while($myresults = mysql_fetch_assoc($chptrfile_query)){             $chptrtitle_query = mysql_query("SELECT DISTINCT chapter_title,id FROM chapters WHERE id=$myresults[chapter_id]");             while($myresults2 = mysql_fetch_array($chptrtitle_query)){                 echo  $myresults['file_name'];                  echo "<br>";                 echo $myresults2['chapter_title'];                 echo "<br>";             }         }    ?>[/code] [/quote] JACKPOT!!!!!! WOW.. I CANNOT THANK YOU ENOUGH!!!! THANK YOU THANK YOU THANK YOU!!!! As you can tell i am fairly new with php and sql, didnt even think to my 2nd select statement inside of a loop.. Didnt even know that it was possible actually.. Thanks again...
  7. [!--quoteo(post=383696:date=Jun 14 2006, 02:50 AM:name=sanfly)--][div class=\'quotetop\']QUOTE(sanfly @ Jun 14 2006, 02:50 AM) [snapback]383696[/snapback][/div][div class=\'quotemain\'][!--quotec--] Try this. How many results does it say are returned? [code]<?    $chptrfile_query = mysql_query("SELECT DISTINCT file_name,chapter_id FROM video_file WHERE listing_id=1");         $myresults = mysql_fetch_assoc($chptrfile_query);                        $chptrtitle_query = mysql_query("SELECT DISTINCT chapter_title,id FROM chapters WHERE id=$myresults[chapter_id]");             $num = mysql_num_rows($chptrtitle_query);             echo "$num results returned<br><br>";             while($myresults2 = mysql_fetch_array($chptrtitle_query)){                 echo  $myresults['file_name'];                  echo "<br>";                 echo $myresults2['chapter_title'];                 echo "<br><br>";             }    ?>[/code] [/quote] It says 1 result returned
  8. thanks for the quick reply... unfortunately. that didnt do the trick. Returned the same results as the original code..
  9. The objective of this is to create a dynamic select list... My Current Code: [code]<? $chptrfile_query = mysql_query("SELECT DISTINCT file_name,chapter_id FROM video_file WHERE listing_id=1");               $myresults = mysql_fetch_assoc($chptrfile_query);                              $chptrtitle_query = mysql_query("SELECT DISTINCT chapter_title,id FROM chapters WHERE id=$myresults[chapter_id]");             $myresults2 = mysql_fetch_assoc($chptrtitle_query);              echo  $myresults['file_name'];              echo "<br>";              echo $myresults2['chapter_title']; ?> [/code] This Returns: losfelizvillas (which i want to be the value of the select list) Full Trailer (which i want to be the display name of the select list) My issue is.. Looping through the results so all the results are in the select list rather then just the first.... I hope this make sense and that someone can guide me to my solution. Thank you so much in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.