JoMarie Posted October 27, 2008 Share Posted October 27, 2008 I am attempting to code a simple page to display only certain results from the table, but it is displaying all results...here is the code I have, thanks in advance everyone! <?php //new database: $databaseName = "*******"; $username = "*********"; $password = "*********"; $hostname = "***********"; $databaseName2 = "CoffeeDistribution"; $databaseTable = "distribution"; $tableName = 'distribution'; $searchby1 = "edition"; $searchdata1 = "Worcester East"; $order = "business"; $connection = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $db = mysql_select_db($databaseName, $connection) or die("Could not select db"); //find out how many items are in the clients list $result = mysql_query("SELECT * FROM distribution WHERE " . $searchby1 . "= '" . $searchdata1 . "' ORDER BY " . $order); $numberOfClients = mysql_num_rows($result); $totalPages = ceil($numberOfClients / 10); $currentPage = $_GET['page']; //error checking if ((empty($currentPage)) || ($currentPage < 1) || ($currentPage > $totalPages)) { $currentPage = 1; } // echo 'COUNT: ' . $numberOfClients . ' <br />'; // echo 'totalPages: ' . $totalPages . ' <br />'; // echo 'currentPage: ' . $currentPage . ' <br /><br /><br /><br />'; ?> ??? Quote Link to comment https://forums.phpfreaks.com/topic/130334-sqlphp-searchby-help/ Share on other sites More sharing options...
JoMarie Posted October 28, 2008 Author Share Posted October 28, 2008 If it helps......Version is MySQL5.0 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/130334-sqlphp-searchby-help/#findComment-676428 Share on other sites More sharing options...
Bifter Posted October 28, 2008 Share Posted October 28, 2008 You really should change your password now!!! Quote Link to comment https://forums.phpfreaks.com/topic/130334-sqlphp-searchby-help/#findComment-676435 Share on other sites More sharing options...
JoMarie Posted October 28, 2008 Author Share Posted October 28, 2008 Thanks! Duh!! Darn Rookies!! :-\ Quote Link to comment https://forums.phpfreaks.com/topic/130334-sqlphp-searchby-help/#findComment-676449 Share on other sites More sharing options...
fenway Posted October 29, 2008 Share Posted October 29, 2008 Please echo the sql query. Quote Link to comment https://forums.phpfreaks.com/topic/130334-sqlphp-searchby-help/#findComment-677763 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.