jmd87 Posted October 20, 2015 Share Posted October 20, 2015 Hi, Currently I have the below code which grabs the tables and the correct row when i load my website using my row ID (for example: mydomain.com/page.php?ID=1) What I would like it to do is rather than put a number in that I can put the page title in so its displayed like this: Mydomain.php?ID=Home How can I do this please? As I can change this: SELECT * FROM system_setup, menu_item JOIN dow ON dow.id_content = menu_item.id WHERE id = %s to: SELECT * FROM system_setup, menu_item JOIN dow ON dow.id_content = menu_item.id WHERE title = %s but what it does is I can now type in "Mydomain.php?ID=Home" but if I move to another page like "Mydomain.php?ID=contact" it just shows the home page content not the contact content if that makes sense? Can any help please? $maxRows_DetailRS1 = 10;$pageNum_DetailRS1 = 0;if (isset($_GET['pageNum_DetailRS1'])) { $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];}$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1; $colname_DetailRS1 = "-1";if (isset($_GET['ID'])) { $colname_DetailRS1 = $_GET['ID'];}mysql_select_db($database_design_online_connection, $design_online_connection);$query_DetailRS1 = sprintf("SELECT * FROM system_setup, menu_item JOIN dow ON dow.id_content = menu_item.id WHERE id = %s", GetSQLValueString($colname_DetailRS1, "int"));$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);$DetailRS1 = mysql_query($query_limit_DetailRS1, $design_online_connection) or die(mysql_error());$row_DetailRS1 = mysql_fetch_assoc($DetailRS1); if (isset($_GET['totalRows_DetailRS1'])) { $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];} else { $all_DetailRS1 = mysql_query($query_DetailRS1); $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);}$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1; Kind Regards Joe Link to comment Share on other sites More sharing options...
davej Posted October 20, 2015 Share Posted October 20, 2015 I don't remember what this would do with table1... SELECT * FROM table1, table2 JOIN table3 ON table2.coln = table3.colm; Link to comment Share on other sites More sharing options...
justsomeguy Posted October 20, 2015 Share Posted October 20, 2015 It's going to return every row from that table, they are not filtered. It sounds like home is the first row that it returns. There needs to be a join condition for table1 if you don't want to return every row. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now