Hello Alistair,

Thursday, March 11, 2004, 1:25:47 AM, you wrote:

AH> <?php

AH> unset($type);
AH> $type = $_GET['type'];

AH> $link = mysql_connect('localhost', 'user', 'password');
AH>     if (!$link) {
AH>          echo "Couldn't make a connection!";
AH>          exit;
AH>      }
AH>     $db = mysql_select_db("sealhouse", $link);
AH>     if (!$db) {
AH>          echo "Couldn't select database!";
AH>          exit;
AH>      }
AH> $sql= "SELECT * FROM table WHERE type=$type ORDER BY style";
AH> $result = mysql_query($sql);

AH> $total_records = mysql_num_rows($result);

Try and put single quotes around the $type in your query. Especially
if it's not numeric:

$sql = "SELECT blah WHERE type='$type'";

Otherwise, the code is fine. So assuming the database exists and the
query is valid (i.e. works from MySQL itself) then it should work.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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

Reply via email to