Jump to content

benjudy

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

benjudy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. In my Drupal 6 site, when I edit users, there is an option to "block the selected users" (or unblock). However, it doesn't do anything. I apply that option to a user, and it has no noticeable effect. Any idea why this might be? I actually don't think I'll need that feature on my site. So, how might I simply remove those options from the drop down? I'm thinking I need to probably modify a module or block or something like that, but I don't really have that down yet. I've read some things but it hasn't "clicked" and probably won't until I actually do it and see the results. Any help is GREATLY appreciated!
  2. Thanks, obsidian! You got me pointed in the right direction and I have solved the problem. Much appreciated!
  3. Hi, I'm a total newbie to the whole JOIN idea. Need some help with a simple one (I think) to get me started. Here are my two MYSQL tables: table name = designers columns = designer_id first_name last_name table name = projects columns = id project_name designer_id As you can see, the designers table just contains the individual's first name and last name, with a unique designer_id for each row. The projects table has a unique id, a project_name and a designer_id. The designer_id is an integer which should correspond to a row from the designer table. I'm having trouble coming up with a query that will select all projects assigned to an individual designer. Example: Let's say I want to return all projects assigned to a designer named Tom Smith. According to my (limited) understanding of JOIN, the following query should give me all of the projects assigned to Tom: SELECT * FROM projects JOIN designers ON (projects.designer_id = designers.desginer_id) WHERE designer.first_name='Tom' AND designer.last_name='Smith' But... it doesn't seem to work. Any idea what I'm doing wrong? Thanks!
  4. simcoweb, thanks for the reply! That is a great suggestion... unfortunately I don't have that capability. The HTML is entered into the db by users who submit content from a CMS. The CMS uses a WYSIWYG editor, so the data going into the db is HTML formatted. Nothing I can do about that unless I want to rebuild the entire CMS somehow.... (not really an option)
  5. revraz, Thanks for the reply. I have not used strip_tags before, thanks for pointing that out. But I don't think that will get me where I want to be. To be more precise, I only want all of the characters in between the first set of list item HTML tags. There may be more HTML code in there, such as <strong> tags and so forth -- I don't want to strip those out. So all I care about is what's in that first list item. I want to leave out all of the other code including all of the list items that follow. If I do strip_tags it seems to me there would then be no way to figure out where the text of the first list item ends, so I can lose the rest. This might clarify what I think I'm trying to do. Here's some pseudocode: $text = "<ul> <li>this is the first list item</li> <li>second list item</li> <li>and another list item</li> </ul>"; /*this is what I don't know how to do*/ $text_to_display = begin after (first instance of "<li>"), stop before (first instance of "</li>"); print("$text_to_display"); But I think a better way to do this might be with my sql SELECT statement, if possible.
  6. I have the following HTML code stored in a MYSQL table: <ul> <li>this is the first list item</li> <li>second list item</li> <li>and another list item</li> </ul> What I need to do is display only the text of the first list item: this is the first list item So I want to end up with just that string of text in a variable. I think this could be done one of two ways. 1) Write a fancy sql SELECT statement that would look for the HTML tags and only select what is between them. I think this would be nice because I would not be SELECTing more than I need from the db. Unfortunately I'm not too swift at writing fancy sql statements yet so I'm not even sure if this can be done. 2) Put the raw db contents into a variable, then use PHP to search for the <li> and </li> tags and place whatever's between them into another variable. I've looked into things like regular expressions and explode in PHP, but I'm just not getting it. I think there is an easy solution that is just beyond my reach. Any help would be appreciated!
  7. OK, another one from the newbie files... Searching this forum as well as Googling the Web didn't turn up the simple help I'm looking for. I've got MySQL fields named "started" and "ended". They are dates (data type "date"). I just want to detect whether the date is in the past, or if the date is today or a future date. I would think this would be easy but the answer has so far eluded me. Is it possible to do this in the sql query? Something like: $query_string = "SELECT * FROM $tablename WHERE ended='date in the past'; (Obviously 'date in the past' is my pseudocode for what I'm trying to do) Is it possible to write a WHERE condition that's smart enough to know past from present or future? Or must this be done in PHP? If so, how? I can provide full code if necessary, but this is very generic. I'm just looking for someone to point me in the right direction. Thanks!
  8. OK, extending this a bit... say I wanted an unique id on each table cell. So the output would look something like this: <tr> <td id="title-1">Tom Sayer</td> <td id="author-1">Mark Twain</td> <td id="started-1">Jan. 1, 2007</td> <td id="ended-1">Jan 20, 2007</td> </tr> <tr> <td id="title-2">Great Expectations</td> <td id="author-2">Charles Dickens</td> <td id="started-2">Feb. 5, 2007</td> <td id="ended-2">Feb. 8, 2007</td> </tr> ...and so on... Using the list method provided by kratsg, how can I do that? Are there numeric keys associated with each item in the list? I've played around with the key() function but all I get is errors. (By the way, the reason I need unique id's is so I can add some edit-in-place AJAX.) Thanks so much for your help!
  9. stuffradio, mjdamato, kratsg -- thank you so much! You're all awesome. With your help I got it working.
  10. Sorry -- this might be somewhat of a newbie question, so bear with me. (Then again, it should be easy to answer!) What can I say, I'm learning. I'm trying to dynamically build an HTML table from a flat text file. My text file consists of four lines: Tom Sayer Mark Twain Jan. 1, 2007 Jan 20, 2007 My HTML table has a header row that looks like this: <tr> <th>Title</th> <th>Author(s)</th> <th>Started</th> <th>Finished</th> </tr> So you can see that the data in the text file corresponds to these headers. (It's a book-reading journal). I found a code snippet which helped me pull data from the text file and echo it into table cells. Pretty straightforward. <tr> <? $text = file('reading.txt'); // loop through array and output contents foreach($text as $chunk) { echo "<td>" . $chunk . "</td>\n"; } ?> </tr> Works beautifully. Here comes the part I need help with. As you might guess, if I add another row of data to my text file, I want the HTML table to close the row and start a new one, so there are four columns in each row. So if my text file would look like this: Tom Sayer Mark Twain Jan. 1, 2007 Jan 20, 2007 Great Expectations Charles Dickens Feb. 5, 2007 Feb. 8, 2007 Currently, if I do this I just end up with eight table cells in the same row. What do I need to do in the PHP to tell it to start a new row after every fourth cell? Some sort of incrementing I guess...? Thanks!
  11. I just realized there's a simpler way for me to pose my question. I'd like to see if anyone can help me with this... I have an array with the following keys and values: submitid1 = 1 address1 = sample address1 city1 = sample city1 sqft1 = sample sq ft1 price1 = sample price1 submitid2 = 2 address2 = sample address2 city2 = sample address2 sqft2 = sample address2 price2 = sample address2 I have a MySQL db table named relo. It has five columns: id, address, city, sqft, price. How do I write a SQL UPDATE statement (dynamically, using PHP) that will update my db table with the data in my array?
  12. PHP / mysql n00b here, would be very appreciative of any help! I'm trying to update a simple MySQL table from an HTML form and I'm stuck. My db table is named [tt]relo[/tt]. It has five columns: [tt]id, address, city, sqft, price[/tt]. The column named [tt]id[/tt] is set to [tt]auto_increment[/tt]. I can figure out that if I submit the following query, it will update the first row in the db: [tt]$query="UPDATE relo SET address='someaddress', city='somecity', sqft='somesqft', price='someprice' WHERE id='1'";[/tt] But this doesn't quite get me where I need to be. What I want to do is allow the user to update my HTML form and hit a "submit" button, and [i]presto[/i] the db table is updated. The trick is, there could be any number of rows. So we are dealing with not just one row of data for these columns, but multiple rows. I think what I need help with is creating a dynamic UPDATE that will use the values that were posted by the HTML form submission. I created a dynamic HTML table and form that properly pulls in the data from the db table and puts it in the form textfields. So the user can edit the data in the textfields. I just can't figure out how to make the form submission update the db. Does anyone have any sample code or helpful ideas? Thanks!
  13. I have been wondering if it is possible or legal to use php (conditionals, for example) in an external .css file. I've been experimenting, but so far it doesn't seem to work. If it does work, can someone post a simple example? If it's not allowed, can someone link to a web page explaining why not? I'd appreciate links to any resources about this. I've been looking around the web but haven't found an answer. Thanks!
  14. I'm at my wit's end here... any help would be greatly appreciated! I'm building navigation tabs in a single-row <table>. Any given tab may have one, two, or three lines of text. Text must be in the middle vertically and horizontally centered. Here's the kicker: the entire inside area of the table cell must be clickable. In other words, the <a> has to fill the entire height and width of each cell -- regardless of how many lines of text. When I have one cell with three lines of text, and another cell with only one, I can't seem to get it working. I can either get the entire cell clickable, but the text aligned at the top. Or, I can get the text vertically in the middle, but the entire cell is not clickable. Frustrating. Before anyone says, "why not use a list?", I've already been down that road. Can't meet all of the above requirements using <li>'s, no matter how many CSS tricks I've thrown at it. So, I'm going with a table. Must work in FF and IE 5.5, 6 --- #tabs td{border:1px solid #000;font-size:3em;text-align:center;vertical-align:middle;} #tabs a{background-color:green;display:block;height:100%;text-decoration:none;} #tabs a:hover{background-color:yellow;} <div id="tabs"> <table> <tr> <td><a href="#">tab 1</a></td> <td><a href="#">tab 2<br/>line two</a></td> <td><a href="#">tab 3<br/>line two<br/>line three</a></td> </tr> </table> </div>
×
×
  • 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.