pixeltrace Posted July 28, 2007 Share Posted July 28, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/62160-solved-need-help-in-my-validation-code/ Share on other sites More sharing options...
ss32 Posted July 28, 2007 Share Posted July 28, 2007 the irony of this is just killing me (= are you sure that your included file has defined this function? thats the first thing i would check Quote Link to comment https://forums.phpfreaks.com/topic/62160-solved-need-help-in-my-validation-code/#findComment-309445 Share on other sites More sharing options...
Fadion Posted July 28, 2007 Share Posted July 28, 2007 as far as i know theres no function error() in php, only i thats a custom function. Anyway u're getting a call to undefined function error, so i assume u have not made a custom one. So remove that and just use echo. Quote Link to comment https://forums.phpfreaks.com/topic/62160-solved-need-help-in-my-validation-code/#findComment-309446 Share on other sites More sharing options...
pixeltrace Posted July 28, 2007 Author Share Posted July 28, 2007 thanks! its working now i just forgot to add the exit; Quote Link to comment https://forums.phpfreaks.com/topic/62160-solved-need-help-in-my-validation-code/#findComment-309454 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.