Jump to content

rotour

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by rotour

  1. Ah, I went back after trying what you suggested and found an error earlier in my code. Thanks for your help!
  2. $full_notes = $latest_note.$notes; $result = mysql_query("UPDATE whosay SET latest_note='$latest_note', notes='$full_notes' WHERE id='$id'"); if ($result){ // If successful, return to detail page with update notice header ("Location: ".$httppath."editclient.php?wid=".$wid."&update=ok"); By "not working," I mean that the $latest_note is not being added to the $notes. But my main question is, is this even the right way of doing this, or is there a cleaner command or something I can use to merely insert a variable into another variable in a database, but adding that variable to the beginning rather than replacing the entire value. Thanks for your help!
  3. Hi, I have two variables: $latest_note and $notes. Whenever I update $latest_note, I also want this (and today's date) to be added to $notes, such that $notes becomes a sort of archive of all of the latest notes, listed by date. I tried creating a third variable called $full_notes and saying $full_notes = $latest_note.$notes; ... then when I run my mysql update, I set notes='$full_notes' but it's not working properly. Is there a way to simply add one variable to the beginning of another in the db directly, concatenating the two? Thanks!
  4. One further question: if I wanted to drop a bgd color into the <td> based on its contents, like so that if ws_status below was in a different colored table cells for values 1, 2 and 3--how would I do that? echo'<td width=\"150\">'.$row[ws_name].'</td><td>'; echo isset($lookup[$row['ws_status']]) ? $lookup[$row['ws_status']] : ''; echo'</td><td>'.$row[ws_id].'</td>'; Maybe the $row function isn't the best method of doing what I'm trying to do. I'm not tied to it if there's a better way. Thanks again!
  5. Thanks so much, PFM--that did the trick. I did have to change one thing, though, which I thought I should mention here. For some reason, when I posted exactly what you posted, the <td> and </td> preceding and following the isset function did not render at all. I put the <td> in the echo line before and the </td> in the echo line after and it worked like a charm. Here's the snippet: echo'<td width=\"150\">'.$row[ws_name].'</td><td>'; echo isset($lookup[$row['ws_status']]) ? $lookup[$row['ws_status']] : ''; echo'</td><td>'.$row[ws_id].'</td>'; Just out of curiosity, any idea why this happened? In any case, thanks again for the solution, and all for chiming in and sparing me a good deal of frustration.
  6. By the way, does your solution still work if it's in a while loop? Is that what's breaking things?
  7. Thanks so much for the reply--but for some reason it's incorrectly operating as if the value is always 3, which I'm sure it isn't, as I have other tables pulling in the same data, displaying that value correctly. Here's how I've implemented it below (the variable I'm using it on is ws_status): while($row = mysql_fetch_array($rs)) { echo '<tr>'; echo'<td width=\"150\">'.$row[ws_name].'</td>'; echo '<td>'; echo $row['ws_status'] == 1 ? 'one' : $row['ws_status'] == 2 ? 'two' : $row['ws_status'] == 3 ? 'three' :''; echo'</td>'; echo'<td>'.$row[ws_id].'</td>'; echo'<td>'.$row[ws_acct_mgr].'</td>'; echo'<td>'.$row[second_acct_mgr].'</td>'; echo'<td>'.number_format($row[fb_start]).'</td>'; echo'<td>'.number_format($row[tw_start]).'</td>'; echo'<td>'.number_format($row[ms_start]).'</td>'; echo'<td>'.number_format($row[yt_start]).'</td>'; echo'<td>'.number_format($row[web_start]).'</td>'; echo'<td>'.$row[agent].'</td>'; echo'<td>'.$row[ws_mobile_type].'</td>'; echo'<td>'.$row[carrier].'</td>'; echo'<td>'.$row[phone_model].'</td>'; echo'</tr>'; } Any ideas? Thank you again!
  8. Hi, I'm using the following code: <td>$row[color]</td> and the possible values for this field are 1, 2 and 3. But I want the return to be red for 1, blue for 2, and green for 3. How do I write it so that instead of getting a row of 1's, 2's and 3's, I change those numbers to their corresponding colors? Thanks!
×
×
  • 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.