Re: What am I doing wrong? [beginner]
| From: | Michael Sweeney | Date: | Fri, 19 Jul 2002 15:50:23 +0000 |
| Subject: | Re: What am I doing wrong? [beginner] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108534@lists.php.net to get a copy of this message | ||
Martin,
I'm assuming that you are calling a mysql_connect somewhere in your code
ahead of what you've posted. The error message you're getting indicates
that the query is not returning a result set. That could be because you
need quotes around the values in your where statement:
mysql_query("SELECT name, x FROM controllpoints_tbl WHERE ".
"process_nr='$process_nr' AND type='$typevar' ORDER BY
x");
Assuming a valid connection handle, that should work.
..mike..
On Fri, 2002-07-19 at 08:20, Martin Johansson wrote:
> AHHHHHRGGG this is getting me on my nerves!!!##!!
>
> I am using a mySQL-databasetable called controllpoints_tbl with the
> following structure:
>
> +----+------------+-----------+-----+------+-----+--------------------------
> ---------------------------+
> | nr | process_nr | type | abb | name | x | description
> |
> +----+------------+-----------+-----+------+-----+--------------------------
> ---------------------------+
> | 1 | 1 | Milestone | MS | MS1 | 200 | bla bla bla
> |
> | 2 | 1 | Milestone | MS | MS2 | 500 | bla bla bla
> |
> | 3 | 1 | Tollgate | TG | TG1 | 100 | bla bla
> bla |
> | 4 | 1 | Milestone | MS | MS4 | 600 | bla bla bla
> |
> +----+------------+-----------+-----+------+-----+--------------------------
> ---------------------------+
>
> I want to view just the "name" and "x" variable with this code...
>
> for ($i=1;$i<=$antal_typer;$i++)
> {
> $typvar = $type[$i]; // this is an array with types
> $here = 150+17*$i;
>
> echo "Hello";
>
> $result = mysql_query("select name,x FROM controllpoints_tbl where
> process_nr=$process_nr and type=$typvar order by x");
> while ($myrow = mysql_fetch_row($result)) // this is line
> 138...
> {
> // here's a lot of code..
> }
> }
>
> but it never enters the while loop.. and only print Hello one time although
> $antal_typer = 2;
> a warning message says:
> Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
> resource in c:\inetpub\wwwroot\devproc\beta\view.php on line 138
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php