Jump to content

9911782

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Everything posted by 9911782

  1. Hi All There is a website currently running, but Im not the developer i had to maintain it.But, im having a problem with searching.Somebody else have developed it. When performing the search function, I get this problem: Fatal error: Call to a member function RecordCount() on a non-object in C:\Program Files\Business Objects\ThirdParties\apache\htdocs\Terminology\resultsABBR.php on line 37 here is the code of resultsABBR.php: --------------------------------------------------------------- <html> <head> <title>Terminology: Search Results</title> <link href="stylesheet.css" rel="stylesheet" type="text/css"> </head> <body> <table width="800" cellpadding="0" cellspacing="0" border="0"> <tr> <td align="center"><h2>Search Results</h2><br><img src="BS00554_.WMF" width="141" height="118"> </td> </tr> <tr> <td><hr></td> </tr> <!--h2>Search Results</h2--> <tr> <td> <?php include('tblterminologyDAO.php'); // check if a search term has been given - to be replaced by built-in framework validation if(!$abbr){ echo "No search term given"; exit; } if($language == 1){ $result = listAbbrevByEnglish($abbr); } else if($language == 2){ $result = listAbbrevByAfrikaans($abbr); } else{ $result = listAbbrevByXhosa($abbr); } if($result->RecordCount() == 0){ echo "<meta HTTP-EQUIV='REFRESH' content='0; url=error.php?phrase=".$abbr."'>"; exit; } else{ echo "<table border='1' bordercolor='#000000'> <tr>"; if($language == 1){ echo " <td><b>Abbreviation</b></td> <td><b>Phrase/Word</b></td> <td><b>Comment</b></td> <td><b>Afkorting</b></td> </tr>"; } else if($language == 2){ echo " <td><b>Afkorting</b></td> <td><b>Frase/Woord</b></td> <td><b>Opmerking</b></td> <td><b>Abbreviation</b></td> </tr>"; } else{ echo " <td><b>Abbreviation(Xho)</b></td> <td><b>Phrase(Xho)</b></td> <td><b>Comment(Xho)</b></td> <td><b>Abbreviation</b></td> <td><b>Afkorting</b></td> </tr>"; } while ($record = $result->FetchRow()) { if($language == 1){ echo "<tr> <td>".$record["ABBREVE"]."</td> <td>".$record["PHRASEE"]."</td> <td>".$record["COMMENTE"]."</td> <td>".$record["ABBREVA"]."</td> </tr>"; } else if($language == 2){ echo "<tr> <td>".$record["ABBREVA"]."</td> <td>".$record["PHRASEA"]."</td> <td>".$record["COMMENTA"]."</td> <td>".$record["ABBREVE"]."</td> </tr>"; } else{ // Xhosa to be added } } } ?> </table> </td> </tr> <tr> <td height="45"></td> </tr> <tr> <td width="50%" height="30" bgcolor="#000066" align="center"> <a href="main.html" style="color:#ffffcc;">Home</a> | <a href="javascript: history.go(-1)" style="color:#ffffcc;">Back</a> </td> </tr> </table> </body> </html> --------------------------------------------------------------- here is the code for 'tblterminologyDAO.php' -------------------------- <?php // include connection class include ('conn.php'); include ('statementParser.php'); $db = connect(); // function to get data by english phrase/word function listPhraseByEnglish($phraseEng){ global $db; $preparedStatement[0] = $phraseEng; $query = loadSql("tblterminologyDAO.listPhraseByEnglish", $preparedStatement); $result = $db->Execute($query); return $result; } // function to get data by afrikaans phrase/word function listPhraseByAfrikaans($phraseAfr){ global $db; $preparedStatement[0] = $phraseAfr; $query = loadSql("tblterminologyDAO.listPhraseByAfrikaans", $preparedStatement); $result = $db->Execute($query); return $result; } // function to get data by xhosa phrase/word function listPhraseByXhosa($phraseXho){ global $db; $preparedStatement[0] = $phraseXho; $query = loadSql("tblterminologyDAO.listPhraseByXhosa", $preparedStatement); $result = $db->Execute($query); return $result; } // function to get data by english abbreviation function listAbbrevByEnglish($abbrEng){ global $db; $preparedStatement[0] = $abbrEng; $query = loadSql("tblterminologyDAO.listAbbrevByEnglish", $preparedStatement); $result = $db->Execute($query); return $result; } // function to get data by afrikaans abbreviation function listAbbrevByAfrikaans($abbrAfr){ global $db; $preparedStatement[0] = $abbrAfr; $query = loadSql("tblterminologyDAO.listAbbrevByAfrikaans", $preparedStatement); $result = $db->Execute($query); return $result; } // function to get data by xhosa abbreviation function listAbbrevByXhosa($abbrXho){ global $db; $preparedStatement[0] = $abbrXho; $query = loadSql("tblterminologyDAO.listAbbrevByXhosa", $preparedStatement); $result = $db->Execute($query); return $result; } ?> ---------------------------- ---------------------------- here is the code for 'statementParser.php --------------------------- <?php // define file name and create handle to open file for reading $file = 'sql.inc.php'; $handle = fopen($file, "r"); // use fread, open for reading, how much? full size of $file. $data = fread($handle, filesize($file)); fclose($handle); // break up the data into an array, split where the new lines breaks are $data_split = explode("##", $data); for($i = 0; $i < count($data_split); $i++){ $data_split[$i] = str_replace("\\", "", $data_split[$i]); } $sqlData = processSql($data_split); function loadSql($queryString, $parameters){ global $sqlData; $query = $sqlData[$queryString]; $p = 0; for($i = 0; $i < strlen($query); $i++){ $str_temp = substr($query, $i, 1); if($str_temp == "?"){ $query = substr_replace($query,$parameters[$p],$i,1); $p++; } } return $query; } function processSql($sqlStringArray){ for($i = 0; $i < count($sqlStringArray); $i++){ $sqlString = trim($sqlStringArray[$i]); $sqlValue = ereg_replace("([a-zA-Z0-9])+.([a-zA-Z0-9])+( )*=( )*","", $sqlString); $labelLength = (strlen($sqlString)-strlen($sqlValue)); $tmp = ereg_replace("( )*=( )*", "", trim(substr($sqlString, 0, $labelLength-1))); $sqlLabel = $tmp; $sqlArray [$sqlLabel] = trim($sqlValue); } return $sqlArray; } ?> --------------------------- These are all the files linked together. Thankx
  2. Hi All I need to format 2006/07(2006/2007, 2007/2008)field in my database. Do I need to use the year datatype? The problem is that, I have a list of objectives that will run for those 2 specific years. I am really out...I have use the varchar(8), but Im so sure that, Its not right. And How do I return only a year in the above mentioned date? Please help me. thank you ???
  3. ;) thank very much Its working for me now after along time. thankx a million
  4. Hi manmadareddy its working right now, thank you very much. I took ur advise. thanks a million.
  5. Hi Im am doing the web-based application, where I have to add some information from front-end, and then add it to the database. Now, I would like to get the MySQL statement that will prevent me from adding same thing in 1 table. Please help me, I need to do this by end of today. thank you
  6. Hi There :) Ps help me Its goes like this, I have register all my users, then send them their username & password(temp), then what they need to do: On my user table, I have a flag that I created to check if its the user's first time to login. They will have to Login with username & password I gave them, then after that, the change password option shoul appear to them so that they can put their own password. I have created the Login.php, Login_verify.php, then changepassword.php. On the changepassword.php, I have this : ------------------------------------------- <?php if (isset($_POST["btnchangepass"])){ $changed = $_POST['Y']; $password = $_POST['password']; require_once('inc_conn.php'); $sql="SELECT * FROM users WHERE changed = 'N'"; //execute sql statements $rsverify = mysql_query($sql, $connwmis) or die(mysql_error()); //retrieve one row of records $rows_rsverify = mysql_fetch_array($rsverify); if($changed == 'N'){ $updateSQL = "UPDATE users SET password=password('$password'), changed = '$changed' WHERE changed = 'N'"; $execute = mysql_query($updateSQL, $connwmis) or die(mysql_error()); //redirect to viewarticles If ($execute) { mysql_close($connwmis); $msg ="Thank you for changing yout password."; } } } ?> ------------------------------------------------------ But now, I have a problem, It not doing anything.No update nothing. Another thing in the changepassword.php, what do I need to do actually, because to my understanding, I believe that I have to compare the newpassword ,re-enter newpassword, then from there I dont know what to do... Ps help me  Thank you
  7. Hi thank you for your help. Ur example is working for me, its exaclty what I've been looking for... thanka milion :)
  8. [!--quoteo(post=381758:date=Jun 8 2006, 11:08 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jun 8 2006, 11:08 PM) [snapback]381758[/snapback][/div][div class=\'quotemain\'][!--quotec--] The "old school" way is to use a CRON job; but MySQL 5.1 supposedly has an event scheduler which will allow you to do just this without an external program (though I've never actually used it). In principle, you could add a trigger to run, but that's too much extra work for every single statement. [/quote] Hi I have the same problem with my website. How does this CRON job work and where do I get it.
  9. Hi All I can't move now. I've been trying to calculate the end date(due date in 3months time) for a specific event by getting the startdate from the database then calculate the end date.I think I got it, but now the problem is that, I want to write it to my dababase using the update statements. It doesn't want to write now. What can I do? What have a done wrong here??? ps help me good people here is my small code: ------------------------------------------------------- <?php require_once('inc_conn.php'); $edatetime = $_POST['edatetime']; // prepare query $sql="SELECT sdatetime FROM eventscalendar"; //execute sql statements $rsdate = mysql_query($sql, $connimgp) or die(mysql_error()); //retrieve one row of records $sdatetime = mysql_fetch_array($rsdate); //determine the number of records in recordset $num_rows = mysql_num_rows($rsdate); //echo $sdatetime['sdatetime']; $sdatetime= $sdatetime['sdatetime']; echo "<br>"; $edatetime = time() + (61 * 24 * 60 * 60); // 7 days; 24 hours; 60 mins; 60secs echo 'Date Posted: '. $sdatetime ."<br><br>"; echo '3 month due date: '. date('Y-m-d', $edatetime) ."\n"; //Insert into the database $insertSQL = "UPDATE eventscalendar SET edatetime = '".$edatetime."' WHERE eventid=49"; //Execute the insert statement $execute = mysql_query($insertSQL, $connimgp) or die(mysql_error()); //Redirect to policy.php if ($execute) { mysql_close($connimgp); } ?> ----------------------------------------------------------------------- What could be the problem here? Please help me....I've been trying to this for 2days now. Can somebody provide me with his/her own source code to help me. thank you
  10. [!--quoteo(post=370487:date=May 2 2006, 01:15 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 2 2006, 01:15 AM) [snapback]370487[/snapback][/div][div class=\'quotemain\'][!--quotec--] What do you mean by auto-delete code you explain a but more about what you are trying to do. [/quote] I have a events table that stores all the event per school. They way me to have a facility that will provide for an auto-delete in respect of advertisement of events exceeding 3 months publication time. So, I need someone to help with tutorial or a code to do this. I hope Im clear.
  11. Hi All Im very new in php. Can somebody send me the link of website where I could get the tutorial that will help me to understand on how to code the Auto-delete code in php? Your help is highly appreciated. thank you :)
  12. Hi All I'm new in PhP & Mysql. I want to upload a file(word document, excel, pfd) to a website. So, I would like my users to be able to get the url to that file and be able to download the file or save the file. I have written this code for uploading: <?php session_start();?> <?php //If (empty($_SESSION['svarticleid'])) { // header("Location: login.php"); //} ?> <?php //open connection to the database require_once('inc_conn.php'); // prepare query //$sql="SELECT emdc.emdcno, policies.emdcno FROM policies, emdc WHERE policies.emdcno = emdc.emdcno AND emdc.emdcname = '".$emdcname."'"; $sql="SELECT emdcno, emdcname FROM emdc;"; //execute sql statements $rsemdcno = mysql_query($sql, $connimgp) or die(mysql_error()); //retrieve one row of records $rows_rsemdcno = mysql_fetch_array($rsemdcno); //determine the number of records in recordset $num_rows = mysql_num_rows($rsemdcno); ?> <?php //check if button clicked if (isset($_POST['btnsubmit'])) { //Grab form variables and assign to the user defined variables $articletitle=$_POST["title"]; $articledescrip=$_POST["discription"]; $articleurl=$_POST["userfile"]; $emdcno=$_POST["emdc"]; $date=date("Y-m-d"); //Open connection require_once('inc_conn.php'); //insert into the database $insertSQL ="INSERT INTO articlesresearch(articleid, articletitle, articledescrip, articleurl, emdcno, sdatetime) VALUES ('$articleid', '$articletitle', '$articledescrip', '$articleurl', '$emdcno', '$date')"; //execute the insert statement $execute = mysql_query($insertSQL, $connimgp) or die(mysql_error()); //redirect to viewarticles If ($execute) { mysql_close($connimgp); header("Location: viewarticle.php"); } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <table width="720" height="600" border="1" cellpadding="2" cellspacing="0"> <?php require_once("inc_header.php");?> <tr> <?php require_once("inc_menu.php");?> <td width="536" height="300" valign="top"> <?php require_once("inc_adminmenu.php");?> <p class="headings" align="center">[Articles and Research] </p> <form name="form1" method="post" action=""> <table width="536" border="0" cellspacing="0" cellpadding="2"> <?php // if (isset($_REQUEST["signin"])){?> <tr> <td colspan="2"><p align="center">You need to logged in!<br> Login</p> </td> </tr> <?php // }?> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td width="156"><div align="right">Title</div></td> <td width="366"><input name="title" type="text" id="title"></td> </tr> <tr> <td><div align="right">Description</div></td> <td> <textarea name="discription" id="discription"></textarea></td></tr> <tr> <td><div align="right">Url</div></td> <td><input name="userfile" type="file"></td> </tr> <tr> <td><div align="right">EMDC</div></td> <td> <select name="emdcno"> <option value="">Select Emdc</option> <?php do { ?> <option value=""><?php echo $rows_rsemdcno['emdcno']; ?></option> <?php } while ($rows_rsemdcno = mysql_fetch_array($rsemdcno)); ?> </select></td> </tr> <tr> <td><div align="right">Date</div></td> <td><input name="date" type="text" id="date"></td> </tr> <tr> <td><div align="right"></div></td> <td><input name="btnsubmit" type="submit" id="btnsubmit" value="Submit"></td> </tr> <tr> <td><div align="right"></div></td> <td>&nbsp;</td> </tr> </table> </form> <p>&nbsp;</p></td> </tr> <?php require_once("inc_footer.php");?> </table> </body> </html> <?php //free results of recordset mysql_free_result($rsemdcno); //Close conn mysql_close($connimgp); ?> --------------------------------------------------- I have written this file for viewing all my uploads, but now I dont now how to call that url(file) to be able to view/download/save it. here is the code to view uploads: <?php session_start();?> <?php //connect to MySQL server and imgp require_once('inc_conn.php'); //execute sql $sql="select * from articlesresearch"; //execute sql statements $rsarticle = mysql_query($sql, $connimgp) or die(mysql_error()); //retrieve one row of records $rows_rsarticle = mysql_fetch_array($rsarticle); //determine the number of records in recordset $num_rows = mysql_num_rows($rsarticle); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <table width="720" height="600" border="1" cellpadding="2" cellspacing="0"> <?php require_once("inc_header.php");?> <tr> <?php require_once("inc_menu.php");?> <td width="536" height="300" valign="top"> <?php require_once("inc_adminmenu.php");?> <p class="headings" align="center">[Articles and Research] </p> <div style="overflow:auto;height:200px;margin:0px;"> <table width="536" border="1" bordercolor="" cellspacing="0" cellpadding="3"> <tr> <td width="184">Title</td> <td width="170">Discription</td> <td width="75">Date</td> <td width="77">&nbsp;</td> </tr> <?php do{ ?> <tr> <td><?php echo $rows_rsarticle['articletitle'];?></td> <td><?php echo $rows_rsarticle['articledescrip'];?></td> <td><?php echo $rows_rsarticle['sdatetime'];?></td> <td><a href="#" onClick="window.open('<?php echo $rows_rsarticle['articleurl'];?>', '', 'width=400,height=250,top=10,left=10,scroll=no,resize=no')">View</a></div></td> </tr> <?php }while($rows_rsarticle = mysql_fetch_array($rsarticle));?> </table> </div> <p><a href="addarticle.php">Add New Articles and Research</a> </p></td> </tr> <?php require_once("inc_footer.php");?> </table> </body> </html> <?php //free results of recordset mysql_free_result($rsarticle); //Close conn mysql_close($connimgp); ?> ------------------------------------------ can you ps help me on this. thank S
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.