Jump to content

BigTime

Members
  • Posts

    60
  • Joined

  • Last visited

Posts posted by BigTime

  1. well for the first select box in particular you didnt define a row that equals ID or username

     

    i.e

    while($row = mysql_fetch_assoc($result))
    {
    $id=$row['id'];
    $username=$row['username'];

     

    you need to define them or call them instead by their row number i.e $row[0] $row[1]

     

    I didnt not look further past this assuming it is a common error throughout.

     

    Hope this helps!

     

     

  2. Hi everyone...

     

    What is the proper syntax to identify if a form field contains a certain character string using a wildcard?  Is this possible?

     

    Im essentially trying to throw an error if an entry field contains http://

     

    if ($_POST[map] like 'http:%'){

     

    except I get Parse error: syntax error, unexpected T_STRING on that line when I try it...

  3. Hi everyone!

     

    I have an issue where I am trying to create dynamic links on a page that are using a variable to populate that link.  However when that variable is pulled to use as part of that link it stops as soon as it encounters a space in the data.

     

    So simply the link looks like this:

     

    echo ("<td width=110><a href=http://www.mysite.net/ScheduleField.php?fieldname=$fieldname style=\"text-decoration: none\"><font face=arial size=1 color=#ffffff>$hometeam $homeconference</a></TD>\n");

     

    Fieldname out of the table would be a multi word something like 'North High School'

     

    However when trying to use that variable in a link, in real time it appears as:

    http://www.mysite.net/ScheduleField.php?fieldname=North

     

    It is essentially dropping everything after the first word.

     

    It DOES however print out the full data when I use the $fieldname variable in a table during my while loop, this link appears IN my while loop, it just doesnt produce the full text for the link part.

     

    The SQL (4.1.22-standard) db is set up on that field as text with no attributes and not null

     

    Can anyone guide me to how I might ensure the full text might be implemented?

     

    If I have not provided adequate information on the issue please let me know, and thanks in advance for any thoughts!

  4. Thanks Fenway....these boards used to be quite helpful with directives, now its all like generic canned spam.

    For anyone finding this in a search....this is what I have learned:

    JOINS are used for adding vertical colums...for instance having 2 vertical labeled colums from one table and then 5 other labeled columns from another table which would create a 7 columned table.

    UNIONS are used for adding horizontal rows...so this is what I was after rather than a JOIN.

    UNIONS need the fields aliased if you want to ORDER them....so here is my final query that worked:

    [code]$SQL = "SELECT time as t, league, week as w, hometeam, awayteam, month, date as d, division, fieldlink, fieldname as f, TIME_FORMAT(time, '%l.%i %p') AS newtime FROM pac10 WHERE fieldname LIKE '$fieldname%'
    UNION
    SELECT time as t, league, week as w, hometeam, awayteam, month, date as d, division, fieldlink, fieldname as f, TIME_FORMAT(time, '%l.%i %p') AS newtime FROM mac10 WHERE fieldname LIKE '$fieldname%'
    UNION
    SELECT time as t, league, week as w, hometeam, awayteam, month, date as d, division, fieldlink, fieldname as f, TIME_FORMAT(time, '%l.%i %p') AS newtime FROM big10 WHERE fieldname LIKE '$fieldname%'
    ORDER BY w ASC, d ASC, f ASC, t ASC"; [/code]

  5. Hi there.

    Having trouble with a join, which then goes into a loop.  Both tables have an identical structure.  Im trying to join everything, then spit out my normal loop with just the records across both tables that have a similar entry in fieldname.....then sort all those results, by day, and time...the loop just helps me seperate the records by week, with each week getting their own table....and Im passing the fieldname variable via the url ie mypage.php?fieldname=ThisField

    My problem is that they have the same column names, so I keep getting Column: 'time' in field list is ambiguous...Im unsure how to solve it as Im formating time when its coming out, but I need all the records to sort on that column across both tables.

    [code]<?
        # setup SQL statement
    $SQL = " SELECT time, league, week, hometeam, awayteam, month, date, division, id, fieldlink, fieldname, TIME_FORMAT(time, '%l.%i %p') AS newtime FROM pac10 JOIN mac10 ON ( pac10.fieldname = mac10.fieldname) WHERE fieldname LIKE '$fieldname%' ORDER BY week ASC, date ASC, fieldname ASC, time ASC";

        # execute SQL statement
        $retid = mysql_db_query($db, $SQL, $cid);

        # check for errors
        if (!$retid) { echo( mysql_error()); }

        else {
        $weektracker = 0;
    while ($row = mysql_fetch_array($retid)) {
    $league = $row["league"];
    $week = $row["week"];
    $hometeam = $row["hometeam"];
    $awayteam = $row["awayteam"];
    $month = $row["month"];
    $date = $row["date"];
    $newtime = $row["newtime"];
    $homescore = $row["homescore"];
    $awayscore = $row["awayscore"];
    $id = $row["id"];
    $division = $row["division"];
    $homeconference = $row["homeconference"];
    $awayconference = $row["awayconference"];
    $fieldlink = $row["fieldlink"];
    $fieldname = $row["fieldname"];

    #BEGINNING MY LOOP BY WEEK AND DATA OUTPUT

    {
      if($weektracker < $week)
      {
          if($weektracker > 0)
      echo ("</table><BR><BR>\n");

          echo ("<b><font face=arial size=2 color=#e0e0e0>WEEK $week</b></font>\n");
          echo ("<TABLE cellpadding=2 border=1 width=99% style=\"border-collapse: collapse; border: solid; border:1px;\">");
      echo ("<TR><TD><font face=arial size=1 color=#e0e0e0><b>LEAGUE</b></td><TD width=80><font face=arial size=1 color=#e0e0e0><b>DIVISION</b></TD><TD width=40><font face=arial size=1 color=#e0e0e0><B>DATE</B></TD><td width=60><font face=arial size=1 color=#e0e0e0><b>TIME</b></TD><td><font face=arial size=1 color=#e0e0e0><B>AWAY</B></TD><td><font face=arial size=1 color=#e0e0e0><b>HOME</b></td><TD><font face=arial size=1 color=#e0e0e0><b><center>FIELD</center></b></TD></TR>");
          $weektracker = $week;
        }


                echo ("<TR>");
                echo ("<TD><font face=arial size=1 color=#e0e0e0>$league</font></td><td><font face=arial size=1 color=#e0e0e0>$division</td><td><font face=arial size=1 color=#e0e0e0>$month - $date</td><td><font face=arial size=1 color=#e0e0e0>$newtime</TD><TD><font face=arial size=1 color=#e0e0e0>$awayteam</td><td><font face=arial size=1 color=#e0e0e0>$hometeam</td><td><a href=\"http://$fieldlink\" target=_blank><font face=arial size=1 color=#e0e0e0>$fieldname</td>\n");
    echo ("</TR>");
      }}

            echo ("</TABLE><BR>");



    }

       

    ?>[/code]

    thanks in advance for any insight :)

  6. A long time ago someone on these boards helped me with a similar situation.  I had a mass of records and I wanted to order them by week, with each week having their own table, and a little header at the top of the table identifying the week number....tried to dig it up, but it looks like it was trimmed or lost in the boards transitions.

    You can see what the display is like by visiting [url=http://www.tcyfl.net/Pac10Schedules.php?division=Bantam]http://www.tcyfl.net/Pac10Schedules.php?division=Bantam[/url] I'll provide the crude code example then maybe you can run with it  ;D

    I guess the important part of that for me was setting up an additional field in my table that held a single numeral for the week number, you'll have to have something similar to work off of, or maybe someone much smarter than me can help you transform this into a weekday name thing - like if day=sunday then $daynumber =1 on your insert commands...I dunno....

    [code]    # setup SQL statement
    $SQL = " SELECT fields FROM mytable ";

        # execute SQL statement
        $retid = mysql_db_query($db, $SQL, $cid);

        # check for errors
        if (!$retid) { echo( mysql_error()); }

        else {
        $weektracker = 0;
    while ($row = mysql_fetch_array($retid)) {
    $league = $row["league"];
    $week = $row["week"];
    $hometeam = $row["hometeam"];
    $awayteam = $row["awayteam"];
    $month = $row["month"];
    $date = $row["date"];
    $newtime = $row["newtime"];
    $homescore = $row["homescore"];
    $awayscore = $row["awayscore"];
    $id = $row["id"];
    $division = $row["division"];
    $homeconference = $row["homeconference"];
    $awayconference = $row["awayconference"];
    $fieldlink = $row["fieldlink"];
    $fieldname = $row["fieldname"];



    {
      if($weektracker < $week)
      {
          if($weektracker > 0)
      echo ("</table><BR><BR>\n");

          echo ("<b><font face=arial size=2 color=#e0e0e0>WEEK $week</b></font>\n");
          echo ("<TABLE cellpadding=2 border=1 width=99% style=\"border-collapse: collapse; border: solid; border:1px;\">");
     
          #These are my table columns labels 
          echo ("<TR><TD width=80><font face=arial size=1 color=#e0e0e0><b>DIVISION</b></TD><TD width=40><font face=arial size=1 color=#e0e0e0><B>DATE</B></TD><td width=60><font face=arial size=1 color=#e0e0e0><b>TIME</b></TD><td><font face=arial size=1 color=#e0e0e0><B>AWAY</B></TD><td><font face=arial size=1 color=#e0e0e0><b>HOME</b></td><TD><font face=arial size=1 color=#e0e0e0><b><center>FIELD</center></b></TD></TR>");
          $weektracker = $week;
        }

    #these are the cell populations with some if/thens i dont feel like editing out :)
                echo ("<TR>");
                echo ("<TD><font face=arial size=1 color=#e0e0e0>$division</td><td><font face=arial size=1 color=#e0e0e0>$month - $date</td><td><font face=arial size=1 color=#e0e0e0>$newtime</TD>\n");

    if ($awayscore < $homescore){
    echo ("<td><font face=arial size=1 color=#747e8e>$awayteam</TD>\n");
    }

    else{
    echo ("<td width=110><font face=arial size=1 color=#ffffff>$awayteam</TD>\n");
    }

    if ($awayscore > $homescore){
    echo ("<TD><font face=arial size=1 color=#747e8e>$hometeam</TD>\n");
    }

    else{
    echo ("<td width=110><font face=arial size=1 color=#ffffff>$hometeam</TD>\n");
    }

    echo ("<td><a href=\"http://$fieldlink\" target=_blank><font face=arial size=1 color=#e0e0e0>$fieldname</td>\n");
                echo ("</TR>");
      }}

            echo ("</TABLE><BR>");



    }

       
    [/code]

    Hope this helps you some

×
×
  • 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.