<?php if (isset($_REQUEST['submit'])) { echo "<p> hello</p>"; $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'shshsh11'; mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'Studentt'; mysql_select_db($dbname); $result = mysql_query("SELECT * FROM `allele`"); print $result; } else { ?> <html> <body> <form action="wcode.php" method=POST> <P><strong>Available Queries</strong><br> <INPUT TYPE="radio" NAME="Microsatellite Primers">Microsatellite Primers<br> <INPUT TYPE="radio" NAME="Maps">Maps for specified loci, possibly on a specified chromosome<br> <INPUT TYPE="radio" NAME="Common loci">Loci in common between two maps<br> <INPUT TYPE="radio" NAME="Loci">Loci on more than 4 maps<br> <P><P><P><input name=submit type=submit value=submit> </form> </body> </html> <?php } ?> it gives following result hello Resource id #3 what is Resource id #3 how do we solve it? please help
you can't just print query object, you must loop it with for example mysql_fetch_assoc or mysql_fetch_obect...
$result = mysql_query("SELECT * FROM `allele`"); $row=mysql_fetch_array($result); print_r($row); //print array echo $row['table field name']; // print field data
You must loop through the rows, you could this this with: Replace: print $result; PHP: With while($row=mysql_fetch_row($result)) { echo $row[0]; } PHP: Also I think you just posted your php/mysql password .... might want to remove that
Don't think that's really necessary as he has 1 post at the site and doesn't mention any external urls?