Jump to content

spangle1187

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by spangle1187

  1. Still comes back the same on the print_r
  2. I have removed the blank deceleration from the process login page but the print_r is still printing the same data: Array ( [username] => admin [email] => s.campbell@hud.ac.uk [ourdate] => 06/24/2011 [booking] => ) I guess the problem then lies with when I am trying to assign the $data variable to it so maybe on these two lines: $data = "You have successfuly made a booking for '$name' in room '$room' on the '$newDate' for the following times '$start_Time' to '$end_Time'"; or $_SESSION['booking'] = $data;
  3. No I give it the value then try to call it on the next page with: <?php echo $_SESSION['booking'];?>
  4. Sorry it did print out some data Array ( [username] => admin => s.campbell@hud.ac.uk [ourdate] => 06/24/2011 [booking] => )
  5. In my project once I have processed a booking I am trying to get a summary of the booking to display on the successful booking page, so far I have added an extra $_SESSION data to the page that processes the users login: session_start(); $_SESSION['username'] = $username; $_SESSION['email'] = mysql_result($result, 0); $_SESSION['ourdate'] = date('m/d/Y'); $_SESSION['booking']; The bottom line is for the booking summary. On the process booking page I have added: $data = "You have successfully made a booking for '$name' in room '$room' on the '$newDate' for the following times '$start_Time' to '$end_Time'"; It is here that I try to assign the above to the $_SESSION: $_SESSION['booking'] = $data; And then the site is directed to the booking success page: header("Location: http://webdev/schools/hhs/psy_bookings/process_booking_success.php"); //booking success page But when I get to the booking success page nothing is displayed, this is the code that I have used to display the booing summary: <div id="wholepage"> <?php echo $_SESSION['booking'];?> </div> Can you please help?, the data is not in a form so that is why I have not used the $_POST option
  6. Hi, I have two drop down lists both populated with times starting from 8.15 through to 18:15. What I would like to do is have the second list always in front of the first for example the time slots are 15 mins so, if the first list is at 8:15 the second should be at 8:30 and if the user changes the first list to 13:00 the second list will change to 13:15, can you please help me achieve this?
  7. I have amended the sql so that it now checks for the date as part of the query but how can I check to see if it brings back an empty result?
  8. Just been looking at my code and how would that work as if the time matches then the user will have to make another booking enquiry. if I pull that as part of my query will it not just pull a blank query rather then throwing an error?
  9. I had not thought of it that way round
  10. Sorry I mean times, I am wanting to look through the query to see if the time matches any held in the database not dates!
  11. I am trying to loop through the array that I have created to check to see if any of the dates in the array match the date I am passing (which is todays date) and then asks the user to consider making another booking. This is what I have so far but I am not sure how to finish it off: $table_id = 'booking'; $query = "SELECT * FROM booking WHERE bookingDate = 'newDate'"; $result = mysql_query($query); $loop = $end_Time - $start_Time; echo $loop; while($row = mysql_fetch_assoc($result)){ if ($startTime || $end_Time == 'booking.startTime'){ echo "choose another booking"; }{ echo "booking is ok"; }
  12. The user fills in a search form containing four input boxes and four check boxes. The four check boxes are used to specify which elements the user wants to use to query the db: 1. client name 2. Room 3. Subject 4. Date The start search button attached to the from calls run_search.php and the information is retrieved using $_POST. Each of the four above can be used as a combination or as an independent search, my first though was to use an if statement based on the check box values: if ($clientValue == "on"){ echo "perform a search based on above"; } but the problem is if the first check box is ticked the the if statement will only run the first part of the statement as the condition has been met. What can I use to search through the results to pick out the combination of the search? I have tried using an array but not sure if this is right? $box=$_POST['box']; while (list ($key,$val) = @each ($box)) { echo "$val,"; } The results will then be passed into an sql query and replace the variable $input and $string to complete the query. $input = "Sam"; $string = "clientName == ".'"'.$input.'"'; $table_id = 'booking'; $query ="SELECT * FROM booking WHERE ". $string; //$test = mysql_query($query); echo $query; I hope this explains my problem a little better, thanks [attachment deleted by admin]
  13. I have four check boxes that will determine how a search is conducted and I have retrieved the data through _POST[] The problem I have is how can I act upon the data returned? Each of the four text boxes could independently start a search but if I use an If statement the first choice will block the rest of the options eg. if ($clientValue == "on"){ echo "perform a search based on above"; }
  14. I have echoed the $query string and I was missing data so have reassembled the order: $input = "Sam"; $string = "clientName == '$input'"; $table_id = 'booking'; $query ="SELECT * FROM booking WHERE. '$string' "; $test = mysql_query($query); echo $query; and this is now showing the following for the $query string: SELECT * FROM booking WHERE. 'clientName == 'Sam'' which is correct but I still have a warning associated with $test = mysql_query($query); so this is where I will look now
  15. I am trying to pass in a $string variable into my query like so but it is returning a warning: $string = "clientName == '$input'"; $input = "Sam"; $table_id = 'booking'; $query ="SELECT * FROM booking WHERE. '$string' "; $test = mysql_query($query); echo $test;
  16. I will start with what I have and what little I know (and please do point out anything that you think is incorrect or poorly structured): The overall goal is that upon page load my php webpage will fire a sql_query to a MySQL db from which the php will generate an xml document within the php page using xmlDom. The xml data will then be read by ActionScript 3 to enable Flash to draw a visual representation of what is in the db. I have a php webpage that is linked to a MySQL db, using an xmlDom I have created an xml document that sits inside the php page. I have used xmlDom over simpleXML as the xmlDom library and construct looks more powerful and I want to create xml not just read the nodes and handle the data. There is one element that I can’t seem to shake and this is causing me to think that I have constructed the xmlDom wrong and that is it only works if I echo the xml to the screen. This is the code for the php webpage: <?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 = $root->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(); //print $xml_string; mysql_free_result($room1); ?> I also have a Flash document to which I have added an urlloader to read xml documents and hopefully read the xml generated by the php page. This is the code for the Flash file. var xmlLoader:URLLoader = new URLLoader(); var xmlData:XML = new XML(); xmlLoader.addEventListener(Event.COMPLETE, LoadXML); xmlLoader.load(new URLRequest("booking.xml")); function LoadXML(e:Event):void { xmlData = new XML(e.target.data); trace(xmlData); dynamictxt.text = xmlData; } The problem I am having now is getting them to work together! The urlloader file in Flash works fine with a test xml document but the xml generated in the php page does not have a name and I do not require it to print to the screen? How can I marry these two together? I have not tried to give the xml document a name but if I remove the echo or print the xml file is not generated. Thank you for reading my long post and even more so if you have solution or a nudge!
  17. I am enjoying learning php even when I scream at the screen and its amazing how you guys and girls spot minor syntax errors at fifty feet and you all seem to know at least three different possible solutions to the same problem
  18. Is there a way that I can tweak the following code so that the root nodes have different names? At the moment the xml file is creating a root node for each booking called booking so when I take the xml into flash it is calling it badly formed xml due to the repitition of <booking></booking> //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); ?>
  19. I was working on a similar pfoject getting users to sign up and sign a quick verification to the db and then some session data created and so forth. I followed a tutorial on The New Boston, its under php tutorials andhe is creating a game that requires a login procedure. It may well be worth a look.
  20. My misunderstanding, the client in this case is loading a php page that upon loading runs an sql_query to a MySQL DB that then displays a visual using Flash representation of this query. The client does not request to see the xml page and that is why I am trying not to echo the data to the screen. I was advised that ActionScript and Flash can read xml very well so that is why I am creating the xml page.
×
×
  • 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.