Guest User

Untitled

a guest
Mar 6th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. /// This is how I am pulling the inforation from the database ///
  2.  
  3. <?php
  4. $dbhost = "localhost";
  5. $dbuser = "simpsoft_nadmin";
  6. $dbpass = "ilH5roEL?++A1";
  7. $dbname = "simpsoft_allnews";
  8.  
  9. //Connect to MySQL Server
  10. mysql_connect($dbhost, $dbuser, $dbpass);
  11. //Select Database
  12. mysql_select_db($dbname) or die(mysql_error());
  13.  
  14. $artid = "1";
  15.  
  16. //build query
  17. $query = "SELECT * FROM tbl_news_articles WHERE IDone = '$artid'";
  18. $qry_result = mysql_query($query) or die(mysql_error());
  19.  
  20. // Insert a new row in the table for each person returned
  21. while($row = mysql_fetch_array($qry_result)){
  22.  
  23. $display_string .= "<table border='0' class='newsarticletbl'>";
  24. $display_string .= "<tr style='height:34px;'><td><img src='";
  25. $display_string .= "$row[IconURL]";
  26. $display_string .= "' width='42' height='34' alt='article icon' /></td><td valign='top'><h5>";
  27. $display_string .= "$row[SmallHeader]";
  28. $display_string .= "</h5><p class='newsarticledate'>Date Posted - ";
  29. $display_string .= "$row[DatePosted]";
  30. $display_string .= "</p></td></tr>";
  31. $display_string .= "<tr><td colspan='2' valign='top'><p class='newsarticletxt'>";
  32. $display_string .= "$row[SmallPar]";
  33. $display_string .= "<a href='#' style='color:#b40101;margin-left:4px;'><del>Read More</del></a>";
  34. $display_string .= "</p></td></tr></table>";
  35. $display_string .= "<img src='/images/article_sep.gif' width='130' height='2' alt='article sep' class='articlesep' />";
  36. }
  37. echo $display_string;
  38. ?>
  39.  
  40.  
  41. /// This is how I am calling it into my HTML ///
  42.  
  43. <script type="text/javascript">
  44. <!--
  45. //Browser Support Code
  46. function ajaxFunction(){
  47. var ajaxRequest; // The variable that makes Ajax possible!
  48.  
  49. try{
  50. // Opera 8.0+, Firefox, Safari
  51. ajaxRequest = new XMLHttpRequest();
  52. } catch (e){
  53. // Internet Explorer Browsers
  54. try{
  55. ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
  56. } catch (e) {
  57. try{
  58. ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
  59. } catch (e){
  60. // Something went wrong
  61. alert("Your browser broke!");
  62. return false;
  63. }
  64. }
  65. }
  66. // Create a function that will receive data sent from the server
  67. ajaxRequest.onreadystatechange = function(){
  68. if(ajaxRequest.readyState == 4){
  69. var ajaxDisplay = document.getElementById('ajaxDiv');
  70. ajaxDisplay.innerHTML = ajaxRequest.responseText;
  71. }
  72. }
  73. ajaxRequest.open("GET", "/inclu/news.php");
  74. ajaxRequest.send(null);
  75. }
  76. //-->
  77. </script>
  78. <div id='ajaxDiv'></div>
  79.  
  80.  
  81. Basically I want to know how I can pass a variable
Add Comment
Please, Sign In to add comment