Jump to content

Payback451

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Payback451's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I feel very stupid for not realizing that.. especially when my querys containing the field name 'desc' (for description) didnt work.. cmon.. I use DESC and ASC all the time.. shoulda known. Anyway, thank you very much!
  2. I've spent quite a bit of time looking at this for the problem, and i'm completely stumped. $Messages = mysql_query("SELECT * FROM pm WHERE to = $UserInfo[id]") or die(mysql_error()); while($Message = mysql_fetch_array($Messages)) { [display code- no problems here] } Produces the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'to = 1' at line 1 $UserInfo[id] is properly set to the number 1. There are 3 entries in the table pm that should be selected. Why is this producing an error? This has also happened in several other places in my script.. and the code is fine as far as I and my other coder friends can see. Was there some major update to the way mysql and php interact that would cause this to give a sytnax error? Because i have never experienced anything like this in the past. Also, to save you all time, i've tried putting the $UserInfo[id] in quotes, tried using mysql_fetch_row, tried changing the variable name, tried selecting specific fields instead of *, tried renaming the table, and some more. Thanks very much for your help.
  3. [!--quoteo(post=367606:date=Apr 23 2006, 12:01 AM:name=mb81)--][div class=\'quotetop\']QUOTE(mb81 @ Apr 23 2006, 12:01 AM) [snapback]367606[/snapback][/div][div class=\'quotemain\'][!--quotec--] Change the mysql_fetch_array() to mysql_fetch_assoc() or mysql_fetch_row() [/quote] You are officially my hero, and i'm officially hating myself for spending hours looking over that code and it being such a simple mistake. Cheers, Andrew
  4. Alright, i've spent wayyy to much time figuring this one out and nothing has been solved yet. I'm creating a simple database that tracks when people were certified for various skills, and depending on how old the certification is the cell's background color changes. [code]         $Water = mysql_query("SELECT blowout,boat_ent,contact_res,crew_pick,resc_board,swim_tend,swim,self_resc,tether_swim,victim_stab,wading FROM c_water WHERE id = $Person[id]");         $Water = mysql_fetch_array($Water);         foreach($Water as $i) {                $Now = time();             $Lapsed = $Now - $i;             if($i == 0) { // if no date is entered, run me                 $Temp = "<td bgcolor=\"#FF0000\">test</td>";             }                elseif($Lapsed <= 31535999) { //white                 $Temp = "<td bgcolor=\"#FFFFFF\">" . date('m/d/Y', $i) . "</td>";             }                             elseif($Lapsed <= 63071999) { //green                 $Temp = "<td bgcolor=\"#00DD00\">" . date('m/d/Y', $i) . "</td>";             }             elseif($Lapsed <= 94607999) { //yellow                 $Temp = "<td bgcolor=\"#FFFF00\">" . date('m/d/Y', $i) . "</td>";             }             elseif($Lapsed >= 94607999) { //red                 $Temp = "<td bgcolor=\"#FF0000\">" . date('m/d/Y', $i) . "</td>";             }             echo $Temp;         } [/code] The script works as it should. It goes through each value in the array that it got from the database, checks how old it is, changes it to a readable format, and displays it. That stuff works fine. The part that doesnt work fine is that for whatever elseif conditional is chosen, it runs twice. For example, if the date is old enough to be considered 'yellow' (as commented in the code) then that string is echo'd twice. If it's red, that goes twice. I've linked a screenshot of the output so you can get an idea of what i'm talking about: [a href=\"http://img20.imageshack.us/img20/6197/ugh5gy.jpg\" target=\"_blank\"]http://img20.imageshack.us/img20/6197/ugh5gy.jpg[/a] As you can see, all the colors and dates are in blocks of two. I hope i've explained this well enough for you, now what am I doing wrong? Why are the strings being displayed twice? I beg for your help! :)
×
×
  • 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.