Jump to content

DangerM0use

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DangerM0use's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi all. I'm just wondering what ways there are to open up another HTML/PHP page without using text hyperlinks. Thanks
  2. Hi all. I'm struggling with something and I hope that someone can help. Basically, what I need to do is create a page, that when loaded runs a PHP script. The result of this PHP script basically joins two tables together. I have done that and it works OK. But, what I need to do after that is display this data in an XML document. I have this partly created, but, no data is being displayed. I believe this is because I have no elements declared. The fieldnames from the tables are to be used to name the containing in the XML document. This is the code that I have in the PHP page; # opens the file xyz.xml for writing $handle=fopen("xyz.xml","w"); # writes the header to the xml file fwrite($handle,'<?xml version = "1.0" encoding="UTF-8" standalone="yes"?>'); # puts a space in the file fwrite($handle,"\n"); /*Remove these quote marks once CSS is created # writes the stylesheet code to the xml file fwrite($handle,'<?xml-stylesheet type="text/xsl" href="xyz.xsl"?>'); */ # puts a space in the the next line fwrite($handle,"\n"); # opens the tag 'data collection' that is used to signify the beginning of the data collection from the SQl tables that # will be put in the xml file and uses the XSL stylesheet to view it in a browser correctly fwrite($handle,"<getdata>"); # the SQL query to get the data from the database while ($newrow=mysql_fetch_row($result)) { # writes the opening tag 'data' that shows the beginning of the data got from the sql tables fwrite ($handle,"<data>\n"); # counts number of lines in the data for($i=0;$i<$num;$i++){ # writes the fieldnames fwrite ($handle,"<$fieldnames[$i]>$newrow[$i]</$fieldnames[$i]>"); } # counts the fieldnames for($i=$num;$i<count($fieldnames);$i++){ # writes the fieldnames fwrite ($handle,"<$fieldnames[$i]>$newrow[$i]</$fieldnames[$i]>"); } # writes the 'data' closing tags fwrite ($handle,"</data>\n"); } # writes the closing 'data collection' fwrite($handle,"</getdata>"); From this when I run the .php page and then go to the xml page I get the following; <getdata> <data> </data> <data> </data> <data> </data> etc </getdata> So, where am I going wrong. Where do I put the tables fieldnames in so that it links to the information that is brought from the earlier php query?
  3. Can anybody give me any info??
  4. Hello all. I'm just wondering what the best practise for this code is. I have several queries and I don't know whether it is best to have a seperate query for each one or to have one main query. Here is the code; $file=file_get_contents("mydata.txt"); //read entire file into a string $query=explode(";",$file); //breaks the sting into an array foreach($query as $value) { //loops through the SQL statements mysql_query($value); //execute the statements } mysql_query('update wes_ica_8 SET sss = (sss * 0.90)'); //change the value of column sss - decreasing by 10% $query = "select * from wes_ica_8 LEFT JOIN wes_tut_f ON wes_ica_8.id = wes_tut_f.id"; $result = mysql_query($query); while ( $row = mysql_fetch_array($result)) { extract($row); echo"$id: $dinosaur: $id: $fat<br>)"; } mysql_close(); //close SQL connection echo "DONE"; //confirmation text Thanks
  5. Does anyone feel they will be able to help?
  6. Here is the original assignment. I've edited it so it only contains the need to know bits [attachment deleted by admin]
  7. Don't think I'd be able to post it, there's a lot of text with it. And the going rate, not too sure but i don't think it's a brilliant amount!!
  8. Hello all. I am a university student that is taking a web scripting course, with a piece of coursework that I have just failed, miserably I might add. I have the resit due in for December, which I haven't yet got but am expecting soon. I am looking for someone that is willing to help me go through the original piece of coursework that I had and help me understand it better. I think that is mainly trying to understand what my lecturer was looking for me to deliver. The coursework is basically wanting 4 pages that incorporate PHP/SQL, Javascript and XML. Please please please someone help me go through the original piece of work so I am better prepared and have more chance of passing the resit in December. Please let me know. Thanks
  9. I have a sales table and I need to make a query that takes the initial sale price and the last sale price. Now normally what I would do is a query that took the first sales_# and the last sales_# to do this. The problem is that the product may not be sold everytime - it may be withdrawn from sale and those details are kept in the same table. Is it possible to do a query that gets the first sales_# that has a sales_price or am I going to have to look again at how I have created my table? Cheers for your time and any help!
  10. I am using identity so that everytime a new entry is entered into the db it automatially chooses the next available number Type_# int not null identity(1,1), I am just wondering if it is a good idea to have a constraint as well to make sure the number is in a set limit, so for example; constraint Type_# check (Type_# between '000000' and '999999'), Cheers
  11. Does no one know how to create a date field in MS SQL?
  12. Hi all, I know this is probably a very very simple question with an even simpler answer, but to me this is causing some problems. I need to create a date_of_birth field in one of my tables in my database where an artists date of birth can be entered. For some reason I can't use date and from what I have read it's because MSSQL does it differently. What is the best way to have a date field in a table? All I want is a date, no times etc. Cheers
  13. I've already designed and created all of the database, I am now going through it again trying to get a few extra marks here and there. One of the bits I am looking at again is the bio_location field in the Artist table. I want this to only allow web addresses in and not sure what the best way to do this is
  14. I use SQL Query Analyzer, this is connected to my database so any queries are run and then executed and effect the database. I can check what tables have been created using SQL Server Enteprise Manager. But currently there is nothing to display the data with other than that as this is just a database module and we are not required to do anything other than create the database
  15. SQL and no there is no actual form. The database has to be created for an imaginary website that isn't actually there
×
×
  • 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.