Jump to content

Caffeinenyx

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Posts posted by Caffeinenyx

  1. * still returns game* results. First name etc is unique to rounds. Also none of them have the same number of results as game except game. Why game* results. It should only be looking a 1 game ID, which has say 8 people and  entry ID's, hence 8 names.

  2. $PlayerQuery = "SELECT FirstName, SurName FROM players p, rounds m, entrants e, games t WHERE p.PlayerID = e.PlayerID AND m.GameID = '$ID' AND e.EntrantID = m.Player";
    	$PlayerResult = mysql_query($PlayerQuery);
    	$PlayerRow = mysql_num_rows($PlayerResult);
    

     

    Can someone suggest why this returns game*the number of results. For each new game it returns an extra duplicate result. For example for 2 games:

    j Smith

    j Smith

    t John

    t John etc

     

    There are no duplicate entry's! and results should be unique.  Not in a loop (positive)

  3. I have a list of ID's returned from a table (even number). I always used a loop to get the next result, but I want to put these straight into a new table

     

    INSERT INTO table VALUES ($ID1, $ID2);

     

    This is recursive till there are no more ID's. How do I get the result then the next result without loops. ID1 and ID2 cannot be null. What is the best way?

  4. I know im being blind today but can someone point out why:

    $query = "SELECT peopleID FROM numpeople WHERE ID = '3';";
    $result = mysql_query($query)
    or die("failed.");
    $row = mysql_fetch_row($result);
    $numpeople = mysql_num_rows($result);
    echo "<br /> row $row[1]";
    echo "<br />numpeople $numpeople";	
    

     

    $numpeople returns 2, but $row[1] is undefined? $row[0] is fine. (The value of  $row[0] is 7 and  $row[1] should be 8).

     

    This is the second error that I really cant see....

  5. $entrantQuery = "SELECT entrantID FROM entrants WHERE Game = $idT";
    $entrantResult = mysql_query(entrantQuery);
    $entrantRow = mysql_fetch_row(entrantResult);
    

     

    I have these at the start of my php (after getting $idT), but I get the error

    Notice: Use of undefined constant entrantQuery - assumed 'entrantQuery' in C:\Entrants.php on line ..

     

    Notice: Use of undefined constant entrantResult - assumed 'entrantResult' in C:\www\Entrants.php on line..

     

    Ive used this code lots of times before, what am I missing? They are variables that I am defining!

  6. I have forum options in a loop (ie value = Entry$i)

     

    I need to call GET_POST('Entry$i') and loop though the INSERT query $i times. If I put GET_POST in a loop, however, it does not work. It does not give an INSERT failed error so I assume it is not reading it. I have also tried putting if GET_POST('Entry1') outside the loop, but it does not like it. I dont know how many options are needed so I need it to generate the correct number. Then you can select $i options from duplicated option lists.  (Ie) participant 1,  2 and 3 from a list of possibles. 

     

    I have also use GET_POST, I use a function. Other sumbits (I not use what they are called, please set me know), work fine on this page.

     

    
    echo "Entry $Number: <select name = \"Entry$j\">";
    
    for ($i = 1; $i<$EntNum+1; $i++)
    { etc etc
    
    then 
    for ($i = 0; $i<$NumberOfEntrys; $i++) {
    if (isset($_POST['AddEntry']) && isset($_POST["Entry$i"]))
    
    //rest of this bit not executed -just insert
    

    Ideas? Thanks

  7. I dont think the above is explained very well, also If I could add ORDER BY to topic...

     

    echo "<Option value = \"$i\">$PersonRows[0] $PersonRows[1] and $Person2Rows[0] $Person2Rows[1] </Option>";

     

    I need to iterate though the results of $PersonRows[0] $PersonRows[1] and $Person2Rows[0] $Person2Rows[1]  for each $i

     

    At the moment I get

    Andy Smith
    Andy Smith
    Andy Smith
    

     

     

    But I need

     

    Andy Smith
    Tim Carbrook
    Tom Steptoe
    

     

    etc,

     

    Also I have

     

    $Choicequery ="SELECT PersonA, PersonB FROM modules WHERE GroupID = '$UpdateNumber'"; or
    $Choicequery ="SELECT PersonA, PersonB,StartDate FROM modules WHERE GroupID = '$UpdateNumber'";
    

     

    But if I add ORDER BY StartDate, it returns nothing? I really need them ordered....

     

     

     

    Any ideas?, thanks

  8. 
    for ($i = 1; $i<$rows+1; $i++)
    {
    	$Choicequery ="SELECT PersonA, PersonB FROM modules WHERE GroupID = '$UpdateNumber'";
    	$Choiceresult = mysql_query($Choicequery);
    	$ChoiceRows = mysql_fetch_array($Choiceresult);
    
    	$PersonQuery = "SELECT FirstName, LastName FROM Persons p, modules m, users e, group t WHERE m.modID = $ChoiceRows[0] AND e.UserID = m.PersonA AND p.PersonID = e.PersonID";
    	$PersonResult = mysql_query($PersonQuery);
    	$PersonRows = mysql_fetch_array($PersonResult);
    
    	$Person2Query = "SELECT FirstName, LastName FROM Persons p, modules m, users e, group t WHERE m.modID = $ChoiceRows[0] AND e.UserID = m.PersonB AND p.PersonID = e.PersonID";
    	$Person2Result = mysql_query($Person2Query);
    	$Person2Rows = mysql_fetch_array($Person2Result);
    
    	echo "<Option value = \"$i\">$PersonRows[0] $PersonRows[1] and $Person2Rows[0] $Person2Rows[1] </Option>";
    }
    
    

     

    How do I get it to show the next result when $i increases? All the options are the first people A and B $i number of times. Not sure how to use a loop here to go though the results. Whats the best way?

     

    ie $PersonRows[0] $PersonRows[1] are the same for every option

  9. SELECT oneID FROM table WHERE table.PersonID = game.PlayerA

     

    returns unknown column game.PlayerA

     

    but it does exist.

     

    Not a blank page, just this value missing, but it may have been the double quotes. Im fairly new to php and have never used table.anything (its a good idea)

  10. Hiya,

     

    I have set up apache, php5 etc on my computers before, but since I upgraded to 11.04 I get a blank screen when running any PHP file.

     

    I have used these PHP files before, so the code is not incorrect. I have check that all packages are installed correctly and restarted apache. This is on two ubuntu computers.

     

    I normally use firefox.

     

    apache2 php5-mysql libapache2-mod-php5 mysql-server

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