Jump to content

yoki

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by yoki

  1. Thanks for the quick reply! Much appreciated!
  2. Hi, I have the following string: "lastname, firstname" which I need to output like this: "firstname, lastname" How do I do code this? Thanks for your help.
  3. Hi, Please look at the following code. I am getting a parsing error in mysql query...I'm fairly new to php so would appreciate your help. <form id="form1" name="form1" method="post" action="test.php"> <?php $username = "bogus"; $password = "bogus"; $hostname = "localhost"; $dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $area_code = $_POST['Area_Code']; $phone = $_POST['Phone']; if (isset($_POST['Submit'])) { $selected = mysql_select_db("dncl",$dbh) or die("Could not select MySQL Database."); $result = mysql_query("SELECT Telephone.Area_Code,Telephone.Phone FROM Telephone WHERE Telephone.Area_Code = '$area_code' AND Telephone.Phone = '$phone'"); while($row = mysql_fetch_array($result)) { $i = 1; echo $i . "." . $row['Area_Code'] . " " . $row['Phone']; echo "<br />"; $i++; } } ?> Area Code: <select name="Area_Code"> <option value="204">204</option> <option value="226">226</option> <option value="250">250</option> <option value="289">289</option> <option value="306">306</option> <option value="403">403</option> <option value="416">416</option> <option value="418">418</option> <option value="438">438</option> <option value="450">450</option> <option value="500">500</option> <option value="506">506</option> <option value="514">514</option> <option value="519">519</option> <option value="581">581</option> <option value="587">587</option> <option value="600">600</option> <option value="604">604</option> <option value="613">613</option> <option value="647">647</option> <option value="705">705</option> <option value="709">709</option> <option value="778">778</option> <option value="780">780</option> <option value="807">807</option> <option value="819">819</option> <option value="867">867</option> <option value="902">902</option> <option value="905">905</option> </select> <? mysql_close($dbh); ?>Phone Number: <input name="Phone" type="text" size="6" maxlength="7" /> <input type="submit" name="Submit" value="Search" /> </form> <p> </p>
  4. Great!!! Thank you so much!
  5. Hi, I'm rather new to setting up a MySQL database and was wondering if someone could suggest me a way of storing phone numbers. I'm planning to update my database with a .csv file which will contain the phone numbers in this format: 514,2544395 514,6549082 . . . I want to be able to search for a phone number by first selecting the area code in a dropdown and then entering the number in another field. Should I split the telephone number into two tables? One table for the area code and one for the telephone number? Any good suggestions would be appreciated.
×
×
  • 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.