RE: Searchform to results.php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan,

Case make a difference on Unix/Linux machines but not in Windows.  On a Unix
type machine it is best to name all tables and fields with lowercase
letters.  If you create a table called Member and have the SQL statement of
"SELECT * FROM Member" it will not work because SQL is not case sensitive.
In order to do the select you need to quote the table name: "SELECT * FROM
'Member'".  Case doesn't matter on Windows.

Bev

----------------------
Beverly Steiner
steiner277@charter.net


-----Original Message-----
From: Jonathan Villa [mailto:jvilla@isdesigndev.com]
Sent: Friday, March 07, 2003 1:38 PM
To: php@321online.net; php-db@lists.php.net
Cc: amihalic@321online.net
Subject: RE:  Searchform to results.php



"SELECT ......   FROM ".$_POST['searchtype'];

I'm not to sure if this is just for easy ready, but I haven't too many
instances where the query is in all caps.

Anyone, does case matter in a query?

---> Jonathan




-----Original Message-----
From: php@321online.net [mailto:php@321online.net]
Sent: Friday, March 07, 2003 12:32 PM
To: php-db@lists.php.net
Cc: amihalic@321online.net
Subject:  Searchform to results.php

I have a mysql database named DEALER with tables named by states.
My script displays all the data correctly if I manually inculde the FROM
"state name".I want to make a form to let someone choose the state and
run the query. I
have tried and failed can someone show me what I am doing wrong?My
searchform:
<html>
<body>
  <h1>Find a Dealer Search</h1>
  <form action="results.php" method="post">
    Choose a State:<br>
    <select name="searchtype">
      <option value="OHIO">OHIO
      <option value="ALABAMA">ALABAMA
    </select>
     <input type=submit value="Search">
  </form>
</body>
</html>

A snip from my results.php

    <?php
    // connect to my dealer database
    $link = mysql_connect("XXX.XXXX.XXX", "XXX", "XXXXXXXX");
    mysql_select_db("DEALER");
    // query and get the number of records
    $query = "SELECT NAME, ADDRESS, CITY, STATE, ZIP, TELEPHONE,
WEBSITE,
     EMAIL FROM ("results"))";    $result = mysql_query($query) or
die("MY QUERY ERRORS");
    $num_record = mysql_num_rows($result);
    if($num_record > $display) { // Only show 1,2,3,etc. when there are
    more records found that fit on 1 page    // when the page is loaded
first...
    if(empty($pagenr)) {
    $pagenr = 1;
    }
Would you please help me with my mistakes on line6



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux