List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:August 28 1999 12:00am
Subject:Re: A little code help.
View as plain text  
At 6:38 PM -0500 8/27/99, Z Mehta wrote:
> Your second suggestion is the way I need to do it, but I think my syntax is
>wrong:
>
>$query = "SELECT Qno FROM queue
>WHERE status='raw' ORDER BY due_date ASC LIMIT 1";
>$result = "UPDATE queue SET Status='idle'
>WHERE Qno=mysql_query($query)";

In PHP, this would be something like this (untested!!!):

# issue the select statement
$query = "SELECT Qno FROM queue
WHERE status='raw' ORDER BY due_date ASC LIMIT 1";
$result = mysql_query($query) or die("select failed, yikes!");
# fetch the row
$row = mysql_fetch_row ($result) or die("hm, no qualifying rows, yikes!");
# at this point Qno is in $row[0]
$query = "UPDATE queue SET Status='idle' WHERE Qno=" . $row[0];
$result = mysql_query ($query) or die("update failed, yikes!");

You might need to add quotes or something about the value of $row[0]
if it's a string field...

--
Paul DuBois, paul@stripped
Northern League Chronicles: http://www.snake.net/nl/
Thread
A little code help.Z Mehta27 Aug
  • Re: A little code help.Micheal Mc Evoy28 Aug
  • Re: A little code help.Paul DuBois28 Aug
  • Re: A little code help.Z Mehta28 Aug
    • Re: A little code help.Paul DuBois28 Aug
    • Re: A little code help.Paul DuBois28 Aug
  • Re: A little code help.Z Mehta28 Aug