Jump to content

Asterixx

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by Asterixx

  1. [code]<? mysql_connect("localhost","usr","pw");      mysql_select_db("my_db"); $search=$_POST["search"]; $result = mysql_query("SELECT * FROM my_table WHERE zip LIKE '%$search%'"); //grab all the content while($r=mysql_fetch_array($result)) {           $zip=$r["zip"];    $contact=$r["contact"];    $address=$r["address"];       echo "$zip <br> $contact <br> $address <br>"; } ?>[/code] This is a simple thing to more advanced users. I need to query more than just "my_table" to get the results; the other tables I need to query hold the exact same info as "my_table". I tried delimiting with comas, as in "my_table, my_othertable, my_moretable", but that brought up a SQL error. Thanks a bunch in advance, Stephan.
  2. Thanks! Finally someone giving me a straight answer. If I can't use Include, what can I use? Is it not possible?
  3. PHP beginner here... [code]<?php include("config.php");   if($submit)   { include('post.txt'); if(!$contact){  //this means If the title is really empty. echo "Error: Contact is a required field. Please fill it."; exit(); //exit the script and don't do anything else. } $result = mysql_query("INSERT INTO AL_BVA (contact, time, phone, address, city, state, zip, email, website, notes) VALUES ('$contact',NOW(),'$phone','$address','$city','$state','$zip','$email','$website','$notes')",$connect);    echo "Contact added";           echo "<meta http-equiv=Refresh content=4;url=bvaindex.php>";   } else   {       ?> <? include('form.txt'); ?>             <?   }      mysql_close($connect); ?>[/code] FORM.TXT [code]<br>       <h3>::Add Contact::</h3>       <form method="post" action="<?php echo $PHP_SELF ?>">      Contact: <input name="contact" size="40" maxlength="50">       <br>      Phone: <input name="phone"  size="20" maxlength="20">       <br>       Address: <input name="address"  size="40" maxlength="100">       <br> City: <input name="city"  size="40" maxlength="50">       <br> State: <input name="state"  size="4" maxlength="4">       <br> Zip: <input name="zip"  size="20" maxlength="20">       <br>       Email: <input name="email"  size="40" maxlength="50">       <br>      Website: <input name="website"  size="40" maxlength="50">   <br>      Notes: <textarea name="notes" rows="7" cols="30"></textarea> <br>       <input type="submit" name="submit" value="Add Contact">       </form>[/code] POST.TXT [code]<?       $contact = $_POST['contact'];       $phone = $_POST['phone'];       $address = $_POST['address'];   $city = $_POST['city'];   $state = $_POST['state'];   $zip = $_POST['zip'];       $email = $_POST['email'];           $website = $_POST['website'];       $notes = $_POST['notes']; ?>[/code] I'm trying to do what I did with these 2 .txt files with the data after AL_BVA and VALUES, so I can edit it from an external file. I can currently edit these 2 .txt files and the form works in over 100 pages. I've tried stuff like what follows but that gives me a parsing error. [code]$result = mysql_query("INSERT INTO AL_BVA (include'data.txt')                        VALUES (include'values.txt')",$connect);[/code] I desperately need this to work. :) Thanks in advance! P.S.: the server runs PHP4+
×
×
  • 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.