On Mon, 22 Sep 2003 13:06:37 +0200 "Ignatius Reilly" <ignatius.reilly@free.fr> wrote: > read the PHP manual and examples under the function > mysql_fetch_array(). > > I find the MySQL manual is very well done and helpful. I've been using > it as a reference for 2 years. Take a harder look! > I think Ignatius meant the PHP manual... It is rather terse, but the functions have been categorised to make it easier to find. See code alteration below. George Patterson > Ignatius > > > Hi gang > > -snipped-- > > > > I tried this: > > > > $num2edit = $_POST['edit']; > > $link = mysql_connect($host,$username,$password) > > or die('Could not connect : '.mysql_error()); > > mysql_select_db($database) or die('Could not select database'); > > > > $query = "SELECT > > countryNum,country,nw,gov,strat,spy,troops,jets,turrets,tanks,ally, > > owner FROM a2a WHERE countryNum=$num2edit"; > > $result = mysql_query($query); > > > > $countryNum = mysql_result($result,1,'countryNum'); > > $country = mysql_result($result,1,'country'); > > $nw = mysql_result($result,1,'nw'); > > $gov = mysql_result($result,1,'gov'); > > $strat = mysql_result($result,1,'strat'); > > $spy = mysql_result($result,1,'spy'); > > $troops = mysql_result($result,1,'troops'); > > $jets = mysql_result($result,1,'jets'); > > $turrets = mysql_result($result,1,'turrets'); > > $tanks = mysql_result($result,1,'tanks'); > > $ally = mysql_result($result,1,'ally'); > > $owner = mysql_result($result,1,'owner'); > > > > /* Free resultset */ > > mysql_free_result($result); > > /* Closing connection */ > > mysql_close($link); > > > > But all it gives me are errors like this: > > > > Warning: mysql_result(): supplied argument is not a valid MySQL > > result resource in E:\web\mpe\a2aedit.php on line 350 > > Warning: mysql_result(): supplied argument is not a valid MySQL Duplicate error message delete... > > > > Obviously, the first mysql_result line is line 350 in the full code. > > I've also tried changing the row number to 0, but results in the > > same errors. > > This ain't microsoft anymore... $num2edit = $_POST['edit']; $link = mysql_connect($host,$username,$password) or die('Could not connect : '.mysql_error()); mysql_select_db($database) or die('Could not select database'); $query = "SELECT countryNum, country, nw, gov, strat, spy, troops, jets, turrets, tanks, ally, owner FROM a2a WHERE countryNum=$num2edit"; echo "This is for test only: Print Query-> $query<br>\n"; $result = mysql_query($query); $row=mysql_fetch_assoc($result); #$row is an array. #display the row retrived from the database. For you information only. echo "<pre>\n"; print_r($row); echo "</pre>\n"; $countryNum = $row['countryNum']; $country = $row['country']; $nw = $row['nw']; #then close the database connection... As you had it... > > I can't find any decent reference on the web that shows how to do > > this - field extraction - when there's only the single record. So > > I've been mixing code from various places. And I don't even know if > > it retrieves the right record, or any record at all (how do I test > > that?). > > > > Any help is highly appreciated :) > > > > TIA > > > > Rene > > -- > > Rene Brehmer > > aka Metalbunny > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php