Jump to content

Search the Community

Showing results for tags 'exist'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 3 results

  1. hi just wondering how i would go about checking if a companys name is already in use and if it is show a message at the side saying u cant use this name as its already in use, i know how i would do the error message but i got no clue on how to do the check im guessing you use a sql query but i dont really know. this is the format ive been doing my code in. if (empty($_POST["companyname"])) { $errors['companyname'] = "Please Enter Your companyname"; }elseif(preg_match_all("/[(?\/<>*:.@)]/i",$_POST['companyname'],$matches)){ // list of invalid characters #echo '<pre>',print_r($matches),'</pre>'; $invalid_characters = implode(",",$matches[0]); $errors['companyname'] = 'Cannot use '.$invalid_characters; } elseif(strlen($_POST['companyname']) > 220) { $errors['companyname'] = 'Company name must be less then 220 characters'; } elseif(strpos($_POST['companyname'], 'The') !== false) { $errors['companyname'] = 'Company Names cant start with The'; } elseif(strpos($_POST['companyname'], 'the') !== false) { $errors['companyname'] = 'Company Names cant start with the'; } elseif(strpos($_POST['companyname'], 'THE') !== false) { $errors['companyname'] = 'Company Names cant start with THE'; } else { $companyname = test_input($_POST["companyname"]); }
  2. I have this HTML FORM <form action="check_record.php" method="post"> <input type="text" placeholder=""Last Name" name="lname"></input> <input type="text" placeholder=""First Name" name="fname"></input> SUBMIT or CLEAR </form> once the user submits the form I point it to the check_record.php to check if the record already exist or not <?php //check_record.php session_start(); $connection = mysql_connect("localhost", "root", ""); $db = mysql_select_db("web", $connection); $sql="SELECT * FROM `web`.`tbl_student` WHERE lname = '".$_POST["lname].'", fname = '".$_POST["fname"]."' $result = mysql_query($sql); $row = (I forgot the next codes :\) header("Location:add_record.php"); ?> <?php //add_record.php session_start(); $connection = mysql_connect("localhost", "root", ""); $db = mysql_select_db("web", $connection); $sql="INSERT INTO `web`.`tbl_student` (`lname`, `fname`) VALUES ('".$_POST["lname].'", '".$_POST["fname"]."')"; $result = mysql_query($sql); header("Location:index.php"); ?> I am totally new to PHP, my problem here is, once the user submits the form, it will check if the last name or the first name already exist, if it exist it will not allow to add the record and displays a message "Record alreadys exist" if it's not an existing record, it will display a message saying "Record saved." I have no problem with adding, updating, or deleting a record. During our lab activity I figured out how to check if the record already exist but I'm not sure about because after the record has been check and it's not existing it will add though but the last name and the first name are blank :/ please help
  3. I want a Mirror script which determines whether or not a certain file is accessible or not. If the mirror1 is accessible, it will present the link to mirror 1. If mirror 1 is not accessible, it will present the link to mirror 2. This so far is perfect, however I would like more mirrors. For example, if mirror 2 is unavailable, mirror 3 will be presented. If mirror 3 is unavailable, mirror 4 will be presented and so on. I'm just not quite sure exactly how I could make this work. Has anyone got any suggestions that would be highly appreciated. I've tried quite a lot of things already! $mirror1 = "download1.exe"; $mirror2 = "download2.exe"; $header_response = get_headers($mirror1, 1); if ( strpos( $header_response[0], "404" ) !== false ) { echo ' <a href="', $mirror1, '">Download Mirror 1</a> '; } else { echo ' <a href="', $mirror2, '">Download Mirror 2</a> '; }
×
×
  • 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.