englishcodemonkey Posted June 21, 2008 Share Posted June 21, 2008 Ok so I’m now using MySQL 5.0 and I have now managed to connect to the MySQL database. I have trouble-shooted two errors and now the page is showing but it is blank http://www.wadeandgattonnurseries.com/hosta_new.html is the URL. Once you click the ‘submit my information’ button it should show the information that is pulled from the database. The code for this page is displayed below: <?php require_once('conn.php'); $hosta= $_REQUEST['name']; $hosta1= $_REQUEST['name']; $q = "SELECT hybridizer, size, price, description from hostajess where hosta_name='$hosta'"; $r = @mysqli_query ($magic, $q); if ($r) { echo '<table align="center" cellspacing="3" cellpadding="3" width="75%"> <tr><td align="left" width="33.3%"><b>Hybridizer</b></td><td align="left" width="33.3%"><b>Size</b></td><td align="left" ><b>Price</b></td></tr>'; while ($row = mysqli_fetch_array($r,MYSQLI_ASSOC)) { echo '<tr><td align="left">' .$row['hybridizer'] . '</td><td align="left">' .$row['size'] . '</td><td align="left">' .$row['price']. '</td></tr>'; } } echo '</table>'; $q = "SELECT description from hostajess where hosta_name='$hosta1'"; $r = @mysqli_query ($magic, $q); if ($r) { echo '<table align="center" cellspacing="3" cellpadding="3" width="75%"> <tr><td align="left"><b>Description</b></td></tr>'; while ($row = mysqli_fetch_array($r,MYSQLI_ASSOC)) { echo '<tr><td align="justify">' .$row['description'] . '</tr>'; } } echo '</table>'; mysqli_close($dbc); ?> Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted June 21, 2008 Share Posted June 21, 2008 You probably have a syntax error...I'm guessing in conn.php, as the code you have posted seems fine...it would help if you cleaned up your code: <?php require_once('conn.php'); $hosta = $_REQUEST['name']; $hosta1 = $_REQUEST['name']; $q = "SELECT hybridizer, size, price, description from hostajess where hosta_name='$hosta'"; $r = @mysqli_query ($magic, $q) or die(mysqli_error()); if ($r) { echo ' <table align="center" cellspacing="3" cellpadding="3" width="75%"> <tr> <td align="left" width="33.3%">Hybridizer</td> <td align="left" width="33.3%">Size</td> <td align="left" >Price</td> </tr>'; while ($row = mysqli_fetch_array($r,MYSQLI_ASSOC)) { echo ' <tr> <td align="left">' .$row['hybridizer'] . '</td> <td align="left">' .$row['size'] . '</td> <td align="left">' .$row['price']. '</td> </tr>'; } } echo '</table>'; $q = "SELECT description from hostajess where hosta_name='$hosta1'"; $r = mysqli_query ($magic, $q) or die(mysqli_query()); if ($r) { echo ' <table align="center" cellspacing="3" cellpadding="3" width="75%"> <tr> <td align="left">Description</td> </tr>'; while ($row = mysqli_fetch_array($r,MYSQLI_ASSOC)) { echo ' <tr> <td align="justify">' .$row['description'] . '</td> </tr>'; } } echo '</table>'; mysqli_close($dbc); ?> Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted June 21, 2008 Share Posted June 21, 2008 I agree with hitman, post the conn.php and there will likely be an error there Quote Link to comment Share on other sites More sharing options...
englishcodemonkey Posted June 21, 2008 Author Share Posted June 21, 2008 Ok this is the code from the conn.php file, as far as I know this part was working. I am still having problems though. Thanks. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $dbc = mysqli_connect ('p50mysql187.secureserver.net', 'hostajess', '***'); $magic = mysqli_select_db($dbc, 'hostajess'); ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.