Re: Beginner's php/mysql connection probs
| From: | John Nichel | Date: | Fri, 28 Apr 2006 16:44:10 +0000 |
| Subject: | Re: Beginner's php/mysql connection probs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235022@lists.php.net to get a copy of this message | ||
sathyashrayan wrote:
-----Original Message----- From: John Nichel [mailto:john@kegworks.com] Sent: Friday, April 28, 2006 9:11 PM To: Php-General Subject: Re: [PHP] Beginner's php/mysql connection probs sathyashrayan wrote:You assigned your query to the variable $temp1, but pass $temp to mysqli_query() -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.comDear group, (I am a very beginner so please bear with me for a simple question) 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>Your query is failing. I'm guessing that it's because you don't have a space between '*' and 'from' Better if you check to make sure the query was successful before trying to get the data.... if ( ! $result = mysqli_query ( $conn, $temp ) ) { echo ( mysqli_error ( $conn ) ); } else { while ( $row = mysqli_fetch_row ( $result ) ) { /// more code Thanks for the quick help. I changed the code as you sugested and get "Query was empty" as the result of the line echo (mysqli_error($conn)). So does that mean the table is empty? But I did filled the table with some value and mysql query displays the tables.<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"; $result = mysqli_query($conn,$temp);