Jump to content

satre

Members
  • Posts

    29
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

satre's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi All, I have a search page that I've created that looks for artists in my database based on the type of work they do. There are 3 columns: "style, medium, materials" that are created and ordered based on their popularity in my database. I put the count of the number of artists matching these attributes to the right of the radio buttons. I'm wondering if it is possible to update the numbers dynamically based on the choices made by the visitor. For example, If I click "representational" under the style column, of which there are currently 91 artists, is there a way to update the remaining radio buttons based on that choice? That is, change all the numbers to the right of the buttons to reflect how many artists (doing representational work) match the remaining radiobuttons. Some artists do both representational and conceptual work, so after clicking the representational button, the style column would have to keep that button clicked and update the numbers after "abstract" and "conceptual" as well as all the others under the "medium" and "materials" columns too. Then, as I click something under the "medium" column (painting for example), I would keep the buttons clicked and update all the other buttons displaying the number of artists remaining who do both "representational" and "painting" work, and so on... I'm sure it would involve a simple query to mysql to get the numbers, which is no problem, but how do I detect that a button has been clicked and then send the query to mysql and then refresh the page with all the new results? Here's the address for the testing page: http://www.nyartists...searchcount.php I like the radio button design because it lets you see all the possibilities at once. I would like to be able to see how my possiblilites are narrowed by my choices tho'. I'm OK with php and mysql, but I really suck with javascript and other languages, which is probably what I'm going to have to look into I think....?
  2. Hi Folks, I'm thinking this is simple, but just can't seem to figure it out. I use similar code for different tables that works fine, but for this table, it doesn't work so I'm thinking this is a MySQL issue. Here's the code: $sqlmeds = mysql_query("SELECT ALL value FROM test WHERE type like 'media:'"); $meds = mysql_fetch_array($sqlmeds); foreach ($meds as $med){ echo "$med"; } and here is the relevant area of the table with row names "type" and "value" type value . . . media: painting media: works on paper media: collage/assemblage . . . When I run the query to find all 3 values from within phpMyAdmin, no problem, all three are returned, but when I run the exact same query from php, I only get "painting" returned, and oddly, I get an array with two values in it, both of which are "painting". Any ideas??? Thanks!! p.s. I also tried this just in case instead of the foreach, but same result: for ($i=0; isset($meds[$i]); ++$i) { echo "$meds[$i]"; }
  3. Thanks, that's great, however, which command will get the path without me knowing it ahead of time? So sorry, I'm a bit rusty after a long hiatus.
  4. Seems this should be easy, but I'm not finding the solution. Functions like scandir, readdir, and glob that I've been looking at all seem to need me to actually know more about my directory path than I can ahead of time. Here's what I want to do: 1. expand a .tar file (consists of directory, subdirectories, files, and is variable) that I've uploaded to the server 2. look through that expanded directory for a subdirectory named ".pn" -- (note that all my .tar files will have this folder deep in several subdirectories that will be variable in number and have different names depending on the original .tar file) 3. copy the entire contents of the .pn folder to another folder already on my server The hosting company, no doubt, has likely blocked some of the functions I'll need as well, but if someone can point me in the right direction to start, it would be greatly appreciated. Thanks! Satre
  5. Arrgh! I just found it! Sorry for the trouble. You use this: %3F Does anyone know a reference where to find all the character codes for mailto links?
  6. Here's a toughy. Can't seem to find it. I'm trying to simply put a question mark at the end of a question I have in the body of an email generated from a mailto: link. Here's the code: $bodyheader = "Dear $coordinator, could you please forward to Mr. $director? Thanks!%0d ------------------------------------------------------------%0d %0d"; echo "<a href='mailto:$addressee&from=$myemail&subject=subject%20is%20$subject&body= $bodyheader Dear Mr. $director,%0d %0d So, works great except when there is a question mark (as above) in $bodyheader, it won't echo anything past that. If I put in a period (.) all is AOK. I had to use the "%0d" to make a carriage return, anybody know what to put in for a question mark? I already tried the html escape "&#63;" and that does not work. Thanks for your help! -Satre
  7. Oh, duh. My table name is actually "contacts". Works now. Thanks spfoonnewb!
  8. Hi, I hope someone can help me with this... I'm trying to get data from a table and work with it row by row. Here's a snippet of the code: $query = "SELECT program, nickname, city, state, director, directoremail, title, coordinator, coordinatoremail FROM contact"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { echo "Program :{$row['program']} <br>" . "{$row['city']}, {$row['state']} <br>" . "Nickname : {$row['nickname']} <br>" . "Director : Dr. {$row['message']} <br>" . "Coordinator : {$row['title']} {$row['message']} <br><br>"; $myemail = "me@myemail.com"; $director = $row['director']; $coordinatortitle = $row['title']; $coordinator = $row['coordinator']; $programnickname = $row['nickname']; $program = $row['program']; $directoremail = $row['directoremail']; $coordinatoremail = $row['coordinatoremail']; And here's the error I get: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content... on line 33 (the closing bracket for the while statement is further down in the code) Thanks for your help! -Satre
  9. actually, I mean, the value in the table is only a single value, not an array. Isn't there a way just to fetch the single value returned by the query? I used the above workaround because I couldn't find the command to fetch a single value and assign it to a variable.
  10. OK, I feel so dumb. I can't seem to find the answer on the forum or in the php manual. Is there a simple command that can replace fetching an array, can you just fetch the value somehow? $sql = mysql_query("SELECT value FROM settings WHERE name LIKE 'siteurl'"); $sqlfetch = mysql_fetch_array($sql); $rootlocation = $sqlfetch[0]; Thanks! Satre
  11. Here are a couple of nice tutorials. Be sure to read the improvements in the replies at the bottom. http://www.php-mysql-tutorial.com/wikis/php-tutorial/paging-using-php.aspx http://www.evolt.org/node/19340
  12. Yes! That works! Thank you so much! Best, Satre
  13. Hi, I need to have php generate some HTML code for me that needs to be formatted nicely so it can be read easily. Right now, it's just printing every statement without any line breaks so it's just all one big paragraph. The HTML works and looks fine in a browser, it's just hard to read the source code when you want to view the source code. Here's a sample of the relevant php: echo "<!-- BE SURE TO SELECT TAGS: "; if(isset($_POST['Tag_Tesla'])) { $Tag_Tesla = $_POST['Tag_Tesla']; } else { $Tag_Tesla = array(); } $i = 0; //first index while ($i < count($Tag_Tesla)) { echo "Magnet Strength = $Tag_Tesla[$i]"; ++$i; } if(isset($_POST['Tag_Op_System'])) { $Tag_Op_System = $_POST['Tag_Op_System']; } else { $Tag_Op_System = array(); } $i = 0; //first index while ($i < count($Tag_Op_System)) { echo "Operating System = $Tag_Op_System[$i]"; ++$i; } if(isset($_POST['Tag_Age_Class'])) { $Tag_Age_Class = $_POST['Tag_Age_Class']; } else { $Tag_Age_Class = array(); } $i = 0; //first index while ($i < count($Tag_Age_Class)) { echo "Age class = $Tag_Age_Class[$i]"; ++$i; } echo "-->"; echo "<br>"; echo "<!-- BE SURE TO SELECT CATEGORIES: "; if(isset($_POST['Category_MSK'])) { $Category_MSK = $_POST['Category_MSK']; } else { $Category_MSK = array(); } $i = 0; //first index while ($i < count($Category_MSK)) { echo "MSK = $Category_MSK[$i]"; ++$i; } echo "-->"; And here's the format of the HTML source code it gives me (note that it's all squashed together): <!-- BE SURE TO SELECT TAGS: Magnet Strength = 1.5Operating System = 15Age class = Adult--><br><!-- BE SURE TO SELECT CATEGORIES: MSK = shoulder--> I would like it to look like this: <!-- BE SURE TO SELECT TAGS: Magnet Strength = 1.5 Operating System = 15 Age class = Adult--> <!-- BE SURE TO SELECT CATEGORIES: MSK = shoulder--> Any ideas how to do this? Thanks! Satre
  14. OK, thanks! Your suggestion worked: if(isset ($_POST['icd9codes'])) { $icd9codes = $_POST['icd9codes']; echo nl2br("ICD9 Codes = $icd9codes <br />"); What if I wanted to take this variable and break it up into an array of just (words, number, words, number,...)? Would I use explode() for that? That might be easier to put into a table...
×
×
  • 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.