Jump to content

RickChase

Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

RickChase's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok, I got this figured out. Here is what my finished code looks like for anyone else who would like to do something similar... [php:1:c05af3bd96]<?php $db = mysql_connect(\"localhost\", \"\", \"\"); mysql_select_db(\"top_ten\",$db); $sql=\"SELECT * FROM rick\"; $result=mysql_query($sql,$db); $row = mysql_fetch_array($result); $one = $row[\"one\"]; $two = $row[\"two\"]; $three = $row[\"three\"]; echo \"<font face=Verdana,Arial,Helvetica size=2><form action=\"rick_top_ten_action.php\" method=\"post\">\"; echo \"<p><input type=text name=one maxlength=50 size=50 value=$one>\"; echo \"<p><input type=text name=two maxlength=50 size=50 value=$two>\"; echo \"<p><input type=text name=three maxlength=50 size=50 value=$three>\"; echo \"<p><br><input type=submit value=Update>\"; ?>[/php:1:c05af3bd96] I actually have ten instead of the three shown, and there is alot more to the html, but to simplify things I am only showing what is necessary for this to work for you. Thanks! Rick
  2. I have a simple form running that I am succesfully using UPDATE to update the info in the database, but in my form (on my web page) I would like to see what is currently there before I edit or update that info. I tried this... [php:1:6649a61417] <? $db = mysql_connect(\"localhost\", \"\", \"\"); mysql_select_db(\"top_ten\",$db); $sql = \"SELECT * FROM rick\"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); $one = $myrow[\"one\"]; ?> [/php:1:6649a61417] and then in my form, I just tried to assign the value of the input field using the info I just retrieved from the db... <input type=text name=one maxlength=50 size=50 value=\"<? $one ?>\" > Unfortunatelly, this did not work. Also I should point out that my form action is another php file that handles the UPDATE. And like I said, the UPDATE works great, I\'d just like to be able to see what\'s in there before I edit or update it. Thanks for looking, Rick
  3. I am using the code below to pull info from the db and display all albums released by this artist. Currently, it displays each release in a new <TD> which is great, but I would like to only show 5 <TD>\'s per row. If there are more than 5 releases, then create a new row for the next 5 and so on... I have been researching for 4 hours now and cannot figure it out. I have even looked at code from phpbb and oscommerce trying to get it and cannot. Any help is greatly appreciated. <? $color1 = "#151515"; $color2 = "#252525"; $row_count = 0; $db = mysql_connect("localhost", "", ""); mysql_select_db("relapse_releases",$db); $sql="SELECT * FROM entire_catalog WHERE artist=\'Amorphis\' ORDER BY release_date_us DESC"; $result=mysql_query($sql,$db); if(!mysql_num_rows($result)) { echo(" "); } else { $num = mysql_num_rows($result); $cur = 1; echo "<p><table border=0 cellpadding=2 cellspacing=0 width=80% class=table_border> <tr><td width=100%><table border=0 cellpadding=15 cellspacing=0 width=100% bgcolor=000000><tr>"; while ($num >= $cur) { $row = mysql_fetch_array($result); $artist = $row["artist"]; $title = $row["title"]; $release_date_us = $row["release_date_us"]; $catalog_number = $row["catalog_number"]; $cell_color = ($row_count % 2) ? $color1 : $color2; echo "<td valign=top width=125 bgcolor=$cell_color><center><a href="http://www.relapse.com/artists/".$catalog_number.".php"><img src="http://www.relapse.com/albumart/".$catalog_number."_85.gif" width=85 height=85 border=1><br><font class=artist><b>$artist</b></font><br><font class=title>"$title"</font></a></center></td>"; $cur++; $row_count++; } echo "</tr></table></td></tr></table>"; } ?> Thank you, Rick
  4. Update - I added a new field (artist_id) and if I use WHERE artist_id=1 then it works great (lists all releases by that artist). But I would much rather use the bands name than have to try and remember everyones number. Thanks again, Rick
  5. Hello, I have a record label and am setting up a database to hold all information relating to our releases. I have the following statement that works great (to list them by chronologically by release date): $sql="SELECT * FROM entire_catalog ORDER BY release_date_us"; Now, I want to just list releases by a certain artist (Dysrhythmia, in this case) and when I use this... $sql="SELECT * FROM entire_catalog WHERE artist=Dysrhythmia ORDER BY release_date_us"; I get the dreaded \"Warning: Supplied argument is not a valid MySQL result resource\" In my database, I have one table \"entire_catalog\" and in this table I have fields named \"artist\", \"title\", \"release_date_us\", \"release_date_eur\", etc... The \"artist\" field is setup as varchar(64) - why won\'t this work for me? In attempting to figure this out for myself, I changed the WHERE to pull only certain catalog numbers, and that worked great. But I cannot get it to pull only one artist by name. I have a feeling that it has something to do with the capitol \"D\" at the beginning of the name, but I need it to be there (in the \"artist\" field) so the name displays properly. Confused... Thank you for looking! Rick
×
×
  • 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.