That's probably not accurate terminology, but its the best I know how to describe what I'm trying to do. I've set up dgssearch and it works beautifully. It brings up the results page, in which each result has a link. Unfortunately, I'm having trouble figuring out how to make the link work. The search is at http://www.turnupdown.com/dgssearch/index.php If you search for Eric Clapton or Bruce Springsteen, or anyone else that I might have in the database, it will return the results. You will then see the link I am referring to. An example would be: http://www.turnupdown.com/dgssearch/library.php?id=770 In this instance, I want the library.php page to pull up certain fields from the table row with an id of 770. Does this make sense? Its been so long since I've done anything like this, I've forgotten everything I used to know and its just no clicking for me. Thanks in advance for any input. jez
SELECT * FROM `table` WHERE `id` =770 Code (markup): use the mysql code from above in your php script and change the use the $id instead of 770.
Thanks for the reply. The code for the library.php page is as follows: <html> <body> <?php if(isset($_GET['ID'])) { $ID = $_GET['ID']; $dbh=mysql_connect ("localhost", "*****", "*****") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("turnupdlibrary"); $result = mysql_query("SELECT `Notes` FROM `jezebel` WHERE `ID` = $ID;"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row=mysql_fetch_row($result); echo $row[0]; echo $row[1]; } ?> </body> </html> Code (markup): I'm not getting an error code, but the page comes up blank. Thanks, jez
Don't use isset, use if (x != ""); Clean the input variable or you have a huge injection hole. $ID = intval($_GET['ID']); Your ULR used lower case and your php uses uppercase to sort the id variable. So $ID will always be empty.
I'm sorry...I really have no clue how I"ve gotten as far as I have with this. I now have it coded as below: <html> <body> <?php (x != "id"); $id = $_GET['id']; $dbh=mysql_connect ("localhost", "*****", "*****") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("turnupdlibrary"); // Get all the data from the "example" table $result = mysql_query("SELECT `Notes` FROM `jezebel` WHERE `id` = $id;"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row=mysql_fetch_row($result); echo $row[0]; echo $row[1]; } ?> </body> </html> Code (markup): I now get the error message: Could not run query: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1. In the database, ID is in caps. I'll rename it to lowercase so the url with be correct. I appreciate all the help! jez
Try working with this... <html> <body> <?php if( $_REQUEST['id'] != '' ) { $id = intval($_REQUEST['id']); $dbh=mysql_connect ("localhost", "*****", "*****") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("turnupdlibrary"); // Get all the data from the "example" table $result = mysql_query("SELECT `Notes` FROM `jezebel` WHERE `id` = $id;"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row=mysql_fetch_row($result); echo $row[0]; echo $row[1]; } else { echo "No Request."; } ?> </body> </html> PHP: