View Full Version : Connection Problems?

08-31-2006, 10:17 PM
Here is my delimma the webpage should pull all of the information from the database and it does not show anything on the page. Not even the employee's name. Also dreamweaver doesnt recognize it its really annoying sheesh if anyone can help i will be happy(yes i know the connection is commented out)

//Connection statement

// begin Recordset
$colname__rs_employeeDetail = '1';
if (isset($HTTP_GET_VARS['employeeID'])) {
$colname__rs_employeeDetail = $HTTP_GET_VARS['employeeID'];
$query_rs_employeeDetail = sprintf("SELECT staffquestions.staffquestion, staffanswers.staffanswer FROM staffquestions, staffanswers WHERE staffanswers.employeeID = %s AND staffanswers.staffquestionID = staffquestions.staffquestionID", $colname__rs_employeeDetail);
$rs_employeeDetail = $befh->SelectLimit($query_rs_employeeDetail) or die($befh->ErrorMsg());
$totalRows_rs_employeeDetail = $rs_employeeDetail->RecordCount();
// end Recordset

// begin Recordset
$colname__rs_employeePhoto = '-1';
if (isset($HTTP_GET_VARS['employeeID'])) {
$colname__rs_employeePhoto = $HTTP_GET_VARS['employeeID'];
$query_rs_employeePhoto = sprintf("SELECT * FROM employees WHERE employeeID = %s", $colname__rs_employeePhoto);
$rs_employeePhoto = $befh->SelectLimit($query_rs_employeePhoto) or die($befh->ErrorMsg());
$totalRows_rs_employeePhoto = $rs_employeePhoto->RecordCount();
// end Recordset

$SSAdv_colors1 = array("RowOdd","RowEven");
$SSAdv_k1 = 0;
$SSAdv_m1 = 0;
$SSAdv_change_every1 = 1;

//PHP ADODB document - made with PHAkt 2.7.1

08-31-2006, 11:13 PM
Hey, scale back your code (or make a new script) that *JUST* connects to the DB or errors out...that way you'll know if you're chasing a connection error or a code problem:

// add connection code

$select = "select * from $database_table";

$sqlresults = mysql_query($select);

$row_count = mysql_num_rows($sqlresults);
if ($row_count = = "0")
echo "No entries match criteria";

08-31-2006, 11:17 PM
It now says

Notice: Undefined variable: database_table in /u/internet/com/brintlinger-earl/includes/content/about_staff_detail.php on line 32

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /u/internet/com/brintlinger-earl/includes/content/about_staff_detail.php on line 36
No entries match criteria

WHat does that mean?

08-31-2006, 11:28 PM
it means you need to assign something sensibe to the variable $database_table, i.e. the name of one of your database tables

08-31-2006, 11:28 PM
I'd start by setting the $database_table variable equal to whatever your table is named in the database...

That should kill both errors with one definition.