magie Posted December 23, 2008 Share Posted December 23, 2008 Hey guys I have a little question, i tryed to figure out. I have a program site, who only can use HTML scripts. And I have my Php script, that sent the form result to my sql database, and then another script pick it up by echo. But is there there any way that maybe a html script to pick up the result from mysql or a php script to convert the result to Html. Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/ Share on other sites More sharing options...
redarrow Posted December 23, 2008 Share Posted December 23, 2008 No html can not show database entry. But you can get php.ini act as html is php. if your saving the file as html then you can get php to run as html. Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722264 Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 PHP and HTML are different things, but you do not need to convert from one the the other, you just generate the HTML in your PHP script. Also, HTML can reside inside a PHP file, together, as the PHP server will execute the PHP code, output the remaining HTMl to the browser, and that's exactly what your seeing now with PHP Freaks... Example... echo("<p>".$row['comments']."</p>"); That will output the comments in a paragraph, you can use code similar to this in any part of the HTML, because the server executes it before it hits the browser. Happy Xmas! ILMV Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722265 Share on other sites More sharing options...
redarrow Posted December 23, 2008 Share Posted December 23, 2008 Sorry but i personally think this website saves as .php extension then mod rewrite, rewritten. Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722267 Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 Sorry but i personally think this website saves as .php extension then mod rewrite, rewritten. Sorry, I don't get what you mean? Could you explain? Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722271 Share on other sites More sharing options...
magie Posted December 23, 2008 Author Share Posted December 23, 2008 Hey ILMV I helped a little, but still it just write the code, not the result. Its because im using E107 But my code is like this <?php // set database server access variables: $host = "localhost"; $user = "twossdow_siteadm"; $pass = "******"; $db = "twossdow_recentrealism"; $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create result $result = mysql_query("SELECT * FROM Opponent"); while($row = mysql_fetch_array($result)) echo ("<p>".$row['Opponent']."</p>"); // create result $result = mysql_query("SELECT * FROM Winner"); while($row = mysql_fetch_array($result)) echo ("<p>".$row['Winner']."</p>"); // create result $result = mysql_query("SELECT * FROM Result"); while($row = mysql_fetch_array($result)) echo ("<p>".$row['Result']."</p>"); ?> Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722275 Share on other sites More sharing options...
redarrow Posted December 23, 2008 Share Posted December 23, 2008 1 min you see your current code, are you wanting it to be shown on a .html page. Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722278 Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 Hey ILMV I helped a little, but still it just write the code, not the result. Its because im using E107 But my code is like this <?php // set database server access variables: $host = "localhost"; $user = "twossdow_siteadm"; $pass = "******"; $db = "twossdow_recentrealism"; $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create result $result = mysql_query("SELECT * FROM Opponent"); while($row = mysql_fetch_array($result)) echo ("<p>".$row['Opponent']."</p>"); // create result $result = mysql_query("SELECT * FROM Winner"); while($row = mysql_fetch_array($result)) echo ("<p>".$row['Winner']."</p>"); // create result $result = mysql_query("SELECT * FROM Result"); while($row = mysql_fetch_array($result)) echo ("<p>".$row['Result']."</p>"); ?> If the file is a .HTML file then that's exactly what you would see, because that's what the server does with that kind of file. Changing it to .PHP would solve that problem. Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722280 Share on other sites More sharing options...
redarrow Posted December 23, 2008 Share Posted December 23, 2008 That cheating. you Said you can only use .html files i said you can change the php.ini to show .html files as php Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722281 Share on other sites More sharing options...
magie Posted December 23, 2008 Author Share Posted December 23, 2008 No, my code is a php code, but the program E107 only support HTML codes to new pages. So i wannt my php code to every time generate a HTML code and put it in my site. Or something like that Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722284 Share on other sites More sharing options...
redarrow Posted December 23, 2008 Share Posted December 23, 2008 Does the html program, run thro your php server. Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722289 Share on other sites More sharing options...
magie Posted December 23, 2008 Author Share Posted December 23, 2008 its a php program, but it only support HTML in new pages, kinda stupid Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722290 Share on other sites More sharing options...
redarrow Posted December 23, 2008 Share Posted December 23, 2008 so if you alter the php.ini add handler i think as .html then you can show database entry's i am sure. do u get my madness Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722296 Share on other sites More sharing options...
redarrow Posted December 23, 2008 Share Posted December 23, 2008 or even better get the current program to create .php extension not .html extension. Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722300 Share on other sites More sharing options...
ILMV Posted December 23, 2008 Share Posted December 23, 2008 Hang on I think I get it, they are using E107 which is a CMS, but he/she is trying to add PHP code within via the CMS system, so it treats it as text and not native PHP code. Just like you would expect when replying here, you could enter PHP code, but it would display it as text, because that's its job. ILMV Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722305 Share on other sites More sharing options...
magie Posted December 23, 2008 Author Share Posted December 23, 2008 Yea you are right ILMV, what can I do? Link to comment https://forums.phpfreaks.com/topic/138174-convert-php-result-to-html/#findComment-722726 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.