PHP - Help Needed To Parse Some Tricky Xml
Hi all,
I'm looking for some help in parsing an XML file from geocaching.com. It's pretty far beyond me as I've never tried parsing XML like using PHP before (although I'm OK at PHP in a general sense). Ideally I'm looking to be able to query every element in this file (attached, renamed to .txt - was originally .gpx) so that I can do stuff with it. I don't need to update the file, just read it and create a UI from the contents. Should I use SimpleXMLElement, xml_parser or something else? The structure of the file isn't something I've encountered before because of the <groundspeak:log> formatted elements. I'm only used to relatively simple XML files with the colon-separate bits. Can anyone help? Thanks! Similar TutorialsHello Freaks! I am having problem with following code: <?php simplexml_load_string ('?xml version="1.0" encoding="utf-8"?>'); php?> This code is giving me following error Parse error: syntax error, unexpected '<' in public_html/wp-content/plugins/pluginnamehere/whatever.php on line 665 I know there is only a minor bracket problem that causing me this error. I would be helpful to you if you can modify it for me Thanks This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=358972.0 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 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 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! 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 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 I want to retrive data in textbox from databse I get this error Parse error: parse error in C:\wamp\www\mariyano\profile.php on line 20 I have upload the file Please help its urgent Could somebody please have a look at this and see if you see a problem: Error Code: [Select] Parse error: syntax error, unexpected ',', expecting '&' or T_VARIABLE in request.php on line 32 Code starting on line 32 Code: [Select] only comments above this function fhrsam_requests(songID, samhost, samport) { var path = "http://localhost/"; reqwin = window.open(path+"request.php?songID="+songID+'&samport='+samport+'&samhost='+samhost, "_AR_request", "location=no,status=no,menubar=no,scrollbars=yes,resizeable=yes,height=400,width=550"); reqwin.focus(); }; Parse error: syntax error, unexpected T_WHILE in /home/smileits/public_html/space/post.php on line 87 Code: [Select] <? session_start(); // This forum was developed by Adam M. B. from aWeb Labs // Visit us at http://www.labs.aweb.com.au // for forum problems, bugs, or ideas email yougotmail@gmail.com // thanks for trying out or using this forum // aWebBB version 1.2 released under the GNU GPL // connect to database and pull up info include "config.php"; $user123=$_POST['Username']; $db = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); //Get the data $query = "SELECT id, username, password FROM users WHERE username='$user123'"; $result = mysql_query($query); /* Here we fetch the result as an array */ while($r=mysql_fetch_array($result)) { /* This bit sets our data from each row as variables, to make it easier to display */ $id=$r["id"]; $_Username=$r["username"]; $_Password=$r["password"]; // If the form was submitted if ($_POST['Submitted'] == "True") { // If the username and password match up, then continue... if ($_POST['Username'] == $_Username && $_POST['Password'] == $_Password) { // Username and password matched, set them as logged in and set the // Username to a session variable. $_SESSION['Logged_In'] = "True"; $_SESSION['Username'] = $_Username; } } } mysql_close($db); // If they are NOT logged in then show the form to login... if ($_SESSION['Logged_In'] != "True") { echo "<META HTTP-EQUIV=\"refresh\" content=\"0; URL=login.php?page=" . $_SERVER['PHP_SELF'] . "\">"; } else { include("header.php"); include "config.php"; $db = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query = "SELECT sig, avatar FROM users WHERE username = '$_SESSION[Username]'"; $result = mysql_query($query); while($r=mysql_fetch_array($result)) { $sig=$r["sig"]; $avatar=$r["avatar"]; ?> <script type="text/javascript"> <!-- function insertext(text){ document.post.fpost.value+=" "+ text; document.post.fpost.focus(); } //--> </script> <style type='text/css'><!--.bordercontrol {padding: 0px; border-right: 1px solid silver; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD;}A.post:hover, A.post:active {background-color: #DDDDDD}A.post:hover .bordercontrol, A.post:active .bordercontrol {background-color: silver; padding: 0px; border:1px; border-thickness: 1px; border-color: grey; border-style: solid}--></style> <div class="side-headline"><b>New Forum Thread:</b></div><br> <div align="center"> <form name="post" method="post" action="post.php?a=post"> <input type="hidden" name="sig" value="<?=$sig;?>"> <input type="hidden" name="avatar" value="<?=$avatar;?>"> <div class="grey-box"> Thread Name: <input type="text" name="tname" size="30" max="10"></div> <div class="grey-box">Select a Category: <select name="category" id="category"> <?php if ($_GET['c'] != "") { $catthing = " WHERE category != '$_GET[c]'"; $cit=$_GET['c']; echo "<option value=\"$cit\" selected>$cit</option>"; } else { } //connection to database include "config.php"; $db = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query = "SELECT category FROM fcat$catthing"; $result = mysql_query($sql) while($r=mysql_fetch_array($result)) { $cname=$r["category"]; echo "<option value=\"$cname\">$cname</option>"; } mysql_close($db); ?> </select> </div> <div class="grey-box"><a class="post" href="javascript:insertext(':)')"><img class="bordercontrol" alt="smile" src="smilies/smile.gif" border="0" vspace="1" width="18" height="18"></a><a class="post" href="javascript:insertext(';)')"><img class="bordercontrol" alt="wink" src="smilies/wink.gif" border="0" vspace="1" width="18" height="18"></a><a class="post" href="javascript:insertext(':-p')"><img class="bordercontrol" alt="tongue" src="smilies/tongue.gif" border="0" vspace="1" width="18" height="18"></a><a class="post" href="javascript:insertext('>:o')"><img class="bordercontrol" alt="angry" src="smilies/angry.gif" border="0" vspace="1" width="18" height="18"></a><a class="post" href="javascript:insertext(':(')"><img class="bordercontrol" alt="sad" src="smilies/sad.gif" border="0" vspace="1" width="18" height="18"></a><a class="post" href="javascript:insertext(':-D')"><img class="bordercontrol" alt="laughing" src="smilies/laughing.gif" border="0" vspace="1" width="18" height="18"></a><a class="post" href="javascript:insertext('<b> </b>')" title="Bold"><img class="bordercontrol" src="format_edit/ed_format_bold.gif" border="0" width="18" height="18" vspace="1"></a><a class="post" href="javascript:insertext('<i> </i>')" title="Italics"><img class="bordercontrol" src="format_edit/ed_format_italic.gif" border="0" width="18" height="18" vspace="1"></a><a class="post" href="javascript:insertext('<s> </s>')" title="Strikethrough"><img class="bordercontrol" src="format_edit/ed_format_strike.gif" border="0" width="18" height="18" vspace="1"></a><a class="post" href="javascript:insertext('<u> </u>')" title="Underline"><img class="bordercontrol" src="format_edit/ed_format_underline.gif" border="0" vspace="1" width="18" height="18"></a><a class="post" href="javascript:insertext('<a href=www.website.com> linked text </a>')" title="Insert Link"><img class="bordercontrol" src="format_edit/ed_link.gif" border="0" vspace="1" width="18" height="18"></a><a class="post" href="javascript:insertext('<br>')" title="New Line"><img class="bordercontrol" src="format_edit/ed_left_to_right.gif" border="0" vspace="1" width="18" height="18"></a><a class="post" href="#" onClick="document.post.reset()"><img class="bordercontrol" src="format_edit/ed_delete.gif" border="0" vspace="1" width="18" height="18" title="Erase all"></a> </div> <div class="grey-box"> Thread Text: <br> <textarea name="fpost" cols="45" rows="7"></textarea></div> <div class="grey-box"><div align="center"> <input type="submit" name="Submit" value="Post New Thread"> </form></div></div></div> <? } if ($_GET['a'] == "post") { $time1=date("H:i:s"); $rand=rand(1000000, 9999999); include "config.php"; // As you can see we connected to the database with config $db = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query = "INSERT INTO flist(tid, categories, tname, poster, date) VALUES('$rand','$_POST[category]','$_POST[tname]','$_SESSION[Username]', now())"; mysql_query($query); echo "Thread "; mysql_close($db); include "config.php"; // As you can see we connected to the database with config $db = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db ($db_name) or die ("Cannot connect to database"); $query = "INSERT INTO forum(tid, categories, tname, poster, fpost, sig, avatar, time, date) VALUES('$rand','$_POST[category]','$_POST[tname]','$_SESSION[Username]','$_POST[fpost]','$_POST[sig]','$_POST[avatar]','$time1', now())"; mysql_query($query); echo "Submitted"; echo '<meta http-equiv="refresh" content="0;url=index.php">'; mysql_close($db); } else { } include("footer.php"); // If they want to logout then if ($_GET['mode'] == "logout") { // Start the session session_start(); // Put all the session variables into an array $_SESSION = array(); // and finally remove all the session variables session_destroy(); // Redirect to show results.. echo "<META HTTP-EQUIV=\"refresh\" content=\"1; URL=" . $_SERVER['PHP_SELF'] . "\">"; } } ?> error appears on line 87 which shows... Code: [Select] while($r=mysql_fetch_array($result)) Hello this url https://www.googleapis.com/buzz/v1/people/sportsstatus/@groups/@followers?max-results=0 return an xml . I need to parse <totalResults> </totalResults> out of this feed using php .I need to retrieve data for the <totalresults> field. Iam stuck with this could not move further as iam new to php. 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. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Thanks For Your Feedback</title> </head> <body> <h2>Comments And Suggestions</h2> <?php $rate_us = $_POST['rating']; $your_name = $_POST['name']; $email = $_POST['email']; $your_comments = $_POST['comments']; $dbc = mysqli_connect('localhost','root','password','contactus') or die('Error connecting to MySQL server.'); $query = "INSERT INTO contact_us (rate_us,your_name,email,your_comments)"."VALUES ('$rate_us','$your_name','$email','$your_comments'); $result = mysqli_query($dbc,$query) or die('Error querying database'); mysqli_connect($dbc); echo 'Thanks for your suggestions and comments'.'<br />'.$your_name.'<br />'; echo 'And you rated us as'.'<br />'.$rate_us; ?> </body> </html> Hi.I am new to php. I have written this code for storing the data entered into form fields in mysql database It shows the following error Code: [Select] Parse error: syntax error, unexpected $end in F:\xampp\htdocs\contactus.php on line 34 [code] Can anyone tell me the mistake is. BY the way i am using xampp. and the version of php is 5.3.5 Hi everyone. Can someone help me fix this code: Code: [Select] <?PHP include('db.php); $query = "SELECT * FROM companies; $result = mysql_query($query) ; while ( $row = mysql_fetch_array($result)) { echo $row['what_services'] . " - " . strlen($row['what_services']); } ?> on line 6 it has a parse error: Parse error: syntax error, unexpected T_STRING in /hermes/bosweb25a/b109/ipg.removalspacecom/services_001.php on line 6 I am very new to php. I am getting a parse error, and I have tried several things, but can't figure out what the problem is. Here is my code: <?php // This script retrieves all the records from the customers table. echo '<h1>Customers:</h1>'; require_once ('mysqli_connect.php'); // Connect to the db. $q = "SELECT Customers.CustomerID as customerid, Customers.OldCustomerID AS oldcustomerid, Concat_WS( Customers.LastName, ',', Customers.FirstName, ' ', Customers.MiddleName ) AS Customer_Name, Concat_ws( Left( Customers.FirstName, 1 ) , Left( Customers.MiddleName, 1 ) , Customers.LastName ) AS Username, zlu_Cars.Description AS Car, zlu_CarColor.Description AS Car_Color, zlu_Computers.Description AS Computer, CASE when (Customers.IsLaptop=1) then 'Yes' when (Customers.IsLaptop=0) then 'No' end AS Laptop, zlu_Race.Description AS Race, zlu_Residence.Description AS Residence, zlu_BirthMonth.Description AS Birth_Month FROM (((((Customers INNER JOIN zlu_BirthMonth ON Customers.BirthMonthID = zlu_BirthMonth.BirthMonthID) INNER JOIN zlu_CarColor ON Customers.CarColorID = zlu_CarColor.CarColorID) INNER JOIN zlu_Cars ON Customers.CarID = zlu_Cars.CarID) INNER JOIN zlu_Computers ON Customers.ComputerID = zlu_Computers.ComputerID) INNER JOIN zlu_Race ON Customers.RaceID = zlu_Race.RaceID) INNER JOIN zlu_Residence ON Customers.ResidenceID = zlu_Residence.ResidenceID ORDER BY Customers.LastName, Customers.FirstName LIMIT 499,101" $r = @mysqli_query ($dbc, $q);// Run the query. // Count the number of returned rows: $num = mysqli_num_rows($r); I'm obviously not showing you all my code, the error is this line: $r = @mysqli_query ($dbc, $q); Error says: Parse error: parse error in D:\WebShare\PHP\ShepherdS\view_Customers.php on line 17 Any idea what I am doing wrong??? I'm completely lost!! |