Caffeinenyx
-
Posts
22 -
Joined
-
Last visited
Never
Posts posted by Caffeinenyx
-
-
$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)
-
Blank screen. Also I have test using older files I use fine on windows and ubuntu 10.10 before I updated to 11.04. Nothing will run, so I assume it is not a parse error.
-
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?
-
loops, sorry i am very over tried, I cant believe the mistakes I have made this evening. Thanks.
-
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 .
This is the second error that I really cant see....
-
Sorry, been coding for days to finish this - I think im going a bit insane! Im sure they had $ before.... The universe removed them!
Thanks anyway for sorting my stupidity.
-
No im not, its a weird font but they all start with $?
$entrantQuery etc
-
$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!
-
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
-
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
-
I have got it now, i did need to define them as well, Thanks everyone!
-
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
-
Unknown column 'table.PersonID' in 'on clause'
?? It is correct i can view the table
-
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)
-
no errors
-
yes, although the names are not the same as the ones im using, but as this is part of an assignment I remained the tables to post here. Player A is a column name in game.
-
nothing
-
$query ="SELECT oneID FROM table WHERE table.PersonID = 'game.PlayerA'" ; $result = mysql_query($query); $row = mysql_fetch_array($result); $oneID = $row[0]; [code] If I then echo "$oneID" why does it not print anything? $result echos resource7
-
Chromium browser has this:
The website encountered an error while retrieving http://localhost/admin.php. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this web page later.
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request.
-
-
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
Query duplicate results
in PHP Coding Help
Posted
* 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.