First, the while loop doesn't have brackets.
Second, why are you doing two queries?
Basically
$getres = mysql_query(mysql_query("SELECT * FROM ******")) or die ("i hate you");I'd get rid of the line
$getres = mysql_query($resultf)
or die ("i hate you");Then you also need to set $thenum when you go to update.
$thenum = $row["idra"];<?php
@extract($_POST);
include("************");
$raquote = urldecode($raquote);
$rawho = urldecode($rawho);
$radate = date("M/j Y");
$thenum = '1';
$aquote = "INSERT INTO rquotes (idra, raquote, rawho, radate, howmany) VALUES
('', '$raquote', '$rawho', '$radate', '$howmany')";
$qresult = mysql_query($aquote)
or die ("The random quote wont go in");
?><?PHP
$getres = mysql_query(mysql_query("SELECT * FROM rquotes")) or die ("i hate you");
$howmany1 = $row["howmany"];
echo $howmany1;
$addafnnum = "1";
$realadd = $howmany1 + 1;
$justtheup = "UPDATE rquotes SET howmany='$realadd' WHERE idra='$thenum'";
$resultmn = mysql_query($justtheup)
or die ("update broke");
?>
The Add Was Completed Click Here
To Return Or Click Here To Go To The Admin
Index
All I get on it now is I hate you
What I wrote was that you can't do double queries like that. Here's what it should look like (maybe):
$resultf = mysql_query("SELECT * FROM ******") or die ("i hate you");
while($row = mysql_fetch_array($resultf)) {
$howmany1 = $row["howmany"];
$realadd = $howmany1 + 1;
$thenum = $row['idra'];
$justtheup = "UPDATE rquotes SET howmany='$realadd' WHERE idra='$thenum'";
$resultmn = mysql_query($justtheup) or die ("update broke");
}I'm not sure exactly what you are trying to do, is this supposed to be a single row query or looped through a bunch of rows?
You could also do
$resultf = mysql_query("SELECT * FROM ******") or die ("i hate you");
while($row = mysql_fetch_array($resultf)) {
$thenum = $row['idra'];
$justtheup = "UPDATE rquotes SET howmany=howmany+1 WHERE idra='$thenum'";
$resultmn = mysql_query($justtheup) or die ("update broke");
}That worked,
though I do remember I was able to do this once,
cause I need to get this script to pull how many numbers are in idra 1 to see how many colums are in which there are 3 lines of different quotes
and it pulls that fine
the next part of the script takes how many lines and makes a random selection which it does that just fine
I know you said I shouldnt try to make 2 querys in one script though I really belive I did this once before
I swear that I cant see whats wrong with it
but I'm sure youll have it
Once I get some steady time to keep playing with it I'll get it
<?PHP
include("*********");
$rad = "1";
$resultf = mysql_query("SELECT * FROM rquotes WHERE idra='$rad' ") or die ("i hate you");while($row = mysql_fetch_array($resultf)) {
$howmany1 = $row["howmany"];
$therannum = rand(1, $howmany1);
}
?>
<?PHP$resultf2 = mysql_query("SELECT * FROM rquotes WHERE idra='$therannum' ") or die
("yousuck");
while($row = mysql_fetch_array($resultf2)) {
$quote1 = $row["raquote"];
$quote2 = $row["rawho"];
$quote3 = $row["radate"];echo $quote1;
}echo $quote1;
?>
I can't figure out what im doing here I'll show you the code then I'll explain what the problem is
I see I hate you
I had it good I'm just trying to get it to add a simple number and not sure what I got wrong