{"id":74,"date":"2009-11-26T22:45:37","date_gmt":"2009-11-27T03:45:37","guid":{"rendered":"http:\/\/wukenny.host-ed.net\/?p=74"},"modified":"2009-11-26T22:45:37","modified_gmt":"2009-11-27T03:45:37","slug":"php-tutorial","status":"publish","type":"post","link":"http:\/\/kennywu.info\/?p=74","title":{"rendered":"PHP Tutorial -1"},"content":{"rendered":"<h4><a title=\"PHP &amp; MySQL for Dummies\" href=\"http:\/\/www.dummies.com\/store\/product\/PHP-MySQL-For-Dummies-3rd-Edition.productCd-0470096004,navId-322468,descCd-description.html\">PHP &amp; MySQL for Dummies<\/a><\/h4>\n<p>This is the book I am going to start with learning PHP. I am using MS SQL server at work, so MySQL part is not a problem. The basic PHP commands and functions will be listed along with my study progress.<\/p>\n<h4>Chapter 2: Connect to mysql<\/h4>\n<p>The provided mysql_up.php used mysqli_query function, which due to unknown reason does not work. MySQL revision at my website is 5.1.30 verified with mysql_get_server_info. But mysql_up-4.php works, it used mysql_query.<\/p>\n<h4>Check MySQL connection<\/h4>\n<blockquote><p><code>&lt;?php<br \/>\n\/* Program: mysql_up.php<br \/>\n* Desc:    Connects to MySQL Server and<br \/>\n*          outputs settings.<br \/>\n*\/<br \/>\necho \"&lt;html&gt;<br \/>\n&lt;head&gt;&lt;title&gt;Test MySQL&lt;\/title&gt;&lt;\/head&gt;<br \/>\n&lt;body&gt;\";<br \/>\n$host=\"fdb2.host-ed.net\";<br \/>\n$user=\"username\";<br \/>\n$password=\"password\";<br \/>\n$cxn = mysql_connect($host,$user,$password);<br \/>\n$sql=\"SHOW STATUS\";<br \/>\n$result = mysql_query($sql);<br \/>\nif($result == false)<br \/>\n{<br \/>\necho \"&lt;h4&gt;Error: \".mysql_error($cxn).\"&lt;\/h4&gt;\";<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\/* Table that displays the results *\/<br \/>\necho \"&lt;table border='1'&gt;<br \/>\n&lt;tr&gt;&lt;th&gt;Variable_name&lt;\/th&gt;<br \/>\n&lt;th&gt;Value&lt;\/th&gt;&lt;\/tr&gt;\";<br \/>\nfor($i = 0; $i &lt; mysql_num_rows($result); $i++)<br \/>\n{<br \/>\necho \"&lt;tr&gt;\";<br \/>\n$row_array = mysql_fetch_row($result);<br \/>\nfor($j = 0;$j &lt; mysql_num_fields($result);$j++)<br \/>\n{<br \/>\necho \"&lt;td&gt;\".$row_array[$j].\"&lt;\/td&gt;n\";<br \/>\n}<br \/>\n}<br \/>\necho \"&lt;\/table&gt;\";<br \/>\n}?&gt;<br \/>\n&lt;\/body&gt;&lt;\/html&gt; <\/code><\/p><\/blockquote>\n<h4>Check MySQL revision<\/h4>\n<blockquote><p><code>&lt;?php<br \/>\n$host=\"fdb2.host-ed.net\";<br \/>\n$user=\"username\";<br \/>\n$password=\"password\";<br \/>\n$link = mysql_connect($host,$user,$password);if (!$link) {<br \/>\ndie('Could not connect: ' . mysql_error());<br \/>\n}<br \/>\nprintf(\"MySQL server version: %sn\", mysql_get_server_info());<br \/>\n?&gt;<\/code><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>PHP &amp; MySQL for Dummies This is the book I am going to start with learning PHP. I am using MS SQL server at work, so MySQL part is not a problem. The basic PHP commands and functions will be &hellip; <a href=\"http:\/\/kennywu.info\/?p=74\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[43,47],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-lamp","tag-mysql","tag-php"],"_links":{"self":[{"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kennywu.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=74"}],"version-history":[{"count":0,"href":"http:\/\/kennywu.info\/index.php?rest_route=\/wp\/v2\/posts\/74\/revisions"}],"wp:attachment":[{"href":"http:\/\/kennywu.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kennywu.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kennywu.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}