Jump to content

i73

Members
  • Posts

    18
  • Joined

  • Last visited

i73's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hey guys I am Posting data over to a server file in Json and I need to know how I can add to the XML file. here is both codes. function validate() { $xml = simplexml_load_file("stock.xml"); $sxe = new SimpleXMLElement($xml->asXML()); for($i = 1; $i < 801; $i++) { $newItem->addChild("name" , "null"); } $sxe->asXML("stock.xml"); echo $sxe->asXML(); $response = $_POST; $response["items"] = "Test output"; $response["description"] = "test 42 "; $response["json"] = json_encode($response); echo json_encode($response); } The red text is what I want this json script to do. Do I have to return back to my form to add to the XML file? Can json add to a xml file on its own? Thanks for your time! have a good day!
  2. Thanks, yeah I realized as I fixed the problem.
  3. Hey guys I am trying to read my xml file and itterate through the list. I am having trouble. <?xml version="1.0" encoding="UTF-8"?> <stock> <itemPlace id="1"> <name>null</name> <image>null</image> <wholeSale>44</wholeSale> <retailPrice>null</retailPrice> <quantity>null</quantity> <location>null</location> <color>null</color> <size>null</size> <weight>null</weight> <description>null</description> <itemType>null</itemType> <date>null</date> </itemPlace> <itemPlace id="2"> <name>null</name> <image>null</image> <wholeSale>55</wholeSale> <retailPrice>null</retailPrice> <quantity>null</quantity> <location>null</location> <color>null</color> <size>null</size> <weight>null</weight> <description>null</description> <itemType>null</itemType> <date>null</date> </itemPlace> </stock> <?php $xml = simplexml_load_file('stock.xml'); foreach ($xml->xpath('itemPlace') as $eq) { echo "<p><a class='inline' href=\"#inline_content\"> {$eq->name}</a></p>"; echo '<br>'; echo " <div style='display:none'>"; echo " <div id='inline_content' style='padding:10px; background:#fff;'>"; echo " <p>"; echo " <strong>{$eq->wholeSale}</strong>"; echo "</div></div>"; Is there a way I can look up the object through the itemPlace id="#" and call out the parameters of the item? Like the name price, etc? I know how to mySQL query but not XML, and this is a project that needs to use xml... FML..I have been looking for a few hours so any help would be appreciated!
  4. Honestly man, thank you very much! have a good one! I would donate but I am a student!!!!
  5. Thank you josh, I just one last question. How would I go to the next page on the pagination? like from the 20 rows if I am on the page with 5 rows how would I get to the 6-11?
  6. I have never been the strongest with Arrays, I think its because I am all self taught. But I have a quick question. I have a ton of items in a table that I want to arrange by different variables and display accordingly to what the user chooses. Lets start with the basic, newest first to oldest. I know I use auto increment to find out what is the newest and oldest. Now how would I display that with a limit of 15 or 20 items? To me I don't understand how the "next" page would know that you were just at items 1-20 then the next page at 21-31 Also if I have missing vales in the auto increment 'lets say a person deletes their item' will this affect the display, If value 10 was missing will it only show 1-9-11-20 'so only 19 items on page one? Thanks for y our help! And sorry for being so retarded here...
  7. I got it! thanks for your help!!! $link = "http://www.youtube.com/watch?v=oHg5SJYRHA0&lololo"; $video_id = explode("?v=", $link); // For videos like http://www.youtube.com/watch?v=... if (empty($video_id[1])) $video_id = explode("/v/", $link); // For videos like http://www.youtube.com/watch/v/.. $video_id = explode("&", $video_id[1]); // Deleting any other params $video_id = $video_id[0];
  8. Lol, I have the user put in the youtube URL into a text box. Lets say it is, http://www.youtube.com/watch?v= J4o2vOdapms I need "v=#######" so the value of V . I will be dropping the www.youtube.com Is there a way to take that from the post script on the next php file? I know I cant use a $_post Would a $_get work some way? Well this site auto loads the V=#######
  9. Yeah, I have that. I have everything but this done. if (isset($_POST['submit'])){ $user_ip=$_SERVER['REMOTE_ADDR']; $video_name=$_POST['video_name']; *ect } I just need to know how to grab that variable V on this script. :/
  10. Yes! thank you, I was in a copy paste frenzy when I changed the type :/ But the code wont pass the variable "v" to the video.php script. is there a way I can do that? I understand the concept of what you are saying there, I just don't see how it can just pass that variable over the post. I have been trying to do this all day :,(
  11. youtube.com/watch?v=vdasdwd I just need to pass the variable 'v' over to the post form <form id='upload' action='video.php' method='post' accept-charset='UTF-8'"> <fieldset class='textbox'> <input id='youtube_code' name='youtube_code' value='' type='youtube_code' placeholder='URL of youtube video' maxlength='100' style='background-color:#555;color:#000; width:50%;'> <input type="submit" name="submit" value="Submit"> </fieldset> </form> How could I do that on video.php is it like? $youtube_code=$_POST['youtube_code']; or $youtube_code=$_POST['v']; Thanks for your help!
  12. Your my fav! I thought I was doing something wrong with the two querys, I tried it without and still got the problem. It must have been my server not refreshing, yay! go gadaddy.....
  13. $video_query = mysql_query( "SELECT video_name FROM video"); $video_info = mysql_fetch_array($video_query); while($video_info=mysql_fetch_array($video_query)){ $video_name=$video_info['video_name']; } I don't know why but It wont print the first thing in the array...
  14. Oh yeah, lol user_name is going to change to video_name Thanks for your help!
  15. So? $video_info="SELECT `video_name` FROM `video`"; $video_info2=mysql_query(video_info) or die("could not select video directory"); $video_info3=mysql_fetch_array($video_info2); $video_name2=$video_info3['video_name']; would be best? and to be even more annoying, how would I do that in mysqli? would this be better than the above code? Also thanks for your help! $sql = "SELECT `user_name` FROM `user`"; $result = mysql_query($sql);
×
×
  • 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.