Jump to content

jrodd32

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by jrodd32

  1. I think that you would have to run it once for each reserved name
  2. strpos(string haystack, string needle) it will return the position of the needle within the haystack. For example: $string1=strpos("The cat sat on the mat", "cat"); would return 4 so once you know where in the string the data is that you don't want to display you could simply create a for loop that would print the % character you were using.
  3. couldn't you use the strpos() function and search for your reserved words and then replace them with the % character
  4. function init_officials($sport) {   if (!($db = @mysql_connect('localhost', 'username','password')))   {;     print 'Temporarily unable to connect to database server. Please try again later.';     exit;   }   mysql_select_db('Scoreboard',$db);   global $officials;   $officials=mysql_fetch_array(mysql_query("SELECT officials_complete.* FROM officials_complete where CURRENT=\"TRUE\""));   global $officialslist;   $officialslist=mysql_query("IF $sport1==\"T\") THEN SELECT lname, fname, address, city, st, zip, zip4, homephone, workphone, email FROM officials_complete WHERE CURRENT=\"TRUE\" ORDER by lname");   print mysql_error(); } Originally the $sport will come in as a variable within the database that I have assigned through a drop down list of options. EX.) BA or BK or FB This is to allow me to be able to sort the officials by which sports they are qualified to work.  In the database the variables BA or BK etc. are strings which are 50 places long. If the last place in the string is a 'T' then the official is cleared to work. When, I echo $sport, after the mysql_query of the database it still returns as BA,etc. Thus, when I try: $sport1=substr($sport,49,1); and echo $sport1; I get BA9. There is not a single 9 within the database. What does this mean?
  5. in php if my code was: substr(\"T\",49,1); would that return a logical value T or F if the letter T was in the 49th position of the string with the one representing the number of values you want printed. If so, is the syntax in mysql the same?
  6. Does the same type of syntax apply for the mysql substring function because I need that to check to make sure the official is update with his/her test scores and thus making them eligible to work games. However, in another function that does not have the substr call I still get the same error even after fixing the comma.
  7. I used the mysql_error function and it gave me this error: You have an error in your SQL syntax near 'WHERE CURRENT="TRUE" and SW=substr("T",49,1) order by lname' at line 1 However, it will print all the fields that I am selecting and starts the list with the appropriate name. The variable names are all correct spelling and in the correct cases of upper and lower case to match the database. Here is the line of code: $officialslist=mysql_query("SELECT lname, fname, address, city, st, zip, zip4 homephone, workphone, email WHERE CURRENT=\"TRUE\" and $sport=substr(\"T\",49,1) order by lname");
  8. I thought the global aspect of the variable would take care of needing to have it defined everywhere. If not, what do I need to put within the function to make the program recognize that it is the same variable as earlier.
  9. I used an exact copy of the following code with different variable names in another program and it works fine, however, once i changed the variable names it gives me the error: Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/httpd/vhosts/khsaa.org/subdomains/admin/httpdocs/jerrod/officials/tool_kit_officials.inc on line 141 <?php   $sport;   $officialtype="All Current Officials/Referees/Umpires";   init_officials_all();   printpage_officials($sport,$officialtype,$officials,$officialslist); ?> function init_officials_all() {    if (!($db = @mysql_connect('localhost', 'username','password')))    {;      print 'Temporarily unable to connect to database server. Please try again later.';      exit;    }    mysql_select_db('Scoreboard',$db);    global $officials;    $officials=mysql_fetch_array(mysql_query("SELECT officials_complete.* FROM officials_complete where CURRENT=\"TRUE\""));    global $officialslist;    $officialslist=mysql_query("SELECT lname, fname, suffix, address, city, state, zip, zip4, homephone, workphone, email WHERE CURRENT=\"TRUE\" order by lname"); } the error occors at this loop: while($officials=mysql_fetch_array($officialslist))   {       printf('%-60s ',$officials[lname]);       printf('%-20s ',$officials[address]);       printf('%-20s ',$officials[city]);       printf( '%-7s ',$officials[state]);       printf('%-12s ',$officials[zip.$sp.zip4]);       printf('%-20s ',$officials[homephone]);       printf('%-20s ',$officials[workphone]);       printf('%-30s ',$officials[email]);       print('<br>');   }
  10. I think i used your way to make it work.  I fixed the other problem.  Thanks for the help, you and everyone else
  11. It will display the list now but this error: Parse error: parse error, unexpected $ in /home/httpd/vhosts/khsaa.org/subdomains/admin/httpdocs/jerrod/tool_kit.inc on line 170 now shows.  I have checked my brackets and <php ?> tags and unless I missed something they line up. The error is weird because it is the last line in my file and the only code on it is: ?>
  12. [code]<?php function printpage($type,$email,$coach,$coachtype); {   print'<HTML>';   print'<HEAD>';   print'<FONT FACE='Arial'>';   print'<Basefont size=2>';   print'<META NAME='Kentucky High School Athletic Association (KHSAA)'CONTENT='Sports High School KHSAA Kentucky High School Athletic Association'>';   echo"<TITLE>KHSAA Current List of $coachtype Coaches</TITLE>';   print'</HEAD>';   print'<BODY>';   print'<Body Background=' ' BGColor=#FFFFFF Text=#000000 Link=#0000FF VLink=#800080 ALink=#FF0000>';   print'<p><br>';   print'</p><table border='0' cellpadding='0' cellspacing='0' width='60%' bgcolor='#FFFFFF'>';   print'<tr>';   print'<td width='50%' align='center'>';   print'<p align='center'>';   print'<a href='http://www.khsaa.org/'>';   print'<img src='http://www.khsaa.org/images/khslogo2.gif' border='0'></a></td>';   print'<td width='50%' align='center'>';   print'<p align='center'>';   print'<a href='http://www.khsaa.org/FTR/banners/clickthru_img.php3'>';   print'<img src='http://www.khsaa.org//FTR/banners/banner_img.php3' border='0'></a></td>';   print'</tr>';   print'</table>';   print'<outpad,'<br>';   echo"<br><b>KHSAA Current Master List of $coachtype as of ';     print date('l F jS Y h:i A');   print'</b>';   print'<BR>';   print'<FONT FACE='Courier'>';   print'<Basefont size=2></p>';   print'<PRE>';   printf("%-25s ","Head Coach");         printf("%-30s ","School");         printf("%-20s ","City");         printf("%-20s ","Phone Number");         printf("%-20s ","Fax Number");         printf("%-50s <br><hr>","Coach E-mail");   while($coaches=mysql_fetch_array($coachlist))     {       printf("%-25s ",$coaches[$coach]);       printf("%-30s ",$coaches[school]);       printf("%-20s ",$coaches[city]);       printf("%-20s ",$coaches[phone]);       printf("%-20s ",$coaches[faxphone]);       printf("%-50s ",$coaches[$email]);       print("<br>");     }     print("<hr>");     echo 'Copyright &copy; 2001-2006 Kentucky High School Athletic Association (KHSAA), all rights reservered<br>     This page is for the exclusive use of the KHSAA. Other use is strictly prohibited. Usage is monitored</font>';   print'</PRE>';   print'</html>'; } ?> [/code]
  13. you might want to try saving the select_catagories.php file as an .inc file and changing your include statements as necessary
  14. line 16: print"<td width="30%" valign="top" align="left" style="padding-left:2" height="32">"; I don't understand why I getting this message
×
×
  • 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.