PHP - $$ Parse Url From Xml
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 Similar Tutorialshi 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! 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 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"/> 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 Hello
This may seem like a silly question but if you never ask you never know...
Lets say I json encode a php array. When I echo out the encoded json string into a JS variable it looks something like this in the resultant markup:
var arr = ["cow - Copy (10).jpg","cow - Copy (2).jpg"];So in this instance the string I've echoed out is equivalent to a JS array and I can use it straight away. My questions: 1) Is it valid to do what I've done above? 2) Since I can use the array right away is there any need to JSON.parse? 3) When would you use JSON.parse? Thanks, Drongo I'm getting the following error when the $query = mysql_query line runs: Parse error: syntax error, unexpected T_VARIABLE Code: [Select] $vidtitle = strip_tags(trim($_POST['vidtitle'])); $viddesc = strip_tags(trim($_POST['viddesc'])); $vidtags = strip_tags(trim($_POST['vidtags'])); $vidurl = strip_tags(trim($_POST['vidurl'])); // get current username $username = $_SESSION['Username'] // register user $query = mysql_query("INSERT INTO haas12_test.videos (vidtitle, viddesc, vidtags, vidurl, username) VALUES('".$vidtitle."', '".$viddesc."', '".$vidtags."', '".$vidurl."', '".$username."')"); it worked fine before I added the username variables. 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)) Writing a php script to select data from mysql data base and populate a html table. continue getting the following message Parse error: syntax error, unexpected T_LNUMBER in /home/chewson1/public_html/nurse_certification/dept_rpt.php on line 11 code is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <title>DEPARTMENT REPORT</title> 6 </head> 7 <body> 8 9 <?php 10 11 include_once('connectvars.php'); 12 $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) 13 or die('Error connecting to MySQL server.'); 14 15 $query = "SELECT cr_id, cr_empl_num, cr_ci_num, cr_cert_exp_dte, cr_flag, ci_num, ci_desc, ci_authority, ce_dpt, ce_name, ce_email, ce_phone_ext, ce_empl_num, cd_email, cd_num 16 FROM certification_record, certification_info, certification_employee, cert_department 17 WHERE cr_empl_num = ce_empl_num 18 AND ce_dpt = cd_num 19 AND cr_ci_num = ci_num 20 AND cr_flag > '00'"; 21 22 23 $result = mysqli_query($dbc, $query) 24 or die('ERROR querying database'); 25 ?> 26 27 <table border=1 style="background-color:#F0F8FF;"> 28 <caption><EM>Nurse Certification Report</EM></caption> 29 <tr> 30 <th>Department Number</th> 31 <th>Employeer Number</th> 32 <th>Employee Name</th> 33 <th>Employeer Email</th> 34 <th>Employeer Phone Extention</th> 35 36 </tr> 37 38 <?php 39 40 WHILE ($row = mysqli_fetch_assoc($result)) { 41 echo "</td><td>"; 42 echo $row['ce_dpt']; 43 echo "</td><td>"; 44 echo $row['ce_empl_num']; 45 echo "</td><td>"; 46 echo $row['ce_name']; 47 echo "</td></tr>"; 48 echo $row['ce_email']; 49 echo "</td><td>"; 50 echo $row['ce_phone_ext']; 51 echo "</td><td>"; 52 } 53 echo "</table>"; 54 55 56 ?> 57 58 </body> 59 </html> 60 Hello to everyone Can someone help me on how to parse this CSV string? I do not know how to parse string using PHP.. #1# "4","+447980123456","+447781484145","","2009-07-08","10:38:15","hello "","" world","Orange" "5","+447980123456","+447781484146","","2009-07-08","10:38:55","hello world","Orange" This string can contain a much bigger data. I would like the result to be Originator : +447781484145, Date : 2009-07-07, Time : 10:38:15, Message : hello world Originator : +447781484146, Date : 2009-07-08, Time : 10:38:55, Message : hello world Please guys if anyone of you knows how to parse this string it will be much appreciated. Im nearing my deadline for my work and this thing is keeping me from finishing it.. Thanks in advance OK.. pretty new to PHP for the most part, but i understand programming languages to a decent extent! Anyways im trying to parse an HTML page to get data out of it and probably in turn put into an sql table.. all i need help with is doing the parsing with dom, and xpath querys or however would be the best way to do this... page im trying to parse: http://us.battle.net/wow/en/guild/Moonrunner/The%20Eternal%20Blade/news basically the data i want to put into sql or variables for the time being would be the 25 results returned in news. (first one is mudkips item Vicious Gladiator's Signet of Cruelty. , and last item is: Lionus earned the achievement Level 30 for 10 points. ) Can anyone please give me some help with a function that could do this? please! I have been getting a parse error on my code. Any thoughts as to why? echo "<div id='memberContent'> <div id='welcome'> Welcome, \".$r['firstname'].\"! </div><br> <div class='profileImage'> <img src=\"assets/img/avatars/.$r['imagename']\" alt=\"Profile Picture\" height=\"90px\" title=\"$firstname.' '.$lastname\" /> </div> <div id='addfriend'> <a href='request.php'>Connect</a> </div> </div> "; I am trying to take a value that is stored in a db for address and parse it into 4 different variables: $address $city $state $zip when I started the loop and echo'd the results, here is how it comes out: Code: [Select] a:4:{s:14:"street_address";s:20:"811 East Parrish Ave";s:4:"city";s:9:"Owensboro";s:5:"state";s:2:"KY";s:3:"zip";s:5:"42303";} a:4:{s:14:"street_address";b:0;s:4:"city";b:0;s:5:"state";b:0;s:3:"zip";b:0;} a:4:{s:14:"street_address";s:15:"800 Rose Street";s:4:"city";s:9:"Lexington";s:5:"state";s:2:"KY";s:3:"zip";s:5:"40536";} a:4:{s:14:"street_address";s:19:"1300 State Hwy 3298";s:4:"city";s:10:"Olive Hill";s:5:"state";s:2:"KY";s:3:"zip";s:5:"41164";} a:4:{s:14:"street_address";s:22:"1301 North Race Street";s:4:"city";s:7:"Glasgow";s:5:"state";s:2:"KY";s:3:"zip";s:5:"42141";} a:4:{s:14:"street_address";s:23:"200 Abraham Flexner Way";s:4:"city";s:10:"Louisville";s:5:"state";s:2:"KY";s:3:"zip";s:5:"40202";} What would the code be to display server side code like the date and time to display in html pages? I have the date code for copyrights that I want to display <?php echo date(Y); ?>and I think I need to create an .htaccess file to put it in but not sure what to put. Thanks, First post here from a php n00bcakes so please be gentle. For some reason I keep getting a parse error on this code and I can't figure out why. Here is the error: PHP Syntax Check: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in your code on line 6 Here is the code: <?php $count = 1; while ($count <= 10) { $square = $count * $count; Echo "$count squared is $square <br>;" $count++; } ?> It doesn't like something about $count++; and I can't figure out what. The sad part...this code is straight out of a PHP book. :/ Thanks in advance! -jhinckley Hi, I have a code which uses GET to retrieve data from the URL, check that it does not already exist in my database, then insert it into the database if it does not already exist, Problem is I am getting a Parse error: syntax error, unexpected T_STRING in /home/******/public_html/**-********/forums/like.php on line 12. Here is the code: Quote <? $username=$_GET['UN']; $postid=$_GET['PID']; mysql_connect("localhost", "*******", "***********") or die(mysql_error()); mysql_select_db("**********") or die(mysql_error()); $query_multiplecheck = "SELECT * FROM data WHERE username='$username' OR postid='$postid'; $multiplecheck = mysql_query($query_multiplecheck) or die(mysql_error()); $row_multiplecheck = mysql_fetch_assoc($multiplecheck); $totalRows_multiplecheck = mysql_num_rows($multiplecheck); if ( $totalRows_multiplecheck > 0 ) { echo 'You already like this post.'; } else { mysql_query("INSERT INTO data VALUES ('$username', '$postid')"); Print "Your information has been successfully added to the database."; }; ?> I would assume the problem is with my if statement, but I don't know exactly, thanks for any help in advance. |