Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

undefined function: connect() ....... on line 288

Status
Not open for further replies.

matanzas

Technical User
Apr 15, 2006
184
CA
I cannot see what the undefined function is. This is from the top of my page
Code:
<?php require_once('../Connections/conn.php'); ?>
<?
//save_db.php
//saves the registration data to the db if correct
session_start();
$_SESSION['logged_in'] = "";


//variable declarations
global $email, $lg_name, $lg_pass, $ur_ln, $ur_fn, $err_msg;

$email	 = "";
$lg_name = "";
$ur_ln	 = "";
$ur_fn	 = "";
$err_msg = "";
$lg_pass = "";


if (isset($_POST['Submit'])){
	process_form();
}else{
	show_form();
}//end if

function show_form()
{
	global $email, $lg_name, $ur_ln, $ur_fn, $err_msg;
?>

This is the line 288 area in reference
Code:
function check($id, $pass) 
{

	$sql = "select count(1) as rec_count from cust_info where cust_lg = '$id' and cust_pw = '$pass'";
	
	$unique_result = connect($sql);
	
	if ($unique_result){
		$rows = mysql_fetch_array($unique_result);
		if ($rows['rec_count'] == 0){
			 return true;
		}else{
			 return false;
		}//end if
	}//end if

}//end function
I can post the entire page if needed.
Any help appreciated, Thanks
 
Unless you have the function connect() defined somewhere else in the code, then this line
Code:
    $unique_result = connect($sql);
will produce the error you are seeing. There is no pre-defined function connect in php. Were you trying to run mysql_query() instead?
 
If I change this line
Code:
<?php require_once('../Connections/conn.php'); ?>
to this
Code:
require("conn.php");
it works.

Conn.php was in the same folder as the page so, it was trying to reference
Code:
function connect($sql)
in the file conn.php.

What I was trying to do was use the conn file in the Connections folder but I see what you are saying as there was nothing defining it in the Connections/conn file.

I copied conn.php to Connnections/conn.php and it works.

Does that make sense?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top