healthnut Posted December 30, 2008 Share Posted December 30, 2008 You guys have been fantastic in solving my first request. Can't say how much I appreciate you... have another problem. When I click the link: http://www.mywebsite.com?D=23530 (unique id) it doesn't collect the stored information that's in the db and insert it into the page for viewing. Just posts the closing html code. Can someone help with this issue also? Here's the code: <?php /*********** Lead-in***********/ $bod = >>>BOD <html><head><title>Your Handwriting Analysis</title></head><body> <center><table BORDER=0 CELLSPACING=0 COLS=1 WIDTH="600" summary="Handwriting Analysis"> <tr><td WIDTH="80%"> <font face="Verdana"><font color="#000066"><span style="font-size: 10pt"> <p>I've just finished analyzing the handwriting sample you submitted. And I must say, the writer of this sample is a most interesting person. It\'s my goal to always be 100% accurate using this 200 year old science. </span></font></font> BOD; /*----------------- Begin Characteristic blurbs----------------*/ $ch1a_blurb = '<p><font face="Verdana"><font color="#000066"> <font face="Verdana"><font color="#000066"><span style="font-size: 10pt"> Oh boy... you checked "High ending strokes that go up into the air...". This is like a child in class holding his hand up high begging for the teacher to call his name. </span></font></font></p>'; /*----------------- Close blurb----------------*/ $close_blurb = '<font face="Verdana"><font color="#000066"><span style="font-size: 10pt"> <p>If you're like most people who ask me for a Handwriting Analysis, you\'re a bit shocked at how accurate it really is. <p>Pass this URL along to your friends:<br> <span style="font-size: 12pt"><b>http://www.mywebsite.com</b></span></span></font></font> <br><br></td></tr></table></center></body></html>'; /*------------------ SQL Database Link -------------*/ include ('/var/www/vhosts/mywebsite.com/httpdocs/dboptions9.inc'); $db = mysql_connect($server, $dbuser, $dbpass); // Connect to MySQL if(!$db) { $error_number = mysql_errno(); $error_msg = mysql_error(); echo "MySQL error $error_number: $error_msg"; exit; } mysql_select_db($db); if ($D) { $result = mysql_query("SELECT * FROM memberList WHERE id=$D"); $myrow = mysql_fetch_array($result); /*------------------Build Intro body ---------------*/ echo $bod; } else { echo "Sorry, I can't find anything!"; } /*----------Build ch1 characteristics--------------*/ if ($myrow[ch1a] === 'Y') { echo $ch1a_blurb; } echo $close_blurb; exit; ?> Link to comment https://forums.phpfreaks.com/topic/138829-collect-data-from-db-compile-data-and-post-it-to-a-website/ Share on other sites More sharing options...
revraz Posted December 30, 2008 Share Posted December 30, 2008 And how do you define $D ? Link to comment https://forums.phpfreaks.com/topic/138829-collect-data-from-db-compile-data-and-post-it-to-a-website/#findComment-725919 Share on other sites More sharing options...
peranha Posted December 30, 2008 Share Posted December 30, 2008 use code tags, it makes things easier to read. Where are you assigning $D = $_GET['D']; Link to comment https://forums.phpfreaks.com/topic/138829-collect-data-from-db-compile-data-and-post-it-to-a-website/#findComment-725920 Share on other sites More sharing options...
healthnut Posted December 30, 2008 Author Share Posted December 30, 2008 use code tags, it makes things easier to read. Where are you assigning $D = $_GET['D']; Not sure I understand. If the url is: www.mywebsite.com/?D=23440 (unique id from db), then would your code be correct? I tried inserting it just above the: if ($D) { but it still doesn't display the data. Link to comment https://forums.phpfreaks.com/topic/138829-collect-data-from-db-compile-data-and-post-it-to-a-website/#findComment-725928 Share on other sites More sharing options...
healthnut Posted December 30, 2008 Author Share Posted December 30, 2008 And how do you define $D ? $D is supposed to define the data associated with the unique id. Example: www.mywebsite.com/?D=23444 (the unique id from the database) Link to comment https://forums.phpfreaks.com/topic/138829-collect-data-from-db-compile-data-and-post-it-to-a-website/#findComment-725931 Share on other sites More sharing options...
revraz Posted December 30, 2008 Share Posted December 30, 2008 I know what it's supposed to do, I'm asking you how are you defining it. If your answer is "I don't know", then you need to do a bit of reading on $_GET. Link to comment https://forums.phpfreaks.com/topic/138829-collect-data-from-db-compile-data-and-post-it-to-a-website/#findComment-725936 Share on other sites More sharing options...
healthnut Posted December 30, 2008 Author Share Posted December 30, 2008 I know what it's supposed to do, I'm asking you how are you defining it. If your answer is "I don't know", then you need to do a bit of reading on $_GET. I've followed your suggestion on reading about $_GET. I tried $_GET["D"] $_GET["id"] neither makes a difference. I'm also confused as to why it doesn't post $bod which is in the code, not in the db. I've tried $bod = " $bod = ' and $bod = <<<BOD none of the 3 work. Link to comment https://forums.phpfreaks.com/topic/138829-collect-data-from-db-compile-data-and-post-it-to-a-website/#findComment-725974 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.