Jump to content

rogueblade

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by rogueblade

  1. Ok this is driving me nuts. Using Adobe Flex Builder 3. I have a PHP class file which is being called through ZendAMF and the problem is that some combination of Flex and Zend will not accept the php date method in any way shape or form. What happens is that I receive this RPC error: [RPC Fault faultString=Channel disconnected" faultCode="Client.Error.DeliveryInDoubt" faultDetail="Channel disconnected before an acknowledgement was received] My application works perfectly fine when there is nothing to do with retrieving the date from the server. Even if I do, the functions that involve the 'date' still send and retrieve data but Flex still fires the RPC error. The RPC error, I have discovered, ONLY occurs when I try to get the date stamp. Any of these results in the error: $today = date('Y-m-d'); $today = date(); $today = getdate(); Any of the above, whether declared at the beginning of the class file, in the __construct function or any function (declared as public or private) results in the error (even when not calling the variable $today anywhere): Any ideas?
  2. Hey guys I'm building a restaurant reservation system and I'm stuck. I have a data-grid in which I want to print all the restaurants tables that currently exist and display which ones already have a reservation. I don't know how or if it's possible in a MySQL query. In case the restaurant thing is confusing, I'll use a social networking site as an example: You can query to get all users You can query to get all users that are your friend I want both of those in one. I want to display all the users but indicate which ones are already my friends. Is this possible in one query?
  3. wow I figured it out. This always happens after taking over half an hour to post my problem, in taking such effort to try make it clear for the forums I figure it out. Mods can delete this haha.
  4. Hope this is the right board for this...... :-\ Hey guys I'm working on a school assignment in which I have to make a basic CRUD (create, read, update and delete) content management application using the Zend AMF framework in FLEX. Basically I create a mock database and have flex print the data from the database into a data-grid. I need to also have an add form, edit+update feature and delete feature. As of now I have FLEX printing all the database info into my data-grid and my add form works as well as my delete button. My problem is I cannot get the update function/query to work. You know: (UPDATE myTable SET valueName='".$variable."') What happens is I have it programmed so that when you click on any row in the data-grid, the information is printed back into the add form. Here you can change the values and hit the 'update button' (not the add button) to run the update query on the php file. So my mxml looks something like this: <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="{amfcall.getDatabase()}"> <mx:RemoteObject id="amfcall" destination="MyPHPclass" source="MyPHPclass" endpoint="http://localhost/FlexAMFCMSapplication/index.php" showBusyCursor="true" /> //My add form would be here <mx:Button label="Add" id="addbutton" click="senddata()"/> <mx:Button label="Delete" id="delbutton" click="deletedata()"/> <mx:Button label="Update" id="updatebutton" click="updateDatabase()"/> <mx:DataGrid id="dataTbl" dataProvider="{amfcall.getDatabase.lastResult}" editable="false" > <mx:columns> <mx:DataGridColumn headerText="Date" dataField="field_date" /> <mx:DataGridColumn headerText="Time" dataField="field_time" /> <mx:DataGridColumn headerText="Name" dataField="field_name" /> </mx:columns> </mx:DataGrid> <mx:Script> <![CDATA[ public function updateDatabase():void { amfcall.updateDatase(dataTbl.selectedItem.field_id); //I tired adding these: //amfcall.updateDatase(dataTbl.selectedItem.field_name); //amfcall.updateDatase(dataTbl.selectedItem.field_date); //amfcall.updateDatase(dataTbl.selectedItem.field_time); } ]]> </mx:Script> And my PHP like this: class MyPHPclass { public function updateDatabase($id=NULL,$name=NULL,$date=NULL,$time=NULL) { $update = "UPDATE tbl_example SET field_name='".$name."',field_date='".$date."',field_time='".$time."' WHERE field_id=".$id; $updateresult = mysql_query($update); } } So if that makes sense to anyone, what I'm wondering is how do I pass those three values; name, date and time to the PHP so they can be updated. I know my script in the mxml is passing the ID with this line amfcall.updateDatase(dataTbl.selectedItem.field_id); but I don't know if by passing the above it will take all the data relevant to that ID over. The delete function works like this (I'm showing it to show how the php receives the id from the mxml: public function deleteData($id=NULL) { $delete = "DELETE FROM tbl_example WHERE field_id=".$id; $deleteresult = mysql_query($delete); } and the actionscript it in my mxml that is used for the delete function is identical to the one I'm using for the update function: amfcall.deleteData(dataTbl.selectedItem.field_id); So basically I can send the ID over to the PHP but not other values along with it, in this case the date time and name. How can I send over these edited values so the update function actually updates them? I'm assuming my update function is wrong in either the mxml or the php or both.
  5. Hey guys. I'm used to building databases that don't change too frequently and have structures that are pretty common. For eg a music database; which would have multiple tables for categories like artists, tracks, albums etc. and your php would bring the necessary information together. But I want to build a restaurant reservation system for a school project and while scoping out the idea and functionality and what not I got to the stage where I need to sketch out my database structure. I realize this will be quite different in the sense that the database will be very active and dynamic, changing constantly on the fly with reservations being made, changed, and tables being added, moved, changed etc. So I'm wondering what sort of structure will my database need? Would I break it down like any other database and have a customer table, a tables table, a reservation table etc. Or would you just create a reservation table that would have all the necessary fields such as date, name, time, table, party size, notes etc thanks!
  6. Ok, I'm going to try what you're doing but my problem is that I don't think I can use the 'LIMIT' because your example of using the LIMIT feature is in the sql query, which is in my code here: <?php $listInfo = mysql_query($liststring); ?> as you can see I'm assigning my query to a variable and then using the variable later such as the example loop you gave me. $liststring is my query you can see in my original post. <?php $i = 0; while($row = mysql_fetch_array($listInfo)) { if ($i == 5){ break; } print "<li>".$row['data_title']." ".$row['data_date']."</li>"; $i++; } ?> I have tried but don't think I can use the LIMIT like this: <?php while($row = mysql_fetch_array($listInfo."LIMIT 50".)) ?> Is it possible to put the LIMIT in my while statement so I don't need to use that loop and then I can attempt this print a certain # of items per page
  7. ahh perfect again! that break is interesting its like half a loop function and half a switch statement from AS3. So what I want to know next (I'm not asking for code just a concept/explanation) is how hard/doable is code that will print the first 5 items from my table and then print the next 5 in a separate location such as a second page. I guess an example would be a forum: Page one print 50 topics. Once 50 have been printed, create second page and print next 50, and so on. Or maybe: Page one print topics 0 to 49. Page 2 print topics 50 to 100 and so on. I'm assuming I can no longer print into the same page to achieve this?
  8. Ok so my next question, this code prints all the data in my table for title and date. I would like a loop that only prints up to the first 5 items: <?php while($row = mysql_fetch_array($listInfo)) { print "<li>".$row['data_title']." ".$row['data_date']."</li>"; } ?> I tried: <?php $i=0; do { $i++; while($i = mysql_fetch_array($listInfo)) { print "<li>".$i['data_title']." ".$i['data_date']."</li>"; } } while ($i<5); ?> and <?php $i=0; do { $i++; print "<li>".$row['data_title']." ".$row['data_date']."</li>"; } while { ($row = mysql_fetch_array($listInfo)<$i) } ?> Not that I expected either of those to work but just to show you an idea of what I'm trying to achieve. I;m not sure if I need a for loop or while loop or what.
  9. awesome thank you!! another related question to come soon
  10. Hey guys, quite a noob with php, currently doing an assignment for school and would like to have links on a page and clicking each link will print dynamic content into the page based on an sql query so for example, this is the way im using the code but it does not work. <a href="<?php print "index.php?Link1"; ?>">Link 1</a> <a href="<?php print "index.php?Link2"; ?>">Link 2</a> <a href="<?php print "index.php?Link3"; ?>">Link 4</a> <a href="<?php print "index.php?Link4"; ?>">Link 4</a> <?php if ($_GET['Link1'] !=NULL) { $liststring = "SELECT * FROM tbl_data WHERE data_color='green'"; } else if ($_GET['Link2'] !=NULL) { $liststring = "SELECT * FROM tbl_data WHERE data_color='red'"; } else if ($_GET['Link3'] !=NULL) { $liststring = "SELECT * FROM tbl_data WHERE data_color='blue'"; } else { $liststring = "SELECT * FROM tbl_data WHERE data_color='black'"; $listInfo = mysql_query($liststring); ?> <?php while($row = mysql_fetch_array($listInfo)) { print "<li>".$row['data_title']." ".$row['data_date']."</li>"; } ?> Only my else statement works as its not looking for $_GET variable So index.php is successfully printing all fields from tbl_data where data_color is black. But clicking any of the links results in the page just printing tbl_data where data_color is black. No errors
×
×
  • 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.