PHP - Parse Qif File
How can I parse this QIF file using PHP? I would like each line to be stored in a variable for each "set" of charges (delimiter is the record separator ^). Thanks!
!Type:Bank D03/03/10 T-379.00 PCITY OF SPRINGFIELD ^ D03/04/10 T-20.28 PYOUR LOCAL SUPERMARKET ^ D03/03/10 T-421.35 PSPRINGFIELD WATER UTILITY ^ Similar TutorialsHei there. I have this in file.log Code: [Select] L 02/10/2012 - 15:50:56: Log file started (file "cstrike\addons\amxmodx\logs\ban_history.log") (game "cstrike") (amx "1.8.1.3746") L 02/10/2012 - 15:03:38: ABC <STEAM_ID_LAN> banned User1 <284.121.146.100> || Reason: "Reason 1" || Ban Length: 1 minute L 02/10/2012 - 15:17:24: Ban time is up for: User1 [284.121.146.100] L 02/10/2012 - 15:17:39: DEF <STEAM_ID_LAN> banned User2 <234.151.143.110> || Reason: "Reason 2" || Ban Length: 1 minute L 02/10/2012 - 15:18:39: Ban time is up for: User2 [234.151.143.110] And I want to show in page only: Code: [Select] ABC - User 1 <284.121.146.100> - Reason 1 - 1 minute DEF - User 2 <234.151.143.110> - Reason 2 - 1 minute How can I do this? Thanks. I am new to PHP's SimpleXML. The original version of this question was derived from he OSM Data parsing to get the nodes with child I am thankful that hakre offered a great example in the comments that makes a overwhelming starting point for my project. Below I have added my own answer to the question, how to refine the code to ad more tags. I want to filter the data to get the nodes with special category. Here is sample of the OSM data I want to get the whole schools within an area. The first script runs well - but now I want to refine the search and add more tags. I want to store all into MySQL. So we need to make some XML parsing with PHP: The following is a little OSM Overpass API example with PHP SimpleXM <?php /** * OSM Overpass API with PHP SimpleXML / XPath * * PHP Version: 5.4 - Can be back-ported to 5.3 by using 5.3 Array-Syntax (not PHP 5.4's square brackets) */ // // 1.) Query an OSM Overpass API Endpoint // $query = 'node ["addr:postcode"~"RM12"] (51.5557914,0.2118915,51.5673083,0.2369398)->.point; ( node (around.point:100000) ["amenity"~"school"]; way (around.point:100000) ["amenity"~"school"]; ); out;'; $context = stream_context_create(['http' => [ 'method' => 'POST', 'header' => ['Content-Type: application/x-www-form-urlencoded'], 'content' => 'data=' . urlencode($query), ]]); # please do not stress this service, this example is for demonstration purposes only. $endpoint = 'http://overpass-api.de/api/interpreter'; libxml_set_streams_context($context); $start = microtime(true); $result = simplexml_load_file($endpoint); printf("Query returned %2\$d node(s) and took %1\$.5f seconds.\n\n", microtime(true) - $start, count($result->node)); // // 2.) Work with the XML Result // # get all school nodes with xpath $xpath = '//node[tag[@k = "amenity" and @v = "school"]]'; $schools = $result->xpath($xpath); printf("%d School(s) found:\n", count($schools)); foreach ($schools as $index => $school) { # Get the name of the school (if any), again with xpath list($name) = $school->xpath('tag[@k = "name"]/@v') + ['(unnamed)']; printf("#%02d: ID:%' -10s [%s,%s] %s\n", $index, $school['id'], $school['lat'], $school['lon'], $name); } ?> how to get more out of it.. at least the adress and the website where to add those tags in the request`? in this line: list($name) = $school->xpath('tag[@k = "name"]/@v') + ['(unnamed)']; many thanks for any and all help!! I have stats log file I want to parse lines from. The lines I want to get a GET /xxxx/xxxx/xxxx/xxxx/xxx HTTP I am trying to get those lines and the regex works to get them but I cant figure out how to process the results I want to print out each match to the browser. Here is the php file I am using and the output it outputs is: Array ( ) Code: [Select] <?php $url = "filex"; $filepointer = fopen($url,"r"); if($filepointer){ while(!feof($filepointer)){ $buffer = fgets($filepointer,4096); $file .= $buffer; } fclose($filepointer); } else { die("Could not open file"); } $regexname = "/^GET(.*)HTTP/i"; preg_match_all('/^GET(.*)HTTP/i',$file,$match); $result = $match[1]; print_r($result) ; ?> Thanks in advance! Hello, Im trying to figure out how to create multidimensional array from xml file that looks like this: <root> <item> <name>name A</name> <category>category 1</name> <desc>desc A</desc> </item> <item> <name>name B</name> <category>category 1</name> <desc>desc B</desc> </item> <item> <name>name C</name> <category>category 2</name> <desc>desc C</desc> </item> </root> In the end i would like to get output that have items grouped under their categories, something like this: Category 1 name A desc A name B desc B Category 2 name C desc C
I have a clue on how to pull the data out of array but I cant figure out how to actually make it :) Any help or directions would be great, thanks!
I have a program which have written with c+ +. This program is a generic server stats program for all Silkroad versions. ( Silkroad = MMORPG game like WoW ). " So if you have a website, you can upload the file via FTP to your own directory and write a simple PHP script or ASP script to parse the file and display the results. Or, you can post the data via PHP via a web URL. " I need to make this what i write that write the results. This write the following data: Code: [Select] Server Id Server Name Current Players Max Players State (1 = open, 0 = check) For example: 2 220 Zeus 354 2500 1 221 Venus 539 2500 1 And save this data to any.txt file. Here is the site: http://www.error-soft.net/forum/prvsro.php u need to se the server stats : Server Name Players State Status Total Capacity 2059 / 6000 [34%] ZSZC(Fire) 0 / 2000 Empty Offline ZSZC (Water) 2059 / 2000 Full Online ZSZC (Retro) 0 / 2000 Empty Offline i have the program what check the server and write this information to text file, but i do not know how can i parse this information like this website. I have a Windows-style ini file that contains entries as such:
[Timers] Timer(1)=50 Timer(2)=30 Timer(3)=20 The entries represent an array of 3 different timers Apparently parse_ini_file can't deal with the () format. Is there any way to use this format ini file without having to change how arrays are designated? Hi guys i have this error, Parse error: syntax error, unexpected end of file in C:\wamp64\www\nigthclub\videos.php on line 103
but i know is probably easy to solve but for some reason i dont see the error. please help me <?php session_start(); ?> <?php error_reporting (E_ALL ^ E_NOTICE); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="style.css" rel="stylesheet" type="text/css" /> <link href="tablefiestas.css" rel="stylesheet" type="text/css" /> <title>La Taverna de Juan</title> </head> <body> <div id="container"> <div id="header"> <!--MENU BAR--> <?php include("includes/db.php"); ?> </div> <!--VIDEOS--> <?php $query = ("SELECT * from videos"); $result = mysqli_query($connection,$query); $num_per_page =05; ?> <table border="1" width="100%"> <tr> <td>Video Id</td> <td>Titulo</td> <td>Video</td> </tr> <tr> <?php while ($row=mysqli_fetch_assoc($result)) { $videoid = $row['videoid']; $titulo = $row['titulo']; $url_video = $row['url_video']; ?> <td><?php echo $videoid ?></td> <td><?php echo $titulo ?></td> <td><?php echo $url_video ?></td> </tr> <?php}?> </table> <?php $query = "SELECT * from videos"; $pr_result = mysqli_query($connection,$query); $totalrecord = mysqli_num_rows($pr_result); echo $totalrecord; ?> <br> <div id="footer"> <!--FOOTER--> <?php include("includes/footer.inc.php"); ?> </div> </div> </body> </html> Edited November 18, 2019 by Psycho Added code tags Hi, I got this form, but I dont want the form to be displayed if the user has run out of credits.
The page worked until I added the credit check and now I get this error
Parse error: syntax error, unexpected end of file in /Applications/XAMPP/xamppfiles/htdocs/other_items.php on line 269
I know this is because some } are missing, but whenever I move them about, it either doesnt work, or says there is no { to match the } with. Im really confused now and got another 2 pages to do this to, so really need to sort this one out.
Here is what I got
<?php include 'init.php'; include 'includes/overall/header.php'; include 'includes/logo.php'; if (!isset($_SESSION['loggedin'])) { die("You must be logged in to sell a item"); //this causes to script to stop executing and lets the user know there is a problem /* Note: instead of the die() function, you could use the echo() function and provide an HTML link back to the login page, or use the header() function to just redirect users to the login page without any message. It is up to you to decide what your application should behave. */ } //else { //logged in elseif (isset($_SESSION['loggedin']) ){ //logged in $username = $_SESSION['loggedinuser']; $results = $con->query("SELECT * FROM user WHERE username = '$username';"); while($row = $results->fetch_array()) { $email = $row['email']; $town = $row['town']; $county = $row['county']; } } // THIS IS NEW // CHECK WHETHER USER HAS CREDITS REMAINING $query = "SELECT SUM(amount) FROM transaction WHERE username = $username"; $result = mysqli_query($con, $query); if($result) { $row = mysqli_fetch_row($result); $amount = $row['amount']; if ( ($amount) <= 0) { //not enough credits - show message and redirect echo "You either have no remaining credits or not enough to complete this transaction. You will be redirected to purchase more."; header( "Refresh:5; url=purchase.php", true, 303); exit(); } else { // UP TO HERE ?> <script type="text/javascript" src="jquery.js"></script> <form action="otherItemsCheck.php" id="sellForm" method="POST"> <input type="hidden" name="username" value="<?php echo $username ?>"></li> <input type="hidden" name="email" value="<?php echo $email ?>"></li> <input type="hidden" name="town" value="<?php echo $town ?>"></li> <input type="hidden" name="county" value="<?php echo $county ?>"></li> <h2>Sell your item</h2> <p><strong>A basic listing will cost 1 credit - extras will be added to the total cost of your listing</strong></p> <ul> <li>Category*:</br> <select name="category"> <option value="none">--choose--</option> <option value="air_pumps">Air Pumps</option> <option value="air_stones">Air Stones</option> <option value="aquariums">Aquariums</option> <option value="cleaning">Cleaning & Maintenance</option> <option value="equipment">CO2 Equipment</option> <option value="coral">Coral & Live Rock</option> <option value="decorations">Decorations</option> <option value="feeders">Feeders</option> <option value="filter_media">Filter Media & Accessories</option> <option value="food">Food</option> <option value="gravel">Gravel & Substrate</option> <option value="health_care">Health Care</option> <option value="heaters">Heaters & Chillers </option> <option value="lighting">Lighting & Hoods</option> <option value="meters">Meters & Controllers</option> <option value="deionization">Reverse Osmosis & Deionization </option> <option value="tubing">Tubing & Valves</option> <option value="uv">UV Steriliser Water Pumps</option> <option value="water_tests">Water Tests & Treatment</option> <option value="other">Other Fish & Aquarium</option> </select> </li> <li>Listing Title*:</br> <input type="text" name="listing_title"> <li><strong>Would you like your listing displayed in Bold?: <input type="checkbox" name="bold" value="1"/> 1 Credit</strong> </li> <li>Condition*:</br> <select name="item_condition"> <option>--choose--</option> <option value="New (Packaged)">New (Packaged)</option> <option value="New (None or damaged packaging">New (None or damaged packaging</option> <option value="Used - Working">Used - Working</option> <option value="Used - Not Working">Used - Not Working</option> </select> </li> <li>Brand*:</br> <select name="brand"> <option>Choose...</option> <option value="AI (Aqua Illumination)">AI (Aqua Illumination)</option> <option value="Algarde">Algarde</option> <option value="API">API</option> <option value="AquaEl">AquaEl</option> <option value="AquaGro">AquaGro</option> <option value="Aquamedic">Aquamedic</option> <option value="Aquarian">Aquarian</option> <option value="Aquarium Systems">Aquarium Systems</option> <option value="Aquatlantis">Aquatlantis</option> <option value="Arcadia">Arcadia</option> <option value="Azoo">Azoo</option> <option value="BiOrb/Reef One">BiOrb/Reef One</option> <option value="Blagdon">Blagdon</option> <option value="Boyu">Boyu</option> <option value="Classica">Classica</option> <option value="Cloverleaf">Cloverleaf</option> <option value="Deltec/D-D">Deltec/D-D</option> <option value="Dennerle">Dennerle</option> <option value="Eheim">Eheim</option> <option value="ESHa">ESHa</option> <option value="Hagen/Fluval">Hagen/Fluval</option> <option value="Hikari">Hikari</option> <option value="Hobby">Hobby</option> <option value="Hugo Kamishi">Hugo Kamishi</option> <option value="Interpet">Interpet </option> <option value="JMC">JMC</option> <option value="Juwel">Juwel</option> <option value="King British">King British</option> <option value="New Era">New Era</option> <option value="Nishikoi">Nishikoi</option> <option value="NT Labs">NT Labs</option> <option value="Oase">Oase</option> <option value="Ocean Nutrition">Ocean Nutrition</option> <option value="Penn Plax">Penn Plax</option> <option value="Pontec">Pontec</option> <option value="Red Sea">Red Sea</option> <option value="Rena">Rena</option> <option value="Salifert">Salifert</option> <option value="Seachem">Seachem</option> <option value="Seneye">Seneye</option> <option value="SuperFish">SuperFish</option> <option value="Tanktests">Tanktests</option> <option value="Tetra">Tetra</option> <option value="TMC">TMC</option> <option value="Tunze">Tunze</option> <option value="Two Little Fishies">Two Little Fishies</option> <option value="Waterlife">Waterlife</option> <option value="Wave Point">Wave Point</option> <option value="other">Other</option> </select> </li> <li>Model*:</br> <input type="text" name="model"> </li> <li>Colour*:</br> <select name="colour"> <option value="">--choose one--</option> <option value="White">White</option> <option value="Grey">Grey</option> <option value="Black">Black</option> <option value="Blue">Blue</option> <option value="Green">Green</option> <option value="Orange">Orange</option> <option value="Red">Red</option> <option value="Multicoloured">Multicoloured</option> <option value="Other">Other</option> </select> </li> <li>Quantity*:</br> <select name="quantity"> <option value="">--choose one--</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select><strong> 1 Credit entitles you to sell up to 10 of the same item. </strong> </li> <li>Price*:<br> <input type="text" name="price"> In UK Pound Sterling </li> <li>Description*:</br> <textarea name="comments"></textarea> </li> <li>Postage Type*:</br> <select name="postage_type"> <option>Choose...</option> <option disabled>Economy services</option> <option value="UK_CollectPlusTracked">Collect+ Economy Tracked (3 to 5 working days)</option> <option value="UK_HermesTracked">Hermes Tracked (3 to 5 working days)</option> <option value="UK_RoyalMailSecondClassStandard">Royal Mail 2nd Class (2 to 3 working days)</option> <option value="UK_RoyalMailSecondClassRecorded">Royal Mail 2nd Class Signed For (2 to 3 working days)</option> <option value="UK_RoyalMailTracked">Royal Mail Tracked 48 (2 to 3 working days)</option> <option value="UK_RoyalMail48">Royal Mail 48 (2 to 3 working days)</option> <option value="UK_OtherCourier3Days">Other Courier 3 days (3 working days)</option> <option value="UK_OtherCourier5Days">Other Courier 5 days (5 working days)</option> <option value="UK_OtherCourier">Other Courier (3 to 5 working days)</option> <option value="UK_SellersStandardRate">Other Courier 3-5 days (3 to 5 working days)</option> <option disabled>Standard services</option> <option value="UK_RoyalMailFirstClassStandard">Royal Mail 1st Class (1 working day)</option> <option value="UK_RoyalMailFirstClassRecorded">Royal Mail 1st Class Signed For (1 working day)</option> <option value="UK_RoyalMailNextDay">Royal Mail Tracked 24 (1 working day)</option> <option value="UK_RoyalMail24">Royal Mail 24 (1 working day)</option> <option value="UK_CollectPlusStandard">Collect+ Standard (2 working days)</option> <option value="UK_Parcelforce48">Parcelforce 48 (1 to 2 working days)</option> <option value="UK_OtherCourier48">Other 48 Hour Courier (1 to 2 working days)</option> <option disabled>Express services</option> <option value="UK_RoyalMailSpecialDeliveryNextDay">Royal Mail Special Delivery (TM) 1:00 pm (1 working day)</option> <option value="UK_RoyalMailSpecialDelivery9am">Royal Mail Special Delivery (TM) 9:00 am (1 working day)</option> <option value="UK_Parcelforce24">Parcelforce 24 (1 working day)</option> <option value="UK_OtherCourier24">Other 24 Hour Courier (1 working day)</option> <option disabled>Services from outside UK</option> <option value="UK_EconomyShippingFromOutside">Economy Delivery from outside UK (10 to 22 working days)</option> <option value="StandardDeliveryfromOutsideUKwithRoyalMail">Standard Delivery from outside UK with Royal Mail (7 to 13 working days)</option> <option value="UK_StandardShippingFromOutside">Standard Delivery from outside UK (4 to 10 working days)</option> <option value="UK_ExpeditedShippingFromOutside">Express Delivery from outside UK (1 to 3 working days)</option> <option value="UK_FedExIntlEconomy">FedEx International Economy (3 to 4 working days)</option> <option value="UK_TntIntlExp">TNT International Express (2 to 3 working days)</option> <option value="UK_TrackedDeliveryFromAbroad">Tracked delivery from outside UK (2 to 5 working days)</option> <option disabled>Collection</option> <option value="UK_CollectInPerson">Collection in Person </option> </select> </li> <li>Postage Cost*:</br> <input type="text" name="postage_cost"> </li> </ul> <ul> <li>Upload Photo:</br> <input id="text" type="text" name="upload_photo"> </li> <li><input type="checkbox" name="rotate" value="10"/><strong>For 10 credits, you can have your listing displayed on our homepage on a rotation basis. </strong> </li> <li> <input type="submit" value="List Item"></li> </ul> </form> <script type="text/javascript" src="saleSpecies.js"></script> <?php } include 'includes/overall/footer.php'; ?>eg, it says this } he <?php } include 'includes/overall/footer.php'; ?>Is unmatched. I know whats wrong, just not how to fix it Any help is always much appreciated. aquaman Hi i tried to fix something but ended up screwing something up.Ive got a problem and i dont know how to fix it. Down here u can see the code. the error im getting is "Parse error: syntax error, unexpected end of file." Could someone please help me? Hello I have one problem with fwrite() I have one script to get width and height from javascript and echo it with PHP. echo "Screen width is: ". $_GET['width'] ."<br />\n"; echo "Screen height is: ". $_GET['height'] ."<br />\n"; It works but i want to store the result in a file fwrite($info,"Height: $_GET['height'] <br />"); But then I get error Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING //////////////////////// it would be even better if I don't have to print the values but directly store them in $iinfo sorry if something similar was soved but those examples were different or i was unable to transform it to solve my problem hi all am new to this forum help me to overcome from this error Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in D:\wamp\www\quiz1\quiz1.php on line 12 Code: [Select] <?php include("contentdb.php"); $display = mysql_query("SELECT * FROM $table ORDER BY id",$db); if (!$submit) { echo "<form method=post action=$_SERVER['PHP_SELF']>"; echo "<table border=0>"; while ($row = mysql_fetch_array($display)) { $id = $row["id"]; $question = $row["question"]; $opt1 = $row["opt1"]; $opt2 = $row["opt2"]; $opt3 = $row["opt3"]; $answer = $row["answer"]; echo "<tr><td colspan=3><br><b>$question</b></td></tr>"; echo "<tr><td>$opt1 <input type=radio name=q$id value=\"$opt1\"></td><td>$opt2 <input type=radio name=q$id value=\"$opt2\"></td><td>$opt3 <input type=radio name=q$id value=\"$opt3\"></td></tr>"; } echo "</table>"; echo "<input type='submit' value='See how you did' name='submit'>"; echo "</form>"; } elseif ($submit) { $score = 0; $total = mysql_num_rows($display); while ($result = mysql_fetch_array($display)) { $answer = $result["answer"]; $q = $result["q"]; if ($$q == $answer) { $score++; } } echo "<p align=center><b>You scored $score out of $total</b></p>"; echo "<p>"; if ($score == $total) { echo "Congratulations! You got every question right!"; } elseif ($score/$total < 0.34) { echo "Oh dear. Not the best score, but don't worry, it's only a quiz."; } elseif ($score/$total > 0.67) { echo "Well done! You certainly know your stuff."; } else { echo "Not bad - but there were a few that caught you out!"; } echo "</p>"; echo "<p>Here are the answers:"; echo "<table border=0>"; $display = mysql_query("SELECT * FROM $table ORDER BY id",$db); while ($row = mysql_fetch_array($display)) { $question = $row["question"]; $answer = $row["answer"]; $q = $row["q"]; echo "<tr><td><br>$question</td></tr>"; if ($$q == $answer) { echo "<tr><td>»you answered ${$q}, which is correct</td></tr>"; } elseif ($$q == "") { echo "<tr><td>»you didn't select an answer. The answer is $answer</td></tr>"; } else { echo "<tr><td>»you answered ${$q}. The answer is $answer</td></tr>"; } } echo "</table></p>"; } ?> thanks in adavance
Hello, i got a problem with my codes, it says Parse error: syntax error, unexpected token "endwhile" . Please help me, Here's my code:
<?php
while($rows=mysqli_fetch_array($result)); I am trying to put a href on a line to link me to another php module, but get an error: Parse error: parse error in C:\wamp\www\editpolicy.php on line 47 My code: while ($row2 = mysql_fetch_array($result2) ) { print "<tr><td>"; <a href='editpayment.php?payid=$row2[PaymentID]'>$row2[PaymentID]</a> .........THIS IS LINE 47 ??? print "</td><td>"; print $row2['Actioned']; print "</td><td align='right'>"; print $row2['PremiumPaidAmount']; print "</td><td align='right'>"; print $row2['Risk']; print "</td></tr>"; } echo "</select></td>\r\n </tr>\r\n \r\n <tr>\r\n <td align=\"right\">Total Views Allowed:</td>\r\n <td><input type=\"text\" id=\"ad_total_views\" style=\"width:50px;\" value=\"\" disabled=\"disabled\" /> <label><input type=\"checkbox\" checked=\"checked\" onclick=\"if(this.checked==true){$('#ad_total_views').val('');$('#ad_total_views').attr('disabled','disabled');}else{$('#ad_total_views').val('');$('#ad_total_views').removeAttr('disabled');$('#ad_total_views').focus()}\" />Unlimited</label></td>\r\n </tr>\r\n \r\n <tr>\r\n <td align=\"right\">Total Clicks Allowed:</td>\r\n <td><input type=\"text\" id=\"ad_total_clicks\" style=\"width:50px;\" value=\"\" disabled=\"disabled\" /> <label><input type=\"checkbox\" checked=\"checked\" onclick=\"if(this.checked==true){$('#ad_total_clicks').val('');$('#ad_total_clicks').attr('disabled','disabled');}else{$('#ad_total_clicks').val('');$('#ad_total_clicks').removeAttr('disabled');$('#ad_total_clicks').focus()}\" />Unlimited</label></td>\r\n </tr>\r\n </table></td>\r\n </tr>\r\n <tr bgcolor=\"#FFFFFF\">\r\n <td class=\"td_th\" align=\"center\">Smarty Code (Developer)</td>\r\n <td>{\$ads->getAdCode(<span id=\"smartycode\">1</span>)}</td>\r\n </tr>\r\n <tr bgcolor=\"#FFFFFF\">\r\n <td class=\"td_th\" align=\"center\"> </td>\r\n <td><input type=\"button\" value=\"Create New Campaign\" onclick=\"new_ad()\" /></td>\r\n </tr>\r\n </TBODY></TABLE>\r\n<br />\r\n\r\n<TABLE cellSpacing=1 cellPadding=4 width=\"100%\" border=0>\r\n <TBODY>\r\n <TR class=\"td_title\">\r\n <TD colSpan=7>Ad Campaigns</TD></TR>\r\n <TR bgColor=#ffffff>\r\n \r\n <TD width=\"10%\" align=\"center\" class=\"td_th\"> </TD>\r\n <TD width=\"4%\" align=\"center\" class=\"td_th\">ID</TD>\r\n <TD width=\"29%\" align=\"center\" class=\"td_th\">Campaign Name</TD>\r\n <TD width=\"12%\" align=\"center\" class=\"td_th\">Start Date</TD>\r\n <TD width=\"11%\" align=\"center\" class=\"td_th\">End Date</TD>\r\n <TD width=\"17%\" align=\"center\" class=\"td_th\">Viewed / Views Allowed</TD>\r\n <TD width=\"17%\" align=\"center\" class=\"td_th\">Clicked / Clicks Allowed</TD>\r\n </TR>\r\n "; $BoxSize = array("smallbox" = array("length" => 12, "width" => 10, "depth" => 2.5), "mediumbox" = array("length" => 30, "width" => 20, "depth" => 4), "largebox" = array("length" => 60, "width" => 40, "depth" => 11.5)); Code: [Select] This is a clip of my PHP file: <?php $con = mysql_connect($host,$username,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($database, $con); $result = mysql_query("SELECT * FROM purchase_order WHERE purchase_order_number=='$purchase_order_number'"); while($row = mysql_fetch_array($result)) { $vendor=$row['vendor']; $purchase_order_date=$row['purchase_order_date']; $ship=$row['ship']; $state=$row['state']; $fob=$row['fob']; $terms=$row['terms']; $buyer=$row['buyer']; $freight=$row['freight']; $req_date=$row['req_date']; $confirming_to=$row['confirming_to']; $remarks=$row['remarks']; $tax=$row['tax'] } // [i][u][b]<-- This is line 88 (The one with the error)[/b][/u][/i] ?>Thanks in advance! Can any one tell me how to access the image of this xml file: Code: [Select] <item> <title>DSC00083</title> <link>http://www.flickr.com/photos/53764782@N08/4963929579/</link> <description><p><a href="http://www.flickr.com/people/53764782@N08/">SteveDupree</a> posted a photo:</p> <p><a href="http://www.flickr.com/photos/53764782@N08/4963929579/" title="DSC00083"><img src="http://farm5.static.flickr.com/4111/4963929579_3334de3f06_m.jpg" width="240" height="180" alt="DSC00083" /></a></p></description> <pubDate>Mon, 06 Sep 2010 10:05:37 -0700</pubDate> <dc:date.Taken>2007-08-08T19:30:20-08:00</dc:date.Taken> <author flickr:profile="http://www.flickr.com/people/53764782@N08/">nobody@flickr.com (SteveDupree)</author> <guid isPermaLink="false">tag:flickr.com,2004:/photo/4963929579</guid> <media:content url="http://farm5.static.flickr.com/4111/4963929579_cf0b5e5656_o.jpg" type="image/jpeg" height="1224" width="1632"/> <media:title>DSC00083</media:title> <media:thumbnail url="http://farm5.static.flickr.com/4111/4963929579_3334de3f06_s.jpg" height="75" width="75" /> <media:credit role="photographer">SteveDupree</media:credit> </item> I am retereiving the title and the href with this: //print_r ($rss); echo '<ul>'; foreach ($rss->items as $item) { $href = $item['link']; $title = $item['title']; $img = $item['?????????']; echo "<li><a href=$href>" . $img . "</a></li>"; } echo "</ul>"; ?> but cant seem to get at Code: [Select] <media:content url="http://farm5.static.flickr.com/4111/4963929579_cf0b5e5656_o.jpg" type="image/jpeg" height="1224" width="1632"/> Hi,
I'm trying to return the value of avail="0" from the following XML file using simplexml_load_string.
<response> <result code="1000"> <msg>Command completed successfully</msg> </result> <resData> <domain:chkData xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"> <domain:cd> <domain:name avail="0">www.testing.co.uk</domain:name> </domain:cd> </domain:chkData> </resData>I have it working where I can access the www.testing.co.uk value using the following: echo $xml->response->resData->children('domain', true)->chkData->children('domain', true)->cd->children('domain', true)->name;But am not sure how to access the avail value? I thought the following would have worked by adding ['avail'] onto the end, but appear to be missing something. echo $xml->response->resData->children('domain', true)->chkData->children('domain', true)->cd->children('domain', true)->name['avail'];Any help much appreciated. MoFish Hey guys I really need this done and am not experienced in php. I need to read this xml file h t t p : / / britishinternettv.co.uk/vlc.xml i need to extract the first url between -<url>and </url> this then needs to be echo'd (written) where i need it on my page. this must work afresh each page load. can donate to paypal if needed. thanks in advance Dennis Hi Guys I am getting a parse error from the following code Code: [Select] <?php session_start(); ?> <?php include_once('includes/connect.php'); ?> <?php if($_POST['submit']) { foreach($_POST as $key=>$val){ $$key=mysql_real_escape_string($val); } } ?> <?php //check whether email already registered $check_email_sql=mysql_query("SELECT * FROM `tbl_users` WHERE `email_address`='$email'"); if(mysql_num_rows($check_email_sql)==0) { $add_user=mysql_query("INSERT into `tbl_users` (`email_address`,`password`,`forename`,`surname`,`usertype`) values('$email',md5('$password'),'$forename','$surname','supplier')"); $check_add_user_sql=mysql_query("SELECT * FROM `tbl_users` WHERE `email_address`='$email'"); if(mysql_num_rows($check_add_user_sql)>0) { //upload logo // Your file name you are uploading $file_name = $logo; // random 4 digit to add to our file name // some people use date and time in stead of random digit $random_digit=rand(0000,9999); //combine random digit to you file name to create new file name //use dot (.) to combile these two variables $new_file_name=$random_digit.$file_name; //set where you want to store files //in this example we keep file in folder upload //$new_file_name = new upload file name //for example upload file name cartoon.gif . $path will be upload/cartoon.gif $path= "logos/".$new_file_name; if($ufile !=none) { if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path)) { echo "Successful<BR/>"; //$new_file_name = new file name //$HTTP_POST_FILES['ufile']['size'] = file size //$HTTP_POST_FILES['ufile']['type'] = type of file echo "File Name :".$new_file_name."<BR/>"; echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>"; } else { echo "Error"; } } //add supplier info $user_id=$check_add_user_sql['user_id']; $add_supplier=mysql_query("INSERT into `tbl_providers` (`user_id`,`provider_name`,`address1`,`address2`,`address3`,`address4`,`post_code`,`website`,`phone_number`,`email`,`fax_number`,`about`,`logo`) VALUES ('$user_id','$business','$address1','$address2','$address3','$address4','$postcode','$website','$phone','$email','$fax','$about','$new_file_name')"); //add categories to tbl_provider_categories $add_cat_1=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category1')"); $add_cat_2=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category2')"); $add_cat_4=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category3')"); $add_cat_4=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category4')"); $add_cat_5=mysql_query("INSERT into `tbl_provider_categories` (`user_id`,`cat_id`) VALUES ('$user_id','$category5')"); } else { header('Location: index.php'); exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Wedding Buddy | Help make your big day special</title> <!-- InstanceEndEditable --> <link href="css/buddy.css" rel="stylesheet" type="text/css" /> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> </head> <body> <div align="center"> <div id="container"> <div id="header"> <div id="login"> <?php if(!isset($_SESSION['auth'])) { echo('<form name="login" method="post" action="newlogin.php"> <input name="username" type="text" width="30" value="Username" /> <input name="password" type="text" width="30" value="Password" /> <input name="submit" type="submit" value="Login" /> </form> Don\'t have an account <a href="register.php" title="Register Here">register here</a>'); } else { echo('<input name="logout" type="button" value="Logout" onClick="logout();" />'); } ?> </div> <img src="images/bridegroom.jpg" /></div> <div id="menu"> <?php if(isset($_SESSION['usertype'])) { if($_SESSION['usertype']="wedding") { include_once('includes/wedding_menu_inc.php'); } elseif ($_SESSION['usertype']="supplier") { include_once('includes/supplier_menu_inc.php'); } else { include_once('includes/standard_menu_inc.php'); } } ?> <script type="text/javascript"> <!-- var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); //--> </script> </div> <div id="maintext"><p> </p><!-- InstanceBeginEditable name="maintext" --> <?php if (isset($message)) { echo($message); } ?> <!-- InstanceEndEditable --> </div> </div> </body> <!-- InstanceEnd --></html> I am trying to create user details in one table, upload a logo and add further details into another table, I am not sure if I have approached it in the correct method. The error message is saying Parse error: parse error in C:\wamp\www\wedding_buddy\new_supplier.php on line 150, this is the last line of code. Any ideas or tips for a better way of achieving what I want to do. |