Jump to content

chadrt

Members
  • Posts

    124
  • Joined

  • Last visited

Everything posted by chadrt

  1. Yeah and you can query as many tables as you like and I am assuming you know how to pull the fields from each record so I didnt put that code in there.
  2. After the code to open the database. Mind you I am new to this as well I have only been programming in PHP for about a week now so there may be a better way to do it but here is a little piece of code I have put together for you. This assumes that each table shares a common bond by having a unique ID for each record that matches the other tables. So here goes: # connection information $username="SomeUSERnameHere"; $password="SomeUSERpassHere"; $database="YourDBname"; $dbhost="localhost"; # Connects to database mysql_connect($dbhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); # Opens and searchs the database for a specific unique_id $query1="SELECT * FROM table1 WHERE unique_id='$uidsearch'"; $resultam=mysql_query($query1); $query2="SELECT * FROM table2 WHERE unique_id='$uidsearch'"; $resulten=mysql_query($query2); $query3="SELECT * FROM table3 WHERE unique_id='$uidsearch'"; $resulthd=mysql_query($query3);
  3. Thank you that was the ticket right there I didnt know || were like "OR" from what I can see that is what it is and it worked great!
  4. Here try this: $query1="SELECT * FROM table1 WHERE unique_id='$uidsearch'"; $resultam=mysql_query($query1); $query2="SELECT * FROM table2 WHERE unique_id='$uidsearch'"; $resulten=mysql_query($query2); $query3="SELECT * FROM table3 WHERE unique_id='$uidsearch'"; $resulthd=mysql_query($query3); I have been told it is good method I use it and it works great.
  5. The results page broad-search.php has a $_POST for each field in my form and a hidden field in the form specifies which set of instrcutions will followed by the broad-search.php page. When the name and address section of the page is being used it has 5 fields that it listens to: Name Address City State zip What I want to happen: => When that form is used the field ZIP is a requirement, I have that accomplished. => Then the NAME, ADDRESS, or CITY not all of them or but just one of them, has to have at least 3 characters in it for it to do what it is supposed to do.
  6. Hello, I am very new to PHP, a week to be exact, so bear with me. Last week I decided to build this database and create these interface pages and I may have made it more complicated than it should be but, well you know. I will describe the problem and give you a little background as well so that you will have everything you need. This is my very first attempt at PHP or MySQL stuff and I believe that this particular question has more to do with PHP than MySQL so here goes. I have a form http://ki4mve.com/cs this form has 3 sections which are just three individuale forms on one page. The third form has 5 fields that POST to a custom script that I created to show the contents of the database now I want the STATE field to always be filled in and I accomplished that but the other 4 fields I would like to have at least 3 characters in one of the remaining 4 fields! This will hopefully prevent too many entries from being displayed simultaneously and too many database entries from flooding the screen. How I am doing the STATE field: (Those are two single quotes not a double) if ($state==''){ echo "You must select a state to search in!"; } If I have been to vague please let me know what if anything you need and I will gladly post it. Thank you in advance to anyone who has a moment to spare in this request. ~Chad
×
×
  • 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.