PHP - Creating An Xml Document That Does Not Print To The Screen
I have managed to retrieve an sql query and through php create an xml document, my next aim is to get this code into actionscript so that I can use the data in Flash. One problem I am experiencing is that in creating the xml document the data within xml nodes are echoed to the screen, I do not want them to be echoed to the screen just picked up by actionscript. Is there a way to created an xml document using php that does not print to the screen?
<?php include("php/dbconnect.php"); //connects to the database //sql_query $table_id = 'booking'; $query = "SELECT * FROM $table_id WHERE (booking.bookingDate = curDate()) AND roomID = 1 ORDER BY startTime"; $room1 = mysql_query($query); //create a new DOM document $doc = new DOMDocument('1.0'); //create root element $root = $doc->createElement('root'); $root = $doc->appendChild($root); //process one row at at time while($row = mysql_fetch_assoc($room1)){ //add node for each row $occ = $doc->createElement($table_id); $occ = $doc->appendChild($occ); //add achild for each field foreach ($row as $fieldname => $fieldvalue){ $child = $doc->createElement($fieldname); $child = $occ->appendChild($child); $value = $doc->createTextNode($fieldvalue); $value = $child->appendChild($value); } } $xml_string = $doc->saveXML(); echo $xml_string; mysql_free_result($room1); ?> Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=320005.0 Hi all, Im trying to create a splash screen that shows while my script executes in the background. The object is to display the screen while large files are being uploaded. Im looking for the best way of running a php script in the background ? thanx in advance scoob Code: [Select] $query ="SELECT oneID FROM table WHERE table.PersonID = 'game.PlayerA'" ; $result = mysql_query($query); $row = mysql_fetch_array($result); $oneID = $row[0]; [code] If I then echo "$oneID" why does it not print anything? $result echos resource7 Hello, How to customize print page in php ? I had a page, but I need to print it like an invoice look page. Thanks in advance Hello.
i am totally new to php and just started to learn now. i just dont understand why the following code is not printing the username that i enter on the page.
Please note that the code itself is saved with the name "basicForm.php".
Thanks.
<html> Hello.
The first page works, but when form actioning to the next i just get a white screen.
This is the white screen page:
<?php session_start(); include 'details.php'; $username = $_POST['username']; $password = $_POST['password']; $pwswdrd = md5($password); if(!empty($_POST['username'])) { $query = mysqli_query($con, "SELECT * FROM users where name = '$username' AND pass = '$pwswdrd'") or die(mysqli_connect_error()); $row = mysqli_fetch_array($query); if(!empty($row['name']) AND !empty($row['pass'])) { $_SESSION['username'] = $row['username']; $_SESSION['id'] = $row['id']; header('Location: index.php'); } } else { echo "You failed to log in."; } ?> - details.php <?php $one=mysqli_connect('.......webhost.com','aee','aaa') or die("Failed to connect to MySQL: " . mysqli_error() ); $db=mysqli_select_db($one,'aee') or die("Failed to connect to MySQL: " . mysqli_error() ); ?> -- What can possibly be wrong?! Hi, Im trying to work out a way to get the New York Lottery's Take 5 results. Theres a few sites that list the winning numbers, i assume automatically as there is alot of lottery games on these sites. what would be the best way to get this? http://www.myfreepost.com/lottery/index.php/us/newyorklottery/takefive/result/ http://www.elite-lottery-results.com/?action=view_game&gid=NY2 Ok, I know how to screen scrape, but I don't know how to screen scrape when there is a login. I've looked this up for awhile, but no luck. I'd like to also make it so I can execute a url when I am logged in on the script for the script, for an example execute this url: http://site.com/data.php?id=9912&submit=1 Thanks in advanced. Hi, I need some basic video capturing features. So I want to ask, is there any way, library or work-round for recording browser screen in a video file using PHP? Thanks in Advance. Hi, I want this output for an XML doc I create via DOM functions. <?xml version="1.0" ?> <letter> <to> <toFirstContact>Bob</toFirstContact> </to> </letter> BUT it outputs nothing to browser screen! Please see code below: Code: [Select] <?php //TEST for REPEAT APPENDAGE $aDoc=new DOMDocument(); $root=$aDoc->createElement("letter"); //create child elem to append to root elem node $newChild1=$aDoc->createElement("to"); //append new child elem <to> to root <letter> $root->appendChild($newChild1); //make elem<toFirstContact> and also create a text, then append to <to> $toFirstContactTag=$aDoc->createElement("toFirstContact"); $textNode1=$aDoc->createTextNode("Bob"); $toFirstContactTag->appendChild($textNode1); //now append new child <toFirstContact> to <to> $newChild1->appendChild($toFirstContactTag); print $aDoc->saveXML(); ?> Any help much appreciated! I have a login screen that only partly works if i put in the password and click submit it gives me a 500 internal server error. but if i put in the wrong password it gives me the wrong password screen. i am new to this and lost as to why it doesn't work any help would be appreciated. i am running on vista with iis7 and mysql. also this is some code i found online and changed it around to fit the new php 5.3.6 so not sure what i did or if i need to change more. Thank you in advance Ive tried <?php $file = file_get_contents('./time.php'); echo $file; ?> This just outputs the php, how can I make it just the out php output value. ty in advance. im using dom to tidy up my html but i wondering is there a way to format my html like so
<dl> <dd> <label>Condition :</label> <select name="condition"><option value="New">New</option> </dd> </dl>insead of <dl> <dd> <label>Condition :</label> <select name="condition"><option value="New">New</option> </dd> </dl>here is the php im using $dom = new DOMDocument(); $dom->loadHTML($this->_body); $dom->formatOutput = true; echo $dom->saveHTML();thank you I have the following code but I cannot get it to print the results of the array into my web page. Help would be so appreciated!! Code: [Select] $sql = "SELECT RegName, SireID, DamID FROM pedigrees WHERE ID="; $DoggieIDQ = $sql . $values["ID"]; $DoggieIDR = db_query($DoggieIDQ,$conn); $DoggieID = $_GET['ID']; $Depth = 1; $DepthLimit=8; function getParents($DoggieID, $Depth, $DepthLimit) { $Sire = getSire($DoggieID); $Dam = getDAM($DoggieID); $Depth++; if ($Depth == $DepthLimit) { return array($Sire, $Dam); } else { # Now get grandparents too $SireParents = getParents($Sire, $Depth, $DepthLimit); $DamParents = getParents($Dam, $Depth, $DepthLimit); return array($Sire, $Dam, $SireParents, $DamParents); } } This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=346728.0 Hi, What is the best way to print the local date and time, my website have customers from 4 or 5 countries. Saudi - UTC+3 Dubai - UTC+4 India - UTC+5.30 how to print the local time for them Thanks, Hi Guys I want to knw if its possible to send job to print with php. example, in my database I have a table called Letters which stores letters, while I loop through the table, I want to print each letter off, any examples available? Thank you Is there a way to dynamically print the url of a web page once it loads? If so, how? This is for metadata purposes. Thanks! hihi, so I have the following, except it goes all the way up to server 400. Is there a way to make it print after each echo? As it is right now it will not print the entire list until all 400 servers are done echo "Server 01: " . count($server01->listaccts()) . " / 130" . "<br />" ; echo "Server 02: " . count($server02->listaccts()) . " / 130" . "<br />" ; echo "Server 03: " . count($server03->listaccts()) . " / 130" . "<br />" ; echo "Server 04: " . count($server04->listaccts()) . " / 130" . "<br />" ; echo "Server 05: " . count($server05->listaccts()) . " / 130" . "<br />" ; echo "Server 06: " . count($server06->listaccts()) . " / 130" . "<br />" ; echo "Server 07: " . count($server07->listaccts()) . " / 130" . "<br />" ; echo "Server 08: " . count($server08->listaccts()) . " / 130" . "<br />" ; thanks! |