Mysql data into html doc

I have a form that sends an email to us from our company website and also posts the form information into a mysql table. I am now needing to pull that information out of the table and place it into preformatted html page.

The code I have that is not working is:

[code]<?php

define(‘DB_NAME’,‘XXXXXX’);
define(‘DB_USER’,‘XXXXXX’);
define(‘DB_PASSWORD’,‘XXXXXX’);
define(‘DB_HOST’,‘bticreditapp.db.XXXXXX.hostedresource.com’);

$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

if (!$link) {
die(‘Could not connect!’ . mysql_error());
}

$db_selected = mysql_select_db(DB_NAME, $link);

if (!db_selected) {
die('Can’t use ’ . DB_NAME . ': ’ . mysql_error());
}

$rs_recent = mysql_query(“select * from creditapp WHERE id=‘3’”) or die(mysql_error());
if (!mysql_query($sql)) {
die('Error ’ . mysql_error());
}

mysql_close();
?>[/code]

This goes right before the beginning of the input of rhte data:

  <? while ($results = mysql_fetch_array($rs_recent)) {?>

Inside each area that I need the information to input, I am using:

<?php echo $results['company_business_name']?>.

The error that I am getting is “Error Query was empty”. Right now, I am just trying to view one row but would like to be able to page through different sets of results. Can anyone help me here and get me moving?

Thanks,

Clint

resolved

<?php define('DB_NAME','XXXXXX'); define('DB_USER','XXXXXX'); define('DB_PASSWORD','XXXXXX); define('DB_HOST','XXXXXX'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if (!$link) { die('Could not connect!' . mysql_error()); } $db_selected = mysql_select_db(DB_NAME, $link); if (!db_selected) { die('Can\'t use ' . DB_NAME . ': ' . mysql_error()); } $rs_recent = mysql_query("select * from creditapp where id='3'") or die('$rs_recent error ' . mysql_error()); mysql_close(); ?>

[/code]

 <? while ($results = mysql_fetch_array($rs_recent)) {?>
<?php echo $results['company_business_name']; ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service