PHP - Newbie Here..help Pls
okay so my problem is..i need to put the logo inside this fancybox..when u click page 1..it will link to page 2(fancybox).
Inside the fancybox i want to put the logo..i attached a sample..just like on page 3.. this is code for page 1 and page2(fancybox page) Code: [Select] <select name="month" onchange="this.form.submit();"> <option <?php if ($_POST['month'] == 'All') print 'selected '; ?> value="All">All</option> <option <?php if ($_POST['month'] == 'January') print 'selected '; ?> value="January">January</option> <option <?php if ($_POST['month'] == 'February') print 'selected '; ?> value="February">February</option> <option <?php if ($_POST['month'] == 'March') print 'selected '; ?> value="March">March</option> <option <?php if ($_POST['month'] == 'April') print 'selected '; ?> value="April">April</option> <option <?php if ($_POST['month'] == 'May') print 'selected '; ?> value="May">May</option> <option <?php if ($_POST['month'] == 'June') print 'selected '; ?> value="June">June</option> <option <?php if ($_POST['month'] == 'July') print 'selected '; ?> value="July">July</option> <option <?php if ($_POST['month'] == 'August') print 'selected '; ?> value="August">August</option> <option <?php if ($_POST['month'] == 'September') print 'selected '; ?> value="September">September</option> <option <?php if ($_POST['month'] == 'October') print 'selected '; ?> value="October">October</option> <option <?php if ($_POST['month'] == 'November') print 'selected '; ?> value="November">November</option> <option <?php if ($_POST['month'] == 'December') print 'selected '; ?> value="December">December</option> </select> </div> <br> <? $monthname=$_POST['month']; if (isset($_GET['np'])){ $num_pages=$_GET['np']; } else { if($searchtype == 'yes') if ($monthname=="All" || $monthname=="") { $query = "SELECT count(*) FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 order by event_datefrom desc"; }else { $query = "SELECT count(*) FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 AND MONTHNAME(event_datefrom) = '$monthname' order by event_datefrom desc"; } else if ($monthname=="All" || $monthname=="") { $query = "Select count(*) FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 order by event_datefrom desc"; }else { $query = "Select count(*) FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 AND MONTHNAME(event_datefrom) = '$monthname' order by event_datefrom desc"; } $result=mysql_query($query); $row=mysql_fetch_array($result, MYSQL_NUM); $num_records=$row[0]; if ($num_records > $displayhome){ $num_pages=ceil($num_records/$displayhome); } else { $num_pages=1; } } if (isset($_GET['s'])){ $start=$_GET['s']; } else { $start=0; } if ($monthname=="All" || $monthname=="") { $query = "SELECT master_event.*,master_type.type_name, DATE_FORMAT(event_datefrom, '%d %b %y') as datefrom, DATE_FORMAT(event_dateto, '%d %b %y') as dateto, event_venue, (event_name) as eventname FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 order by event_datefrom asc LIMIT $start, $displayhome"; }else { $query = "SELECT master_event.*,master_type.type_name, DATE_FORMAT(event_datefrom, '%d %b %y') as datefrom, DATE_FORMAT(event_dateto, '%d %b %y') as dateto, event_venue, (event_name) as eventname FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 AND MONTHNAME(event_datefrom) = '$monthname' order by event_datefrom asc LIMIT $start, $displayhome"; } $result = mysql_query($query); $bg='#e5e5e5'; while($row = mysql_fetch_array($result)){ $eventid = $row['event_id']; $eventname = str_replace("", "", $row['eventname']); $eventdatefrom = $row['datefrom']; $eventdateto = $row['dateto']; $event_venue = $row['event_venue']; $event_desc = $row['event_desc']; $speakerlist = $row['speakerlist']; $showline1 = ""; $showpros =""; $showline2 = ""; $showreg =""; $showline3 = ""; $showps =""; $showline4 = ""; $showtestimonial =""; $showline5 = ""; $showsp =""; $showline6 = ""; $showsl =""; if ($eventdatefrom ==$eventdateto) { $eventdate = $eventdatefrom; } else { $eventdate = $eventdatefrom . " - " . $eventdateto; } $querypros="select count(*) as proscount from master_prospectus where event_id ='$eventid' "; $resultpros = mysql_query($querypros); while($rowpros = mysql_fetch_array($resultpros)){ $proscount = $rowpros['proscount']; if ($proscount > 0) { $showline1 = "|"; $showpros ="Request Brochure"; } } $queryreg="select (CASE WHEN event_dateto >= NOW() THEN 'valid' ELSE 'invalid' END) AS validreg from master_event where event_id ='$eventid' "; $resultreg = mysql_query($queryreg); while($rowreg = mysql_fetch_array($resultreg)){ $validreg = $rowreg['validreg']; if ($validreg == "valid") { $showline2 = "|"; $showreg ="Online Registration"; } } $queryps="select count(*) as pscount from master_psevent where event_id ='$eventid' "; $resultps = mysql_query($queryps); while($rowps = mysql_fetch_array($resultps)){ $pscount = $rowps['pscount']; if ($pscount > 0) { $showline3 = "|"; $showps ="Partner & Sponsor"; } } $querytesm="select count(*) as tesmcount from master_testimonial where event_id ='$eventid' "; $resulttesm = mysql_query($querytesm); while($rowtesm = mysql_fetch_array($resulttesm)){ $tesmcount = $rowtesm['tesmcount']; if ($tesmcount > 0) { $showline4 = "|"; $showtestimonial ="Testimonial"; } } $querysp="select count(*) as spcount from master_speakernote where event_id ='$eventid' "; $resultsp = mysql_query($querysp); while($rowsp = mysql_fetch_array($resultsp)){ $spcount = $rowsp['spcount']; if ($spcount > 0) { $showline5 = "|"; $showsp ="Speaker Notes"; } } if ($speakerlist <> '') { $showline6 = "|"; $showsl ="Speaker List"; } echo "<tr><p style=\"font-size:small;\"> <td width='' ><img src='images/search.png' alt='tooltips' ></img> <a href='index.php?view=event&content=tips&ttid=$eventid' title ='$eventname' class=\"fancybox fancybox.iframe\" style=\"color:#104E8B;text-decoration: none; \" ><strong><font size='2' face='Segoe UI' >$eventname</font></strong></a><br> <font color='#000000' size='2' face='arial' >Date : $eventdate <br> Venue : $event_venue<br></font> <table style=\"text-align: left; width: 400px; height: 92px;\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"> <tbody> <tr> <td></td> <td style=\"text-align: justify; color: #000000;\"> <font color='#000000' size='2' face='arial' > $event_desc</font></td> <td></td> </tr> </tbody> </table> <font color='#919191' size='1' face='arial' ><b> <a href='index.php?view=prospectus®rq=$eventid' title ='Request Brochure...' >$showpros</a> <b>$showline1</b> <a href='index.php?view=registration®rq=$eventid' title ='Online Registration...' > $showreg </a> <b>$showline2</b> <a href='index.php?view=event&content=psevent&ttid=$eventid' title ='Sponsor & Partner...' class='fancybox fancybox.iframe' >$showps</a> <b>$showline3</b> <a href='index.php?view=event&content=tesm&ttid=$eventid' title ='Testimonial...' class='fancybox fancybox.iframe' >$showtestimonial</a> <b>$showline4</b> <a href='index.php?view=spl&splid=$eventid' > $showsp</a><b>$showline5</b> <a href='index.php?view=event&content=speaker&ttid=$eventid' title ='$eventname' class='fancybox fancybox.iframe' > $showsl</a></font><br><br></td> </p></tr></b></font> "; } if ($eventid=="") { echo "No Records Found."; } echo "<td><p style=\"font-size:1;\">"; echo "<br>"; if ($num_pages > 1) { $current_page = ($start/$displayhome) + 1; if ($current_page != 1) { echo '<a href="index.php?view=home&content=list&s=' . ($start - $displayhome) . '&np=' . $num_pages . '#a" class="style1" style="color:#4F94CD;text-decoration: none;">Previous</a> ';} for ($i = 1; $i <= $num_pages; $i++) { if ($i != $current_page) { echo '<a href="index.php?view=home&content=list&s=' . (($displayhome * ($i - 1))) . '&np=' . $num_pages . '#a" class="style1" style="color:#4F94CD;text-decoration: none;">' . $i . '</a> '; } else { echo '<font face="arial" size="2">'; echo $i . '</font> ';} } if ($current_page != $num_pages) { echo '<a href="index.php?view=home&content=list&s=' . ($start + $displayhome) . '&np=' . $num_pages . '#a" class="style1" style="color:#4F94CD;text-decoration: none;">Next</a>';} } echo "</p></td>"; ?> </tr> </div> </form> i want the logo like on page 3 to be on fancybox code for page 3(sample) Code: [Select] <? if(isset($_GET[ttid])) { $ttid = $_GET[ttid]; } $connection=mysql_connect("$server", "$username", "$password") or die("Could not establish connection"); mysql_select_db($database_name, $connection) or die ("Could not select database"); $query = "select master_event.* , (DATE_FORMAT(event_datefrom, '%d %M %Y')) as datefrom, (DATE_FORMAT(event_dateto, '%d %M %Y')) as dateto, ucase(event_name) as eventname from master_event where master_event.event_id = '$ttid '"; $result=mysql_query($query); while($row = mysql_fetch_array($result)){ $eventname = $row['eventname']; $eventdesc = $row['event_desc']; //$companydescription = $row['company_description']; $eventvenue = $row['event_venue']; $eventfee = $row['event_fee']; $datefrom = $row['datefrom']; $dateto = $row['dateto']; echo "<font color='#000000' face='arial' ><b> $eventname </b> </font> <br>"; echo "<font color='#000000' face='arial' ><i>Date</i> : $datefrom - $dateto <br>"; echo "<i>Venue</i> : $eventvenue <br>"; $querypstype = "SELECT DISTINCT master_pstype.pstype_id, pstype_desc FROM master_pstype INNER JOIN master_psevent ON master_psevent.pstype_id= master_pstype.pstype_id where master_psevent.event_id = '$ttid' ORDER BY pstype_order"; $resultpstype=mysql_query($querypstype); while($rowpstype = mysql_fetch_array($resultpstype)){ $pstypeid = $rowpstype['pstype_id']; $pstypedesc = $rowpstype['pstype_desc']; echo "<br><font color='#8B3A3A' size='1' face='georgia' ><b><i>$pstypedesc</i></b></font> <br>"; $queryps = "SELECT master_psevent.*, pstype_desc, company_name, company_link, company_description, logo_filename FROM master_psevent LEFT JOIN master_pstype ON master_psevent.pstype_id = master_pstype.pstype_id LEFT JOIN master_ps ON master_ps.ps_id = master_psevent.ps_id WHERE master_psevent.event_id = '$ttid' and master_pstype.pstype_id= '$pstypeid' ORDER BY pstype_desc,company_name "; $resultps=mysql_query($queryps); while($rowps = mysql_fetch_array($resultps)){ $companyname = $rowps['company_name']; $companyid = $rowps['ps_id']; $companylinkori = $rowps['company_link']; $companydescription = $rowps['company_description']; $logopath = $rowps['logo_filename']; $describelink = "index.php?view=describe&ttid=$ttid&pstypeid=$pstypeid&psid=$companyid"; if(!empty($companydescription)){ echo "<a href=\"$describelink\" target=\"_blank\"><img src=".$logo_dir."/".$logopath." width=\"15%\" border=\"0\"></a>"; } else { echo "<a href=\"$describelink\" target=\"_blank\"><img src=".$logo_dir."/".$logopath." width=\"15%\" border=\"0\"></a>"; } } } } ?> Similar TutorialsHI guyz, want help in a code that can help find the GCD of two input numbers Use the example of GCD (12,15). I am brand new to php and the following code gives me an error of undefined variable although it seems to be defined. Please tell what I'm doing wrong cause this code comes from a book: <?php // Definition of the class Donation class Donation { private $name; private $amount; static $totalDonated = 0; static $numberOfDonors = 0; // Function to display what each person has donated function info() { $share = 100 * $this->amount / Donation::$totalDonated; return "{$this->name} donated {$this->amount} ({$share}%)"; } function __construct($nameOfDonor, $donation) { $this->name = $nameOfDonor; $this->amount = $donation; Donation::$totalDonated = Donation::$totalDonated + $donation; Donation::$numberOfDonors++; } function __destruct() { 109) Donation::$totalDonated = Donation::$totalDonated - $donation; Donation::$numberOfDonors--; } } It gives me the following error: Notice: Undefined variable: donation in C:\wamp\www\learnPHP\unitCounter.inc on line 109 Hey guys, i'm not just new here but i'm new to php.. I've been trying to edit some wordpress templates i was given, but there is some code in the footer/copyright files that i really don't understand at all .. Here is an example of the code ... Code: [Select] <?php $_F=__FILE__;$_X='Pz4JCQkJCTxkNHYgNGQ9ImYyMnQ1ciI+DQoJCQkJCQkNCgkJCQkJCTxwIGNsMXNzPSJjMnB5cjRnaHQiPkMycHlyNGdodCAmYzJweTsgYTAwOCAtIDwxIGhyNWY9Imh0dHA6Ly8xc3MzcjFuYzVjMm1wbDVtNW50MTRyNXMxbnQ1LjJyZyIgdDR0bDU9ImQ1djRzIGMybXBsNW01bnQxNHI1IHMxbnQ1IGMybXAxcjF0NGYgMXNzM3IxbmM1IG0xbDFkNDUgbTN0MzVsbDUiPmQ1djRzIGMybXBsNW01bnQxNHI1IHMxbnQ1IGMybXAxcjF0NGYgMXNzM3IxbmM1IG0xbDFkNDUgbTN0MzVsbDU8LzE+PC9wPg0KCQkJCQkJDQoJCQkJCQk8cCBjbDFzcz0icDJ3NXI1ZCI+DQogICAgICAgICAgICAgICAgICAgICAgICA8MSBocjVmPSJodHRwOi8vczRtM2wxdDQybjFzczNyMW5jNXY0NS5jMm0iIHQ0dGw1PSJzNG0zbDF0NDJuIDFzczNyMW5jNSB2NDUgcjVuZDVtNW50IG0zbHQ0c3MzcDJydCB0MTN4IGMybXAxcjF0NGYiIGNsMXNzPSJ3MjJ0aDVtNXMiPiZuYnNwOzwvMT4NCiAgICAgICAgICAgICAgICAgICAgICAgIDwvcD4NCgkJCQkJDQoJCQkJCTwvZDR2PjwhLS0gRW5kIGYyMnQ1ciAtLT4=';eval(base64_decode('JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw=='));?> Could someone please explain if there is a way of decoding this?? Thanks so much Hi all, I am completing an assignment for Uni and I have run it to a bit of difficulty. I hope someone can help me out. I am deleting a record from the database and I want it to then display the student record number, firstname and surname. I know it is probably something simple but I can see where I am going wrong! <?php $id=$_REQUEST['id']; $firstname=$_GET['firstname']; $surname=$_GET['surname']; $db="prs"; $link=mysql_connect("localhost","gandalf","bella") or die("Cannot Connect to the database!"); mysql_select_db($db,$link) or die ("Cannot select the database!"); $query="DELETE FROM students WHERE upn='".$id."'"; if(!mysql_query($query,$link)) {die ("An unexpected error occured while <b>deleting</b> the record, Please try again!");} else { echo "Student with Student Number #".$id." ".$firstname." ".$surname." removed successfully!";} ?>() Thanks in advance for any and all help, it is much appreciated. Cheers, Fergal Hi all I'm learning php and can't see where my error is in this simple code. I just want the country title to display with the states name below. here is the code. And thnk you for any help Code: [Select] // create arrays $_Mexico = array ('YU' => 'Yucatan', 'BC' => 'Baja California', 'QA' => 'Oaxaca'); $_US = array ('MD' => 'Maryland', 'IL' => 'Illinois', 'PA' => 'Pennsylvania', 'IA' => 'Iowa'); $_Canada = array ('QC' => 'Quebec', 'AB' => 'Alberta', 'NT' => 'North Territories', 'YT' => 'Yukon', 'PE' => 'Prince Edward Island'); // combine them $_N_america = array ('Mexico' => $_Mexico, 'United States' => $_US, 'Canada' => $_Canada ); // create loop foreach ($_N_america as $country => $list) { echo "<h2>$country</h2><ul>"; } foreach ($list as $k => $v) { echo "<li>$k - $v</li>\n"; } echo '</ul>'; I would love to find someone that I can ask all my annoying narbish questions to. Code: [Select] $username="a1624814_bento"; $password="Password123"; $database="a1624814_siteDB"; $localhost="mysql13.xxx.xxx"; mysql_connect($localhost,$user,$password); line 13 Code: [Select] mysql_connect($localhost,$user,$password); Quote Host '31.100.100.200 is not allowed to connect to this MySQL server in /home/member/insert.php on line 13 Now after I fix this, Im sure that I will hafve a string of other failiurs, what do i do with them? some i can figure out, and normally will try to figure something out before asking. Thanks for taking the time to read!!! Good day people, got this open source script for a dog pedigree database on the net. I have no programming skills at all. Need some help with the script, i want to change the font color of the Sire's side of the pedigree that is displayed , but have no idea how to do it, any help would be appreciated. Example of displayed pedigree - http://www.sa-apbt.co.za/details.php?id=63854 below are the code. Thanks in advance <?php function DbTriad($dogVO, $level, $generations, $childText) { global $THUMBNAIL_WIDTH; global $dogDAO; # do the individual. if ($level == $generations) { echo "<TD >"; } else { echo "<TD ROWSPAN=" . pow(2,($generations - $level)); echo " >"; } if (($dogVO != -1) && (!empty($dogVO ))) { if (empty($dogVO)) { echo "Unknown Individual"; } else { $name = $dogVO->name; $sireId = $dogVO->sire->id; $damId = $dogVO->dam->id; $landofbirth = $dogVO->landofbirth; $yearofbirth = $dogVO->yearofbirth; $color = $dogVO->color; $title = $dogVO->title; $photo = $dogVO->photo->thumb_ref; if (empty($photo)) $photo = $dogVO->photo->reference; } ### Highlight title w/ Blue font if (!empty($title)) { echo "<label>"; echo "<font color=\"blue\">$title</font><BR>"; echo "</label>"; } echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$dogVO->id.'">'; if (!empty($photo)) { echo '<p><img SRC="'.$photo.'" width="'.$THUMBNAIL_WIDTH.'"></p>'; } echo "$name</a>"; echo "<label>"; //if (($level <= 3) && (!empty($color))) { if (!empty($color)) { echo "<BR>$color "; } if (!empty($landofbirth)) { echo "<BR>$landofbirth"; } if (!empty($yearofbirth)) { echo "<BR>$yearofbirth"; } echo "</label>"; } else { echo " "; if (!empty($childText) ) echo '<a href="addDog.php?child='.$childText.'">Add Dog</a>'; } echo "</TD>"; # do the father. if ($level < $generations) { if (!empty($dogVO)) $childText = "fatherOf_".$dogVO->id; else unset($childText); $dogDAO = new DogDAO(); if (empty($sireId)) $father = null; else $father = $dogDAO->get($sireId); DbTriad($father, $level + 1, $generations, $childText); } # do the mother. if ($level < $generations) { if (!empty($dogVO)) $childText = "motherOf_".$dogVO->id; else unset($childText); $dogDAO = new DogDAO(); if (empty($damId)) $mother = null; else $mother = $dogDAO->get($damId); DbTriad($mother, $level + 1, $generations, $childText); } # finish up. if ($level == $generations) { echo "</TR><TR>"; } } # begin table echo '<table id="pedigree" align="center" width="96%" border="0"><tr><th colspan='.$generations.'>Pedigree of '.$dog->name.' '.$dog->title.'</th></tr>'; # do tree. $dogDAO = new DogDAO(); $dog = $dogDAO->get($currId); DbTriad ($dog, 1, $generations, null); # end table echo "</td></tr></table>"; ?>[/php] Hi guys - i have some code which echos an image from a directory based on the user who is logged in... Code: [Select] <?php //to display image from source $dir = "profpics"; $sql = "SELECT prof_pic FROM users WHERE username = '{$_SESSION['MM_Username']}'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0) die("Username not found in database."); $row = mysql_fetch_array($res); echo "<img src='$dir/{$row['prof_pic']}' width='38' height='38'><br>"; ?> I have some other code which allows users to post a message on my 'wall' The message is saved in my database in a 'messages' table with 3 columns: messageid, messgae, userid. The userid column is the same in my messages table as in my users table where the image is echo'd from. Can anybody help me write some code which will allow me to echo the images based on who created the message instead of who is logged in? Thanks in advance
Hello all, I'm a basic coder 😀 if($_POST['form']['hobby'] == '')  $modUserEmailText = str_replace('{hobby:caption} : {hobby:value}', ''<br/>'',$modUserEmailText);
{hobby:caption} : {hobby:value} Thanks a million! Hello guys! My name is João Miquelis, Im from Portugal and I am a real noob in php, so i hope i can count with ur help Ok, I am currently at Uni, with one of my units needing me to build a content management system. I have been learning PHP for about 2 months, so go easy on me. So I was developing happily, I was able to use the CMS to add a product, edit that product and delete it. I load it up today to carry on working on it, but find that adding a product no longer works. I investigate further and find that the HTML form on the "Add a product" section's processing page (createProduct.php) is not receiving the values from the form using the $_POST method, therefore the mysql query was containing empty values. I found this confusing as I had not changed any of the code. So i investigate further, creating a test php page, copying the $_POST method into here and echoing the variables. And.. it worked. Even more confused, I delved deeper and found that the culprit for the $_POST method not working was one of my includes. connection.php. Here is the connection.php include: Code: [Select] <?php //1. Create database connection $connection = mysql_connect("localhost", "root"); //No password on the DB yet as it is only local. if (!$connection) { die("Database connection failed: " . mysql_error()); } //2. Select database to use $db_select = mysql_select_db("cms",$connection); if (!$db_select) { die("Database selection failed: " . mysql_error()); } ?> And here is createProduct.php; Code: [Select] <?php require_once("../includes/connection.php");?> <?php require_once("../includes/functions.php");?> <?php ?> <?php //Populating the variables with values from the HTML form $Product_Name = mysql_prep($_POST['Product_Name']); $Price = mysql_prep($_POST['Price']); $Product_Information = mysql_prep($_POST['Product_Information']); $category_id = $_POST['category']; echo $Product_Name . "<br />"; echo $Price . "<br />"; echo $Product_Information . "<br />"; echo $category_id . "<br />"; ?> <?php //Creating and submitting the mysql query echo $category_id; $query = "INSERT INTO tblProducts( Product_Name, Price, Product_Information, category_id ) VALUES ( '{$Product_Name}', {$Price}, '{$Product_Information}', {$category_id} )"; echo $query; if (mysql_query($query, $connection)) { header("Location: createProduct.php"); exit; } //error handling else { echo "<p>Product creation failed.</p>"; echo "<p>" . mysql_error() . "</p>"; } ?> <?php mysql_close($connection); ?> So my question is.. why, when suddenly loading it up today after a few days absence would the database connection code be conflicting ONLY ON THIS PAGE. editing and deleting a product still work. I am truly stumped as this seems completley illogical and is probably something really obvious. Any help would be greatly appreciated. I have got some xml which I have ran $xml = simplexml_load_string($result); Now I need to be able to access the values in a for loop, I've done this before, but it escapes me. The XML code is as follows... <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <branches xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="http://webservices.vebra.com/export/xsd/v1/exportapi.xsd"> <branch> <name>Swindon</name> <firmid>11548</firmid> <branchid>1</branchid> <url>http://webservices.vebra.com/export/primaryexechomesAPI/v1/branch/3762</url> </branch> <branch> <name>Swindon</name> <firmid>17548</firmid> <branchid>11</branchid> <url>http://webservices.vebra.com/export/primaryexechomesAPI/v1/branch/10061</url> </branch> </branches> My code for trying to get the values when in a for loop is... # format xml and insert the different branches into the db $xml = simplexml_load_string($result); # loop through the number of branches //$branches = count($xml); for($b = 0; $b < count($xml); $b++) { //$name = $xml->name; //$name = $xml->['name']; //$name = $xml['name']; //$name = $xml['branch']; //$name = $xml->['branch']['name']; //$name = $xml[$b]->['branch']['name']; $name = $xml->['branch']['name']; print "<h1>Name</h1>"; } As you can see I've tried to get the value out, just cant seem to do it. Any help will be much appreciated! I have the following xml file... <property id="21179035" propertyid="111290" system="A" firmid="11548" branchid="1" database="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="http://webservices.vebra.com/export/xsd/v1/exportapi.xsd"> <reference> <agents>11290</agents> </reference> <address> <name>16</name> <street>Bardsey Close</street> <locality>Wootton Bassett</locality> <town>Swindon</town> <county>Wilts</county> <postcode>SN4 8NA</postcode> <custom_location>West of Swindon</custom_location> <display>Wootton Bassett, Swindon</display> </address> <price qualifier="" currency="GBP">107750</price> <rm_qualifier>0</rm_qualifier> <available>01/01/1900</available> <uploaded>04/08/2010</uploaded> <longitude>-1.886723</longitude> <latitude>51.54373</latitude> <easting>407855</easting> <northing>182820</northing> <web_status>1</web_status> <custom_status /> <comm_rent /> <premium /> <service_charge /> <rateable_value /> <type>Maisonette</type> <type /> <furnished>3</furnished> <rm_type>0</rm_type> <let_bond>0</let_bond> <rm_let_type_id>0</rm_let_type_id> <bedrooms>2</bedrooms> <receptions>0</receptions> <bathrooms>1</bathrooms> <userfield1 /> <userfield2>0</userfield2> <area measure="metric" unit="sqm"> <min>0</min> <max>0</max> </area> <area measure="imperial" unit="sqft"> <min>0</min> <max>0</max> </area> <description>Primary are pleased to offer this two bedroom first floor maisonette in Wootton Bassett. The accommodation comprises of private entrance hall, lounge, kitchen, two bedrooms and bathroom. The property also benefits from uPVC double glazing, central heating and two allocated parking spaces. No onward chain. </description> <hip> <energy_performance> <energy_efficiency> <current>67</current> <potential>77</potential> </energy_efficiency> <environmental_impact> <current>67</current> <potential>80</potential> </environmental_impact> </energy_performance> </hip> <paragraphs> <paragraph id="1" type="0"> <name>DESCRIPTION</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Primary are pleased to offer this two bedroom first floor maisonette in Wootton Bassett. The accommodation comprises of private entrance hall, lounge, kitchen, two bedrooms and bathroom. The property also benefits from uPVC double glazing, central heating and two allocated parking spaces. No onward chain. </text> </paragraph> <paragraph id="2" type="0"> <name>PRIVATE ENTRANCE PORCH</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Storage cupboard.</text> </paragraph> <paragraph id="3" type="0"> <name>PRIVATE ENTRANCE HALL</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Stairs leading to first floor. Radiator.</text> </paragraph> <paragraph id="4" type="0"> <name>FIRST FLOOR</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Landing: Loft access (part boarded), built in storage cupboard with hanging rail, airing cupboard. Doors leading to lounge, bathroom and both bedrooms.</text> </paragraph> <paragraph id="5" type="0"> <name>LIVING ROOM</name> <file ref="1" /> <dimensions> <metric /> <imperial /> <mixed>5.05m(16'7'') x 3.43m(11'3'')</mixed> </dimensions> <text>uPVC double glazed window to front elevation. TV point. Telephone point. Radiator. Door leading to:</text> </paragraph> <paragraph id="6" type="0"> <name>KITCHEN</name> <file ref="2" /> <dimensions> <metric /> <imperial /> <mixed>2.57m(8'5'') x 2.54m(8'4'')</mixed> </dimensions> <text>uPVC double glzed window to rear elevation. Wall and base units with rolled edge work surfaces over. Wall mounted central heating boiler and thermostat. Space for fridge freezer, oven and washer drier. Tiled splashbacks.</text> </paragraph> <paragraph id="7" type="0"> <name>BEDROOM ONE</name> <file ref="3" /> <dimensions> <metric /> <imperial /> <mixed>3.76m(12'4'') x 3.05m(10'0'')</mixed> </dimensions> <text>uPVC double glazed window to front elevation. Built in double wardrobe. Telephone extension. Radiator.</text> </paragraph> <paragraph id="8" type="0"> <name>BEDROOM TWO</name> <file /> <dimensions> <metric /> <imperial /> <mixed>3.71m(12'2'') x 2.26m(7'5'')</mixed> </dimensions> <text>uPVC double glazed window to rear elevation. Radiator.</text> </paragraph> <paragraph id="9" type="0"> <name>BATHROOM</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Obscure uPVC double glazed window to rear elevation. White suite comprising of panel bath with shower over, pedestal hand wash basin and low level WC. Radiator.</text> </paragraph> <paragraph id="10" type="0"> <name>VIEWING</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Strictly via our Swindon office telephone (01793) 641641, out of office hours Dawn Graham 07887763163.</text> </paragraph> <paragraph id="11" type="0"> <name>MORTGAGES</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>If you would like independent mortgage advice please call Primary Mortgage Centre on (01793) 616617. Home visits available.</text> </paragraph> <paragraph id="12" type="0"> <name>MONEY LAUNDERING</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Intending purchasers will be asked to produce identification documentation at a later stage and we would ask for your co-operation in order that there will be no delay in agreeing the sale.</text> </paragraph> <paragraph id="13" type="2"> <name /> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>This footer paragraph is an example only and should not be relied upon as complying with current legislation. These particulars, whilst believed to be accurate are set out as a general outline only for guidance and do not constitute any part of an offer or contract. Intending purchasers should not rely on them as statements of representation of fact, but must satisfy themselves by inspection or otherwise as to their accuracy. No person in this firms employment has the authority to make or give any representation or warranty in respect of the property.<br/></text> </paragraph> </paragraphs> <bullets> <bullet id="1">First Floor Maisonette</bullet> <bullet id="2">Two Bedrooms</bullet> <bullet id="3">Lounge</bullet> <bullet id="4">Kitchen</bullet> <bullet id="5">Private Entrance</bullet> <bullet id="6">Allocated Parking</bullet> <bullet id="7">Good Location</bullet> <bullet id="8">No Onward Chain</bullet> </bullets> <files> <file id="0" type="0"> <name /> <url>http://images.vebra.com/images/1548/001/type1/bardse~1.jpg</url> <updated>30/08/2011 17:03:00</updated> </file> <file id="1" type="0"> <name>LIVING ROOM</name> <url>http://images.vebra.com/images/1548/001/type1/bardse~2.jpg</url> <updated>30/08/2011 17:03:00</updated> </file> <file id="2" type="0"> <name>KITCHEN</name> <url>http://images.vebra.com/images/1548/001/type1/bardse~3.jpg</url> <updated>30/08/2011 17:03:00</updated> </file> <file id="3" type="0"> <name>BEDROOM ONE</name> <url>http://images.vebra.com/images/1548/001/type1/bardse~4.jpg</url> <updated>30/08/2011 17:03:00</updated> </file> <file id="4" type="9"> <name>Energy efficiency chart</name> <url>http://images.vebra.com/home/hip/EE_0275_067_077.png</url> </file> <file id="5" type="9"> <name>Environmental impact chart</name> <url>http://images.vebra.com/home/hip/EI_0275_067_080.png</url> </file> </files> </property> I have the following code... # address - basic info if(is_object($xml->address)) { foreach($xml->address as $address) { //print_r($property); $name = $address->name; $street = $address->street; $locality = $address->locality; $town = $address->town; $county = $address->county; $postcode = $address->postcode; $custom_location = $address->custom_location; $display = $address->display; $insertS = "INSERT INTO $tablec (pal, afield, bfield, cfield, dfield, efield, ffield, hfield, ifield, jfield) VALUES (110, '$bD->afield', '$name', '$street', '$locality', '$town', '$county', '$postcode', '$custom_location', '$display')"; $insertQ = mysql_query($insertS); $iid = mysql_insert_id(); } } # property - basic info if(is_object($xml)) { foreach($xml as $property) { //print_r($property); $long = $property->longitude; $lat = $property->latitude; $type = $property->type; $furnished = $property->furnished; $bedrooms = $property->bedrooms; $bathrooms = $property->bathrooms; $description = $property->description; $updateS = "UPDATE $tablec SET kfield = '$long', lfield = '$lat', mfield = '$type', nfield = '$furnished', ofield = '$bedrooms', pfield = '$bathrooms', atext = '$description' WHERE pal = 110 AND id = $iid"; $updateQ = mysql_query($updateS); print "<p>$updateS</p>"; } } The first bit is working fine (# address - basic info) and I am able to get the information out, however the longitude and latitude bit I'm struggling with (# property - basic info) Any help would be much appreciated. I need the following XML code http://primarymortgages.co.uk/dev/property-xml-donotdelete.xml to be entered into the database, while I have done the first bit... <code> # address - basic info if(is_object($xml->address)) { foreach($xml->address as $address) { $name = $address->name; $street = $address->street; $locality = $address->locality; $town = $address->town; $county = $address->county; $postcode = $address->postcode; $custom_location = $address->custom_location; $display = $address->display; $insertS = "INSERT INTO $tablec (pal, afield, bfield, cfield, dfield, efield, ffield, hfield, ifield, jfield) VALUES (110, '$bD->afield', '$name', '$street', '$locality', '$town', '$county', '$postcode', '$custom_location', '$display')"; $insertQ = mysql_query($insertS); $iid = mysql_insert_id(); } } # property - basic info if(is_object($xml)) { $long = $xml->longitude; $lat = $xml->latitude; $type = $xml->type; $furnished = $xml->furnished; $bedrooms = $xml->bedrooms; $bathrooms = $xml->bathrooms; $description = $xml->description; $updateS = "UPDATE $tablec SET kfield = '$long', lfield = '$lat', mfield = '$type', nfield = '$furnished', ofield = '$bedrooms', pfield = '$bathrooms', atext = '$description' WHERE pal = 110 AND id = $iid"; $updateQ = mysql_query($updateS); } </code> I need to be able to get the paragraphs... <paragraph id="1" type="0"> <name>DESCRIPTION</name> <file /><dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Primary are pleased to offer this two bedroom first floor maisonette in Wootton Bassett. The accommodation comprises of private entrance hall, lounge, kitchen, two bedrooms and bathroom. The property also benefits from uPVC double glazing, central heating and two allocated parking spaces. No onward chain.</text> </paragraph> <paragraph id="2" type="0"> <name>PRIVATE ENTRANCE PORCH</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Storage cupboard.</text> </paragraph> <paragraph id="3" type="0"> <name>PRIVATE ENTRANCE HALL</name> <file /> <dimensions> <metric /> <imperial /> <mixed /> </dimensions> <text>Stairs leading to first floor. Radiator.</text> </paragraph> etc, etc... However the following code isn't working for me... <code> # paragraphs print_r ($xml->paragraph); foreach($xml->paragraph as $paragraph) { $thetitle = $paragraph->title; $thetext = $paragraph->text; $insertS = "INSERT INTO $tablec (pal, afield, bfield, atext) VALUES (111, '$iid', '$thetitle', '$thetext')"; $insertQ = mysql_query($insertS); print "<p>$insertS</p>"; } </code> Can someone adjust the # paragraphs code for me so it can work Many Thanks. <?php $visitpage = "http://mywebsite.com/wp-content/uploads/test.jpg"; ?> <div style="text-align: center;"><img src=<?php echo $visitpage; ?>/></div> do you know why the image is not appearing in the coe above? why my syntax of php and html is wrong? I have used a tutorial to create an upload form for my website, it works fine until the file gets over 850 kb, how can I set it up so larg files 80 megs and up can be uploaded? Here is the simple code I am using,form Code: [Select] <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> PHP <html> Thanks <head> <title>My First PHP Page</title> </head> <body> <?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> </body> </html> Hye there im branded new in php here. Im trying to develop a system based on php and mysql. I have 20 fields on my database table. Im trying to separate fields into 2 forms which is each form contain 10 fields - form_1.php(contain 10 fields) -form_2.php(contain 10 fields) form_1.php and form_2.php is connected each other which is user have to insert data in the form_1.php and then there are NEXT button that will bring user to form_2.php.In the form_2.php there will be a SUBMIT button which send data to database. Im trying to do but i cannot go through can someone show me any way to ?? Hello, I'm new to PHP/MySQL. Here's the situation: I have a simple little database called, "quiz." (I want to keep it simple until I figure out what I'm doing.) This database has one user, me, and two tables: Questions (QuestionID, QuestionText), and Answers (QuestionID, OptionText) QuestionID is set to autoincrement. I have one record so the biggest QuestionID is 1. Here is the php file: <?php $link = mysql_connect('PathToMySQL', 'MyUsername', 'MyPassword'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected!'; mysql_select_db(quiz); $sql = 'SELECT QuestionID, MAX(QuestionID) FROM Questions;'; // everything works great until this point // but I want the store the data into a variable so the // answer form will know what QuestionID to assign to the answers. // So I tried the following: echo $sql; // but that just echoed the query itself, not the result. // I got: Connected!SELECT "QuestionID, MAX(QuestionID) FROM Questions;" // I was expecting to see: "Connected!1" // close database mysql_close($link); ?> I need to capture the value of QuestionID to pass that to the answers. How do I do that? Thank you all for this forum, and for any answers. That PHP manual is thick and complex. I always hate being a newbie. I have been in Newbieville for several languages now; this is no different. I can say from experience that the good news is that it gets better! Richard Hollenbeck hi I'm a newbie in php and I came across this Code: [Select] if($_SERVER['REQUEST_METHOD'] == 'POST'){ and this Code: [Select] $_POST = $this->_params; I know this might be a stupid question but can you please tell me what they are |