I'm trying to make a small map for a php game. It would consists of a 3 by 3 grid, with the name of the location in each grid cell. The players location would be the center cell, and the surrounding cells would shw the players surrounding areas. I've created a table, with the x and y location and name for each cell. I then try to find the row for the grid cell when I am drawing it. Here is the code for that bit:

$object1 = mysql_fetch_row("FIND * FROM map WHERE x = '$x1' AND y = '$y1'");

I have more code, but it is basically that repeated for each cell. But when I view the page I get this message:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /var/www/virtual/staggy11.byethost3.com/htdocs/map.php on line 24

Line 24 is the line I posted above. The message is repeated for each cell. Can anyone show me what it is wrong?

    The argument to the function should be the query result resource, not the query itself. Look at the example code for mysql_fetch_row().

      Nevermind. I've just realised that
      a). I hadnt done what you had suggested, and
      b). I'd sai 'FIND' instead of 'SELECT'.

      Thanks !

        Write a Reply...