Jump to content

mona

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by mona

  1. hi, I tried to read and display a word document using the following style: $fo = fopen('somefile.doc', 'r'); $read = fread($fo, filesize('somedoc.doc')); fclose($fo); echo $read;Also I tried another one $read = file_get_contents('somedoc.doc'); echo $read; both ways are working in the localhost way, that is using my own apache and php on my laptop especially that the doc files are already saved on my computer.but in my case, I took my files and put them on another server (not localhost) and I tried to access the website from my computer, all my project is working except the reading of files, why?Is it because the files are not saved on the server and they are saved on my computer?Is there a way to open and read these files from the server?
  2. I think there is a problem in the quotations: try to put $row['act_num'] in another variable like $actand then write the query as follows:mysql_query("INSERT INTO users SELECT username, password, regdate, email, location, show_email, last_login, rank, army_species, game_rank, FROM unactivated_users WHERE act_num = '".$act."'")or die("ERROR IN INSERT!!");because you are using the simple quotation twice which may make a problem,i hope that it helps
  3. mona

    decimals

    to round you can use the round function, see the php manualhttp://us2.php.net/manual/en/function.round.phpyou'll need something like: round($answer1,2);if u want to remove the quotations simply you have to concatenate the string and in php the concatenation is as follows:echo "hi ". $name. ", how r u?";so u need to close the quotations then add dots before and after the string
  4. I have a question , I tried a simple example for html link inside php fileI have a file called file1.txt inside C:\I put the following lines in a file and named it myfile.html<html><a href='C:\file1.txt'> open file</a></html>here the link works and the file opens upon clickingif the same file I named it myfile.php and tried to run it using apache localhosthere when you click the link, nothing happen and the file didn't openwhy??knowing that if we put any website link it works , but if we put any file inside our computer it doesn't work.also, knowing that php is working very well on my computer
  5. Iam doing a project using php and mysql, in my project I had a list of students' information saved in a database, Iam trying to put all the information in html table, so I got the data from database and display them in an html table. the problem is that the data is too large and I want to divide it into more than one page where each page has about 10 students. and on clicking next the other page comes.how can I do that in php, I don't need a code I need the way to do that, that is under the next button or link where should I submit the page number or etc.. and can i do them all on the same php file.
  6. mona

    special string problem

    Actually I know how to work with databases, i only wanted the string functions that you gave me.thanks for your help, i'll try them and I think they'll help me
  7. hi, I'm doing a project using php and mysqli'm trying to allow the user enter a certain message inside a message box (very similar to this message box I'm writing in) and the user may write html tags inside message or php or any characters and double and simple quotesHow can I read his message ( as string) to be sent to mysql to be saved there and then view it again as it.i tried mysql_real_escape_string but it doesn't make any changes and if the user writes these characters ", <, ', \,/ it omits them.what should I do
  8. mona

    Modifying xml file

    I have an xml file and I'm displaying it using xsl filethis xml file contains information like username, password,..etcI want to allow the user change his password, I need help to find a way to update the xml file and save it on the same fileIf it is possible using xslt, how can I make that?
  9. I have two xml and xsl filesupon clicking a button I move from one xsl file to anotherhow can I pass values from one xsl to another to use them there?
  10. hi, I have a problem, I have the below code where the table and href shold be inside javascript using document.writeif I put onclick="..." inside the <a > It's not working and I have eror on page after clickingwhat is the problem? <html><head><script language="JavaScript">function submitting(forum){document.write(forum) //this is only a test}function loading(){var xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.load("forums.xml"); var doc=xmlDoc.documentElement; for(var i=0; i<doc.childNodes.length; i++) display(doc.childNodes(i));}function display(cat){document.write('<a name="top"></a><TABLE cellspacing="1" width="100%" bgcolor="#99ccff" border="2" ><TR><TH bgcolor="#ffff99" COLSPAN="3" ALIGN="LEFT">'+cat.getAttribute("NAME")+'</TH></TR>');document.write('<TR bgcolor="#33cccc" ><TD width="80%">Forum</TD><TD width="10%">Topics</TD><TD width="10%">Replies</TD></TR>');for(var j=0;j<cat.childNodes.length;j++){var node=cat.childNodes(j);document.write('<TR><TD><a href="#top" onclick="submitting(\''+node.childNodes(0).firstChild.text+'\')">'+node.childNodes(0).firstChild.text+'</a><br><FONT COLOR="GRAY">'+node.childNodes(1).firstChild.text+'</FONT></TD><TD>'+node.childNodes(2).firstChild.text+'</TD><TD>'+node.childNodes(3).firstChild.text+'</TD></TR>');}document.write('</TABLE>');}</script></head><body onload="loading()"><form name='forums' action='posts.php' method='post'><input type='hidden' name='forum'/></form></body></html>but if I tried alert instead of submitting it works:
  11. mona

    sending email problem

    till now It doesn't work with me,'If you know the solution , let me begin from the first and tell me what should I do/pleaseeeeeeee
  12. hi, I have a problem to use the css style inside the java script:I am using style inside my code as follows:<html><head><title>LTU Computer Science Forum</title><style type="text/css">TABLE,TR,TD{ background: transparent; color: #ff00cc; background-color: #000000;}TABLE{ width: 100%; }</style><script language="JavaScript">function loading(){document.write('<img src="LTULogo.jpg" width="974" height="72"/>');var xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async="false"; xmlDoc.load("forums.xml"); var doc=xmlDoc.documentElement; for(var i=0; i<doc.childNodes.length; i++) display(doc.childNodes(i));}function display(cat){document.write('<TABLE cellspacing="1" ><TR><TH COLSPAN="3">'+cat.getAttribute("NAME")+'</TH></TR>');document.write('<TR><TD>Forum</TD><TD>Topics</TD><TD>Replies</TD></TR>');for(var j=0;j<cat.childNodes.length;j++){var node=cat.childNodes(j);document.write('<TR><TD>'+node.childNodes(0).firstChild.text+'<br>'+node.childNodes(1).firstChild.text+'</TD><TD>'+node.childNodes(2).firstChild.text+'</TD><TD>'+node.childNodes(3).firstChild.text+'</TD></TR>');}document.write('</TABLE>');}</script></head><body onload="loading()"></body></html>since I'm using xml Dom so I'm obliged to put the table inside the javascript,this thing makes the style not working for the tableDoes any body know why and how to make it working?
  13. mona

    sending email problem

    I faced the following error while trying to send an email using php:my php file is as follows:<?php$to=$_POST["email"];$password=$_POST["password"];$login=$_POST["login"];$msg="Your login and password are as follows: login Id:".$login." Password:" .$password; $from = "From: xxx@xxx.xxx<br>";if( mail ( $to, "login information", $msg, $from )) { echo "Your password was successfully sent to you<br>"; } else echo "Could not sent you an email with there password!"; ?>the error is as follows:Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache Group\Apache2\htdocs\xml forum project\password.php on line 9As I find I should have a local mail server on my laptop to do that:I downloaded a mail server called: Argosoft mail server and it is installed on my computerwhat should I do to make it workwhat changes should I do to my php.ini file please help!
  14. mona

    Manipulate xml files

    thank u I'm already learning xsl
  15. mona

    Manipulate xml files

    I don't need to save in database using xslt, I can use php but my question is how to manipulate xml files by adding to them and searching inside them using xslt
  16. mona

    Manipulate xml files

    I'm trying to save some data in xml files and other data in database(mysql).I'm using php to manipulate my data that are saved in database. I need to know which is the best way to use in my case to manipulate the data in xml files ( extract them by elements and attributes, edit them ,traversinng nodes and searching for a certain node contents inside them..etc)Is it easy to use xslt for these purposes?knowing that some data will be extracted from xml files and saved to the database.
  17. mona

    mysql_num_rows()

    I'm trying to transfer my work ( a project using mysql and php) into another servermy project is working successfully on my computer where I'm using php5,on the server they are using php 4after running on the server this problem appears:mysql_num_rows(): supplied argument is not a valid MySQL resultAs I know this function works on php3, php4 and php5 so what is the problemknowing that it is working on my laptop.here is the piece of code where I'm using this function:$array=split("\\\\",$_POST["newsql"]);$newsql=implode('',$array);executing($newsql,$db);..this is the function:function executing($sql,$db){$result=mysql_query($sql,$db);if(mysql_num_rows($result))....
  18. mona

    xml dom question

    I'm trying to use the xml dom to edit the xml document, I found some functions that add new element, add new node text, update the elements values and attributes value, this is nice, but the problem is that how can I save them again in the xml file.you can see the example below,this example add a new element in the xml file (note.xml) but it display the file before and after:I need to save it after editing it, does anyone has an idea.also Is there a way to edit the file using php or xsl ?<html><head><script type="text/javascript">var xmlDocfunction loadXML(){if (window.ActiveXObject) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("note.xml"); getmessage() }}function getmessage(){document.write("The original XML:");document.write("<xmp>" + xmlDoc.xml + "</xmp>");var newnode=xmlDoc.createElement("new element");xmlDoc.documentElement.appendChild(newnode);document.write("After appending the new node:");document.write("<xmp>" + xmlDoc.xml + "</xmp>");}</script></head><body onload="loadXML()"></body></html>
  19. mona

    mysql problem

    hi, I'm doing a project on my laptop and my professor asked me to put my stuff on a certain server related to the university, when I did that I saw that my stuff is working there but the problem of foreign key constraint appears,on my laptop I'm using mysql 4.1 , on the server they told me that they are using mysql 4actually, on my mysql you can't delete a record if it's key is used by another table, they told you that it is a foreign key constraintbut on the server you can delete the record although it's key is used as a foreign key in other tables record which is wrong.Is this a problem in mysql version or what.and can I change something to solve it.
  20. mona

    File List

    hi, just trying something
  21. hi,I want to make a project using mysql, php and xml with apache2 as a web serveractually I did a similar project but using html instead of xml now we are learning xml and some xsl in our course and our professor need us to use xml inside our projectthe problem is that I don't know how to begin.in the last project, I created my database and tables in mysql, then I used html to make the web pages then I used php as a serverside application to work with the data.here I made my database, but as you know html is not the same as xml so I don't know how to begin and the professor doesn't matter if we use xml in all the project or in part of it.the real problem is that I know that php works with xml and php works with mysql but how these 3 works together I need some help or a small example to see.
  22. I know that databases cannot be replaced by xml , and that they are complement to each other but I want to know if there are some cases or small applications where we need database but we can replace that by using xml only. If there is such cases please give me a small idea about that and what kind of applications can be done like that?..
  23. mona

    xml writing and project

    do u mean by server side apache for example, if apache works I'm ready to use it because I already did a project with mysql, apache and phpfor example can I do something like that in xml , apache and xsl or other?
×
×
  • Create New...