yshua Posted August 23, 2012 Share Posted August 23, 2012 Dear forum ladies and gentlemen: Tried to bare all my code for one final stab at sol'n before the Toronto Web people get me.... I cut down my index.php, form.php, and insert.php files as follows, and made recommended changes. Now is this easily solvable? Using PHP5.3.8, MySQL5.5.21, Apache2.2, Win7. Please see attached code that gives the following emsg: Timestamp: 8/22/2012 7:29:19 PM Error: The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol. Source File: http://127.0.0.1/insert.php Line: 0 index.php: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <head> <title>mywebserver website</title> </head> <body> <table align="center"><tr><td> <table width="843" height="503" align="center" bgcolor="#F7F7F7"> <tr><td height="453" valign="center"><table width="799" height="385" align="center"><td><tr> <tr><td height="379" valign="top"><tr> <h2></h2> <p><h2>Under Construction....</h2> <p align="center"><a href="form.php" ><strong>Download Now</strong></a></p> </p></td></tr></table></td></tr> </body> </html> [/Code] form.php: [Code] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?php header ("content-type: text/html; charset=utf-8"); ?> <head> <title>mywebserver's website</title> </head> <body> <strong>Please fill in the following information to get started<br><br></strong></h2> <p> <form name="debt" method="post" action="insert.php"> <table width="537" align="center" cellpadding="0" cellspacing="0" > <tr><td height="35" colspan="2" valign="top" ><div id="final" align="center"></div></td></tr> <tr><td width="268" height="22" valign="middle"><div align="right">First Name </div></td> <td width="267" valign="top"> <input type="text; charset=utf-8" name="fname" id="fname" /td></tr> <tr><td height="100" colspan="2" ><div align="center" <table width=0 cellpadding=0 cellspacing=0 border=0><tr> <input type="Submit" > <a href="#" title="Submit" onclick="submitform('final')"><br/></a></td> </div></td></tr> </table></form> </td></tr></table></td></tr> </body> </html> </Code> insert.php: <Code> <?php $db = new mysqli (); $db->set_charset ('utf8'); mysqli::__construct() ([ string $host = ini_get("mysqli.default_host") [, string $username = ini_get("mysqli.default_user") [, string $passwd = ini_get("mysqli.default_pw") [, string $dbname = "reccus2" [, int $port = ini_get("mysqli.default_port") [, string $socket = ini_get("mysqli.default_socket") ]]]]]] ) $mysqli = new mysqli('host', 'headache2', 'fakepassword', 'fakerewi3'); if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } echo 'Success... ' . $mysqli->host_info . "\n"; mysql_query("INSERT INTO users (fname) charset='utf-8' VALUES ('".$_REQUEST['fname']."')"); session_start(); $_SESSION['user']=$_REQUEST['fname']; $mysqli->close(); ?> <body onLoad="document.myform.submit();"> <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" name="myform"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="fakeid@yahoo.com"> <input type="hidden" name="item_name" value="1 Download"> <input type="hidden" name="item_number" value="1 Download"> <input type="hidden" name="amount" value="9.98"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="return" value="http://www.fakewebsite.com/success.php"> <input type="hidden" name="cancel_return" value="http://www.fakewebsite.com/yshua/"> </form> </body> [/Code] Thanks for giving me this chance, Yshua 18882_.php Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/ Share on other sites More sharing options...
Christian F. Posted August 23, 2012 Share Posted August 23, 2012 You messed up your code tags. Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1371655 Share on other sites More sharing options...
yshua Posted August 23, 2012 Author Share Posted August 23, 2012 Dear ChristianF: You're right, looking at other people's entries. Am I supposed to use the php icon above, etc.? Totally green about this, evidently. Sorry, Yshua Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1371658 Share on other sites More sharing options...
jazzman1 Posted August 23, 2012 Share Posted August 23, 2012 Start coding the script from scratch. There are so many errors, I hardly could count them. Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1371660 Share on other sites More sharing options...
fenway Posted August 23, 2012 Share Posted August 23, 2012 You're new -- I suggest you re-read the posting rules. You can start by not posting your scripts. Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1371661 Share on other sites More sharing options...
Christian F. Posted August 23, 2012 Share Posted August 23, 2012 Well... You got the basic idea with the header (); call, but you missed some pretty basic stuff. It's all explained in here: HEADER ERRORS - READ HERE BEFORE POSTING THEM Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1371698 Share on other sites More sharing options...
yshua Posted August 24, 2012 Author Share Posted August 24, 2012 Dear people: Here's the latest error: error.log: [Fri Aug 24 16:32:55 2012] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/default-files, referer: http://127.0.0.1/ [Fri Aug 24 16:32:55 2012] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/default-files, referer: http://127.0.0.1/ [Fri Aug 24 16:41:01 2012] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/default-files, referer: http://127.0.0.1/ access.log: 127.0.0.1 - - [24/Aug/2012:16:32:55 -0600] "GET / HTTP/1.1" 200 5202 127.0.0.1 - - [24/Aug/2012:16:32:55 -0600] "GET /default-files/styles_wp36t.css HTTP/1.1" 404 228 127.0.0.1 - - [24/Aug/2012:16:32:55 -0600] "GET /default-files/styles_wp36t.css HTTP/1.1" 404 228 Still am clueless, Yshua Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1372208 Share on other sites More sharing options...
fenway Posted August 26, 2012 Share Posted August 26, 2012 This has nothing to do with mysql, or even php. Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1372566 Share on other sites More sharing options...
yshua Posted August 26, 2012 Author Share Posted August 26, 2012 Fenway: With all due respect, as a huge contributor to this forum that you are. I am humbled at your willingness to reply to mere me, a novice! However, the solution doth now speak for itself. I was using a host and hostname conflict. Redundant MySQL signons, eliminated gave emsg: 1045, showing "root" needed to be specified. Will post final solution, as this one is preliminary, and an isert error remains. Hope to post complete sol'n soon, Yshua Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1372582 Share on other sites More sharing options...
fenway Posted August 26, 2012 Share Posted August 26, 2012 Well, you posted apache error messages about a file not exists. And connecting to mysql as 'root'? Definitely not the solution. Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1372648 Share on other sites More sharing options...
yshua Posted August 26, 2012 Author Share Posted August 26, 2012 Dear Fenway: Touche', you are right again, after checking my sources! Ow. So perhaps one lone gasp of a question to get me on track to get this question back on how to do a MYSQLI insert (or whatever one calls it)? How in the world, without knowledge of a control panel, etc., do I find out the appropriate login info for the opening of MYSQLI? Oh, well, Yshua Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1372695 Share on other sites More sharing options...
yshua Posted August 26, 2012 Author Share Posted August 26, 2012 OK, it worked! Have attached the working file, insert5.php, in place of insert.php. And, of course, must create a new user to alleviate the remaining "root" nomenclature. OK by you Fenway? Thanks, Yshua 18895_.php Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1372728 Share on other sites More sharing options...
fenway Posted August 26, 2012 Share Posted August 26, 2012 I'm not one to open attachments -- but a new dedicated user sounds like the way to go. Quote Link to comment https://forums.phpfreaks.com/topic/267457-tried-to-bare-bones-all-my-code-hoping-to-see-why-this-emsg/#findComment-1372734 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.