Jump to content

BigTime

Members
  • Posts

    60
  • Joined

  • Last visited

Posts posted by BigTime

  1. thanks Gizmola

     

    Ive got an order by now in there which is my wall of text Im trying to get away from.

     

    Its the second part of your response Im looking for guidance in - the loop and checking. 

     

    Can you point me to something that may help guide me, or provide an example?

  2. all data resides in the same table, but 2 records for each week will have the same gameid

     

    so awayteam reports scores and hometeam reports scores for the same gameid

     

    I then want to view that data kind of in a per gameid table so I see them together.  I have to compare their reports and if they match accept them - if they dont I auto email them with a notification of a conflict in scores reported.

     

    hope that helps clarify.

     

    right now Im just ordering by certain columns and its a giant wall of text table, and Id like to make it easier on the eyes to see the matching gameids together - if one has not reported then I only see one record, but if both have reported I can easily see a table with 2 record rows.

     

    thanks again.

  3. a simplified version of the structure is:

    ID (unique)

    gameid (records match on this)

    hometeam

    awayteam

    homescore

    awayscore

    week

    status (turns to 1 when data is accepted by admin and therefore eliminated from query results)

     

     

    My current query is:

    SELECT * FROM table WHERE week='$week' AND status='0'

     

    $week is passed via post

     

    Thanks for the help, MasterACE14

     

  4. I have a table that has pairs of matching records that are identified as matching on a specific column.  In other words, 2 users submit data on the same record, and they are identified as matching and belonging to the same record data because the table column gameid is the same for the pair.

     

    How can I output the information for the pair of matching records for each of these into a table repeating it until Ive looped through all records?

     

    In other words I want to create 1 table with headers for each matching pair all the way down...

     

    thanks in advance.

  5. Hi Shawn, thank you.

     

    The entire purpose of the foreach loop is to create a unique entry for each record.  If I move it out of the loop, then how do I get a new and unique entry for each record?

     

    I was hoping there was a way to reset/clear the function make_seed() declared value at the top or bottom of the loop

     

    am I going about this the wrong way?

  6. Id do it in a foreach loop

     

        
    # setup SQL statement
        $SQL = " SELECT DISTINCT year from table ORDER by year ASC ";
        # execute SQL statement
        $retyear = mysql_db_query($db, $SQL, $conn);
    # check for errors
        if (!$retyears) { echo( mysql_error()); }
    
    else {
    	 while ($data=mysql_fetch_array($retyears)){
    	 $years=$data[year];
    
    	 $yeararray = array($year);
    
    	 foreach ($yeararray as $key => $y)
    
    		{
    
    # setup SQL statement
        $SQL = " SELECT all my call stuff ";
    
    # execute SQL statement
        $getclassstuff = mysql_db_query($db, $SQL, $conn);
    
        # check for errors
        if (!$getclassstuff ) { echo( mysql_error()); }
    else {
    
    # check for records
    $total = mysql_num_rows($getclassstuff );
    if ($total >= 1) {
        echo ("<font face=arial size=3 color=#e0e0e0><b>$y</b><BR>");
    echo ("<TABLE cellpadding=2 border=1 width=99% style=\"border-collapse: collapse; border: solid; border:1px;\"><tr><td>TABLE COLUMN HEADER</td><td>TABLE COLUMN HEADER</td><td>TABLE COLUMN HEADER</td><td>TABLE COLUMN HEADER</td></tr>"); etc....
    
    	while ($row = mysql_fetch_array($getclassstuff )) {
    	$year = $row["year"];
    	DECLARE MY OTHER VALUES HERE
    
    
    
    echo ("td>$TABLE COLUMN DATA ROW</td><td>$TABLE COLUMN DATA ROW</td><td>$TABLE COLUMN DATA ROW</td><td>$TABLE COLUMN DATA ROW</td></tr>");
    }?></Table>
    

  7. Im trying to assign and update table rows with a random 9 character string but am receiving the error : Fatal error: Cannot redeclare make_seed() (previously declared in ...

     

    How can I clear/reset the value before the next loop :confused:

     

    else {
    	 		while ($data=mysql_fetch_array($users)){
    	 		$user=$data[user];
    
    	 		$usersarray = array($users);
    
    	 			foreach ($usersarray as $key => $u){
    				//clear pass
    				$token = "";
    				srand();
    
    				//generate new password
    				$password_length = 9;
    
    				function make_seed() {
      					list($usec, $sec) = explode(' ', microtime());
      					return (float) $sec + ((float) $usec * 100000);
    				}
    
    				srand(make_seed());
    
    				$alfa = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM!@#$%^&*(){}[]";
    
    				for($i = 0; $i < $password_length; $i ++) {
      					$token .= $alfa[rand(0, strlen($alfa))];
    					}    
    
    				// insert password
    				// setup SQL statement  
    	   			$SQL = " UPDATE data SET pass='$token' WHERE user='$m1' ";
            			
            		// execute SQL statement
        	    		$makeit = mysql_db_query($userdb,"$SQL",$usercid);
    
            		// check for error
        	    			if (!$makeit) { echo("ERROR: " . mysql_error() . "\n$SQL\n");
    					} 

  8. hmm I think this is because it is not recognizing the period in the strings, because while I can post mth I can not post mAth and there is a .a extension in the list. 

     

    So I guess I need help to insist it includes the dot before the extension.

     

    Is this possible?

  9. Im wanting to not allow people to post any links in the comments section of a form (spammers) and have created a comma delimited list of essentially of every known domain name extension.

     

    To apply the filter I have the following code:

     

    $WordAllowed = true;
    	$BannedWords = explode(",", ReadDB($Options["ban_words"]));
    	if (count($BannedWords)>0) {
    	  $checkComment = strtolower($_REQUEST["comment"]);
    	  for($i=0;$i<count($BannedWords);$i++){
    		  $banWord = trim($BannedWords[$i]);
    		  if (trim($BannedWords[$i])<>'') {
    			  if(preg_match("/".$banWord."/i", $checkComment)){ 
    				  $WordAllowed = false;
    				  break;
    			  }
    		  }
    	  }
    	}
    	if($WordAllowed==false) {
    		 $SysMessage =  $OptionsLang["Banned_word_used"]; 
    	} else { Insert into my table

     

     

    I could have sworn this was working last time I was in this code but recently checking it again it is blocking pretty much everything claiming a banned word is used.  The only thing I can get to post is 'lol'.  Trying funny phrases like: first! or Great information, thanks, this is a test of the comment section, etc....they all get flagged  :'(

     

    Can anyone with fresh eyes assist?  Im weary and frustrated and its been forever since I wrapped my head around this. 

     

    My banned word list:

    www,http,com,org,.aero,.asia,.biz,.com,.coop,.edu,.gov,.info,.int,.jobs,.mil,.mobi,.museum,.name,.net,.org,
    .pro,.tel,.travel,.xxx,.a,.bitnet,.ac,.ad,.ae,.af,.ag,.ai,.al,.am,.an,.ao,.aq,.ar,.as,.at,.au,.aw,.az,.ba,.bb,.bd,.be,.bf,.bg
    ,.bh,.bi,.bj,.bm,.bn,.bo,.br,.bs,.bt,.bv,.bw,.by,.bz,.ca,.cc,.cf,.cg,.ch,.ci,.ck,.cl,.cm,.cn,.co,.com,.cr,.cs,.cu,.cv,.cx,.cy,.cz
    ,.de,.dj,.dk,.dm,.do,.dz,.ec,.edu,.ee,.eg,.eh,.er,.es,.et,.fi,.fj,.fk,.fm,.fo,.fr,.fx,.ga,.gb,.gd,.ge,.gf,.gh,.gi,.gl,.gm,.gn
    ,.gov,.gp,.gq,.gr,.gs,.gt,.gu,.gw,.gy,.hk,.hm,.hn,.hr,.ht,.hu,.id,.ie,.il,.in,.io,.iq,.ir,.is,.it,.jm,.jo,.jp,.ke,.kg,.kh,.ki,.km
    ,.kn,.kp,.kr,.kw,.ky,.kz,.la,.lb,.lc,.li,.lk,.lr,.ls,.lt,.lu,.lv,.ly,.ma,.mc,.md,.mg,.mh,.mil,.mk,.ml,.mm,.mn,.mo,.mp,.mq,.mr,
    .ms,.mt,.mu,.mv,.mw,.mx,.my,.mz,.na,.nc,.ne,.net,.nf,.ng,.ni,.nl,.no,.np,.nr,.nt,.nu,.nz,.om,.org,.pa,.pe,.pf,.pg,.ph,
    .pk,.pl,.pm,.pn,.pr,.pt,.pw,.py,.qa,.re,.ro,.ru,.rw,.sa,.sb,.sc,.sd,.se,.sg,.sh,.si,.sj,.sk,.sl,.sm,.sn,.so,.sr,.st,.su,.sv,
    .sy,.sz,.tc,.td,.tf,.tg,.th,.tj,.tk,.tm,.tn,.to,.tp,.tr,.tt,.tv,.tw,.tz,.ua,.ug,.uk,.um,.us,.uy,.uz,.va,.vc,.ve,.vg,.vi,.vn,.vu,.wf,
    .ws,.ye,.yt,.yu,.za,.zm,.zr,.zw

     

    Thanks in advance for any help :)

  10. Please don't double post BigTime...

     

     

    Uhhhh....huh?  Im not double posting!?!  WTF!  Just feel like throwing something spicy out there randomly?

     

    Sasa!

     

    thank you VERY much!  AND for the link to the SQL functions :P

  11. I need to order returned data by a certain column but not in a DEC or ASC order

     

    Is it possible to do this via an array?

     

    //the order you want to sort in an array 
    $sortArray = array(Heavyweight,Lightweight,Middleweight,Featherweight,Bantamweight); 
    //turn that array into a string for use in the query. 
    $sortString = implode(',', $sortArray); 
    

     

    How do I implement this array into the ORBER BY clause???  Is it possible?  If one of the entries in my array does not exist in the database will I get an error?

  12. Hello

     

    Im working on a random image display script, which is functioning perfectly, but I am stuck in how to exclude a certain file from the array.  If anyone could help I would greatly appreciate it!

     

    $img = null;
    
    $fileList = array();
    $handle = opendir($folder);
    while ( false !== ( $file = readdir($handle) ) ) {
    	$file_info = pathinfo($file);
    
    //CHECK FOR ALLOWED FILE EXTENTIONS
    if (
    	    isset( $extList[ strtolower( $file_info['extension'] ) ] )
    	) {
    		$fileList[] = $file;
    	}
    }
    closedir($handle);
    
    if (count($fileList) > 0) {
    	$imageNumber = time() % count($fileList);
    	$img = $folder.$fileList[$imageNumber];
    }

     

    How can I get the filelist array to exclude a certain file by name?

     

    Thank you in advance!!!

  13. Not sure how to do that? Do you have exact code?

     

    Where you are using die (error message)

     

    try using instead echo (error message)

     

    so:

    if (my condition is met) {

    echo (error messge) }

     

    else {

    //process my form

     

    ^^ was just an idea :P

     

    OR make it easy, let it go to a new page and within your error message provide a javascript -1 history back link and instruct the user to go back and try again...

     

    Here is an example of how I check a php form entry and throw an error which goes to a new page but provides a backlink (data entered on form is not lost):

        # this is processed when the form is submitted
        # back on to this page (POST METHOD)
        if ($REQUEST_METHOD=="POST") {
    
    if (my condition to be met)
    {
    
      echo ("ERROR!<BR>Your data has NOT been entered into the database:<BR>
      This is my text explaining why<a href=\"javascript:history.go(-1)\">GO BACK</a> and correct the problem");
      return false; } 
    
      else { 
    # setup SQL statement to insert data

  14. If I were writing it without defining the rows would look like:

     

     

    <SELECT name=menu>
    <script language="php">
    
    $SQL = " SELECT id, username FROM user ";
      
        # execute SQL statement
        $result = mysql_db_query($db, $SQL, $cid);
    
    
         if(mysql_num_rows($result)) {
           // we have at least one result, so show all users as options in select form
           while($row = mysql_fetch_row($result))
           {
              print"<option value=\"http://www.zerodefex.net/ccf/redo/pages/admin.php?user=true?UserID=$row[0]">$row[1]</option>");
           }
         } else {
           print("<option value=\"\">No Users Created Yet</option>");
         }
    </script>
    </select>
    

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