Jump to content

Recommended Posts

hi,

 

i have a from for you to add new brands,

and in my validation page (addbrands.php)

i am getting error on that validation code

Fatal error: Call to undefined function: error() in /home/brennan/public_html/ideas-people/engsoon/admean/brands/addbrands.php on line 65

 

and this is my current code

<?
session_start();

if (session_is_registered("username")){
}else{
echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>";
}

include '../db_connect.php';

$brandname = $_POST['brand_name'];
$b_letter = $_POST['b_letter'];
$brand_details = $_POST['brand_details'];
$brand_url = $_POST['brand_url'];
$brand_logo = $_POST['brand_logo'];
$date_created = date('Y-m-d');
$username = $_POST['username'];

//brand verification
$sql_brandname_check = mysql_query("SELECT brand_name FROM engsoon_brands WHERE brand_name='$brandname'");
  $brandname_check = mysql_num_rows($sql_brandname_check);
	if($brandname_check > 0){
		error ('Brand already exist!');

	} 	 


$brandname = stripslashes($brandname);
$b_letter = stripslashes($b_letter);
$brand_details = stripslashes($brand_details);
$brand_url = stripslashes($brand_url);
$$date_create = stripslashes($$date_create);
$brand_logo = stripslashes($brand_logo);

$sql = mysql_query("INSERT INTO engsoon_brands (brand_name, b_letter, brand_details, brand_url, date_created, brand_logo )
      VALUES('$brandname', '$b_letter', '$brand_details', '$brand_url', '$date_created', '$brand_logo')") or die (mysql_error());

     if(!$sql){
    echo '<script language=javascript> alert("Error adding brand");top.location = "../brandsmngr.php?id=1&username='.$username.'";</script>';
	exit();
     } else {
   $bid = mysql_insert_id();	   

   echo '<script language=javascript> alert("new brand has been added!");top.location = "../brandsmngr.php?id=2&username='.$username.'";</script>';
}


?>

 

i dont know whats wrong on line 65 because its just an error message

 

hope you could help me fix this.

 

thanks so much!

 

 

Link to comment
https://forums.phpfreaks.com/topic/62160-solved-need-help-in-my-validation-code/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.