On Fri, April 28, 2006 10:26 am, sathyashrayan wrote:
>   I am a self thought php beginner. I wrote my first toy
> code for database connection in php/mysql. The connection
> is successful but iam getting a warning and my rows/columns
> are not showing. I am getting a warning:
>
> Warning:  mysqli_fetch_row() expects parameter 1 to be mysqli_result,
> boolean given in c:\webs\test\dbs\one.php on line 13
>
> I went through the php manual for the above mentioned function where
> I get no clue. Pls guide me.
>
> code:
>
> <html>
>   <head>
>      <title> my first data base page </title>
>   </head>
>  <body>
>    <pre>
>  <?php
>     $conn = mysqli_connect("localhost","root","passwd","temp")
>             or die("conn failed");
>     $temp1 = "select *from grape_varity";

Put a space after the * in that query.

>     $result = mysqli_query($conn,$temp);

Add this:
or die("query failed " . mysqli_error($conn))

to the end of the line, just like you did for the mysqli_connect() above.

>     while($row=mysqli_fetch_row($result))

$result is PROBABLY 'false' (which is a boolean value) and that's
PROBABLY because having the * right next to 'from' in the query is
invalid.

But the mysqli_error() function will TELL you what is wrong, instead
of me guessing, and it will be a good habit, since it will tell you
want is wrong if you make mistakes in the future.

>     {
>       for($i =0;$i < mysqli_num_fields($result);$i++)
>         echo $row[i]." ";
>         echo "\n";
>     }
>
>      mysqli_close($conn);
>
>  ?>
> </pre>
> </body>
> </html>
>
> [OT]
> And one more thing is if I want to replay to a msg in this mail list
> do I have to hit replay button or replay-all button for posting
> in the mail list. I use "microsoft outlook 2000"

You need Reply-All to hit all of us...

Well, probably.  You never know with Microsoft products...

You SHOULD be able to tell by looking at the "To: " fields after you
hit the buttons.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to