PHP - Double While Loop Question
Hi i am in a situation where i need to use two tables. please look at my code
$result= $db->dbrun('select * from table_user'); while($row = mysql_fetch_array($result)): echo $row['username'] . '<br />'; endwhile; now my problem is i wants to get something from other table where user id match with $row['id'], $result= $db->dbrun('select * from table_user'); while($row = mysql_fetch_array($result)): $query= $db->dbrun('select id from table_other where user_id =$row['id']'); while($user_row = mysql_fetch_array($query)): echo $row['username'] . ' - ' . $user_row['id'] . '<br />'; endwhile; endwhile; so my main question is is it ok to run $query within a while loop because i cant run this query without $row['id'] which i gets after loop started or is there any other good way. Thanks for answering. Similar TutorialsHey guys i need to generate a table for a multilevel marketing simulation of 10.000 members. It's a bi-level. All i need is a table with id, parrent I am lost with the double loop ... I have a query that gets staff on a particular day then performs a while loop selecting each member that works on that day and the times they work between. I have a for loop in that while loop that lists apointment times for each staff member every 15mins between the times they work, this works fine. I then have in the for loop a while loop that checks for existing appontments in the appointment table and changes the appointment slot for times that are booked to booked. I have found though that the second while loops causes doubling of results when an appointment is found, so I need to work out how to restructure this code so that i dont get the doubling effect of result. you can see the result of the script here http://justrelax.net.au/datetest.php and the code that causes the problem is // convert to US format $input="$month/$day/$year"; // readable date $readDATE="$day/$month/$year"; // convert for mysql date $sqlDATE="$year-$month-$day"; // get day of the week $weekday=date(l, strtotime($input)); echo $weekday."<br/>"; // get working staff from staff table $staffSQL=mysql_query("SELECT * FROM staff WHERE ".$weekday." != 'off' AND onLEAVE='no' AND ACTIVE='yes' ORDER BY staffID ASC"); // return results putenv("TZ=Australia/Adelaide"); while ($staff=mysql_fetch_array($staffSQL)) { $name=$staff['staffNAME']; $avail=$staff[$weekday]; $staffID=$staff['staffID']; list($first, $last)=explode(" ", $name); list($in, $out)=explode("-", $avail); $firstTIME="$sqlDATE $in:00"; $lastTIME="$sqlDATE $out:00"; echo "$first is available between $avail on $weekday<br/>"; $in2=strtotime($firstTIME); $out2=strtotime($lastTIME); $stop=$out2-900; echo $in2." - time start - $firstTIME<br/>"; echo $out2." - time finish - $lastTIME<br/>"; for ($inc=$in2;$inc<=$stop;$inc+=900) { $existSQL=mysql_query("SELECT * FROM appointment WHERE date='$sqlDATE' AND staffID='$staffID'"); if (mysql_num_rows($existSQL)>=1) { while ($appointV=mysql_fetch_array($existSQL)) { $resSTART=$appointV['dateTIME']; $length=$appointV['totalTIME']; $resEND=$resSTART+($length*60); if ($inc>=$resSTART && $inc<=$resEND) { echo "Appointment time is ".date("g.i a", $inc)." <font color='red'><< $first BOOKED</font><br/>"; } else if ($inc<$resSTART || $inc>$resEND) { echo "Appointment time is ".date("g.i a", $inc)." <font color='green'><< $first AVAILABLE</font><br/>"; } } } if (mysql_num_rows($existSQL)==0) { echo "Appointment time is ".date("g.i a", $inc)." <font color='green'><< $first AVAILABLE</font><br/>"; } } } could really use some help on this I have been trying different things for a few days now. Hello everyone! This is my first post. I am very new to php and mysql and coding in general. It has not been made 100% clear to me as to when I should use single quotes, double quotes, and {}. From what I gather you use single quotes for literal interpretation... so if you put something like a variable in single quotes and echoed it, it would literally echo it as it is written and not the value of the variable. in double quotes, I gather that it will echo the value of the variable. as for {} I am unclear as to when to use the curly brackets for a variable. I am assuming if you had a statement in single quotes and you put a variable in curly brackets you would get the value of the variable?
Edited by LazerOrca, 25 November 2014 - 11:20 PM. Hi All, I'm jumping back into PHP and I have a basic loop question that I'm struggling with. I'm using a "date picker" code to select times during the day and then using a javascript to calculate the total hours for the day. However, I'm struggling with the loop to print out the fields. I need a loop that will print the following: first iteration: value = 1 value = 2 value = 0 second iteration: value = 2 value = 3 value = 1 The code I'm using is the following: Code: [Select] for ($id = 1; $id <=45 ; $id++) { ?> <?php if($id % 2) { ?> <div id="labor_template_day_100"> <input type="text" name="time1000<?php echo $id; ?>""/> <input type="text" name="time1000<?php echo $id+1; ?>" /> <?php } ?> <input type="hidden" id="emp<?php echo $id-1; ?>hours" value="0"/> <?php if($id % 2) { ?> </div> <?php } } This prints: first iteration: value = 1 value = 2 value = 0 Inserts just a hidden form field, then: value = 1 value = 2 value = 2 See below: Code: [Select] <div id="labor_template_day_100"> <input type="text" name="time10001" id="time10001" size="7" value="06:00 AM" onChange="CalcHrs('time10001', 'time10002', '0');"/> <input type="text" name="time10002" id="time10002" size="7" value="06:00 AM" onChange="CalcHrs('time10001', 'time10002', '0');" /> <input type="hidden" id="emp0hours" value="0"/> </div> <input type="hidden" id="emp1hours" value="0"/> <div id="labor_template_day_100"> <input type="text" name="time10003" id="time10003" size="7" value="06:00 AM" onChange="CalcHrs('time10003', 'time10004', '2');"/> <input type="text" name="time10004" id="time10004" size="7" value="06:00 AM" onChange="CalcHrs('time10003', 'time10004', '2');" /> <input type="hidden" id="emp2hours" value="0"/> </div> <input type="hidden" id="emp3hours" value="0"/> I have a feeling this is something basic I need to change. hello im having a little trouble getting what i want back from my loop. on my page i have 2 placeholders. each placeholder needs to pull the element id from the db that belong in that placeholder so in the db i have these columns: id = (the placeholder id) number = (the placeholder number) element. = (the element id) for example: place holder 1 has element_id 1 & 2 place holder 2 has element_id 1 & 3 id - number - element_id 1 - 1 - 1 2 - 1 - 2 3 - 2 - 1 4 - 2 - 3 in the places holder if have: Code: [Select] //place holder 1 $phNo = "1"; $holder = Placeholders::find_by_phID($phNo); //place holder 2 $phNo = "2"; $holder = Placeholders::find_by_phID($phNo); this is the class code: - I MIGHT BE DOING THIS WRONG Code: [Select] public function find_by_phID($phNo=0){ $sql = "SELECT * FROM ".self::$table_name." WHERE number=".$phNo.""; $result_array = self::find_by_sql($sql); return !empty($result_array) ? array_shift($result_array) : false; } THIS IS WHAT I TRIED: inside the placeholder i put a loop: Code: [Select] <?php $phNo = "1"; $holder = Placeholders::find_by_phID($phNo); foreach ($holder as $holders){ echo "Elements id = ".$holder->contElements_id."<br />"; } echo "<br/>"; ?> but the retults are all wrong. it comes back with: Quote Elements id = 5 Elements id = 5 Elements id = 5 Elements id = 5 Elements id = 5 Elements id = 5 Elements id = 5 what placeholder 1 should come back with is just element id 1 & 2 Quote Elements id = 1 Elements id = 2 any thoughts thanks rick Hey guess I have a question about For Loops. I'm very new to php so please forgive anything stupid I am doing The follow code shows what I am trying to do with my for loop. It works great except that the $sizu value is spread out over all the fields. So instead of saying 150 in the first record set it prints 1 and then in the second record it prints 2 etc. Any idea what is causing this? If you need to see the rest of the code let me know I'm just trying to save bandwidth at first. for ($i=0; $i < count($var); $i++) { $quer = ("SELECT sbbx0, sbsizu FROM dwoshp WHERE sbfile = '$_POST[order]' and sbbrnu = '$_POST[location]' AND sbvaru = '$varu[$i]'"); $res = mysql_query($quer); while($r = mysql_fetch_array($res)) { $quant = $r['sbbx0']; $sizu = $r['sbsizu']; } $query_AddDots = "INSERT INTO tempresult(variety,grade,cont, quantity, size) VALUES ('$var[$i]', '$invgrade[$i]','TP','$quant', $sizu[$i])"; $AddDots = mysql_query($query_AddDots) or die(mysql_error()); } Hey everyone, I have a database list of staff members that work at my office. I want to list each staff member with a while loop. In the database there is a field named "admin" where the value is either "y" or "n." I want to list administration first, then everyone else alphabetically by their last name. I wrote the code below that should work (haven't tested it yet) but I'm wondering if there is an easier, more efficient way to accomplish this. Thanks for any input that you may provide. Code: [Select] <?php $result1 = mysql_query("SELECT `prefix`,`lname`,`pos` FROM staff WHERE staffid > '0' AND admin == 'y' ORDER BY `lname` DESC"); $result2 = mysql_query("SELECT `prefix`,`lname`,`pos` FROM staff WHERE staffid > '0' AND admin == 'n' ORDER BY `lname` DESC"); while ($row1 = mysql_fetch_row($result1)) { $prefix = $row1[0]; $lname = $row1[1]; $pos = $row1[2]; $fullname1 = "$prefix $lname ($pos)"; echo "$fullname<br>"; } while ($row2 = mysql_fetch_row($result2)) { $prefix = $row2[0]; $lname = $row2[1]; $pos = $row2[2]; $fullname2 = "$prefix $lname ($pos)"; echo "$fullname2<br>"; } ?> I was wondering if you loop through an array and in the foreach() you specify an if statement that unsets certain items from the array, if those get unset from the original loop. Probably doesn't make much sense so heres an example Code: [Select] <?php //say there are 3 items in the $parent array //say there are 10 items in the $items array //say only the second item in the $items array value_one equals "abcd" foreach($parent as $id => $value) { foreach($items as $key => $value) { if($items[$key]['value_one'] == "abcd") { unset($items[$key]); } } } ?> So on the first item in the parent array, all 10 items would be cycled through. On the second second item of the parent array, all 10 items would be cycled through and the one item that has value_one == "abcd" would be unset. So on the third item of the parent array, am i correct in assuming only 9 items would be cycled through because there would be only 9 items in the $items array? Hi guys. I am new here but have been following the board for about a month. I will try to contribute as much as possible. I was given a problem, and need some help out with it. Most of you will probably find it pretty simple. Here is what I have: ?> //Rewrite the while loop using a for loop. for echo "8 times $num is: " . ($num*. "<br/>" } /* For the output I need: 8 times 1 is:8 8 times 2 is:16 8 times 3 is: 24 8 times 4 is:32 8 times 5 is:40 8 times 6 is: 48 8 times 7 is: 56 8 times 8 is:64 8 times 9 is: 72 8 times 10 is: 80 */ ?> So basically I need to fill in that missing code(rewrite the while loop using a for loop) Thank you so much in advance! hello. i have a foreach loop thats pulling out information that i dont want. how do i stop it. this is the loop Code: [Select] //GET THE TEXT $PCa = PageContent::find_by_pageContID($PCidA); foreach ($PCa as $PCas){ $title = $PCas->title; $link = $PCas->link; echo $title; echo "<br/>"; } the loop sits inside this function which has more loops Code: [Select] function listNavText($PHGlidA, $PHLobA, $PHLodA){ //GET THE LANGUAGE $langBS = basicSettings::find_by_id(1); $langID = $langBS->language_id; //GET THE LIST ORDER $PHLoa = PhLists::find_by_order($PHGlidA, $PHLobA, $PHLodA); foreach ($PHLoa as $PHLoas){ $PHLidA = $PHLoas->id; //GET THE LIST TEXT IDS $PCba = PCbridge::find_by_list($PHLidA, $langID); foreach ($PCba as $PCbas){ echo $PCidA = $PCbas->pageContent_id; //GET THE TEXT $PCa = PageContent::find_by_pageContID($PCidA); foreach ($PCa as $PCas){ $title = $PCas->title; $link = $PCas->link; echo $title; echo "<br/>"; } } } } this is what it echoes out 105L1-Title1 118 116 114 112 110 108L2-Title4 111 109L2-Title5 113 115 117 106L1-Title2 119 107L1-Title3 the number at the start is the text id L1-Title1 to L1-Title5 are tiles ($title) the spaces are links ($links) the problem is that i don't want the link spaces showing. just the 5 titles thanks I have a script that displays a certain result set, the row I am concerned about is called 'endonum'. Some rows will have the same number in this field. Is there a way to only show 1 result with the same number in this field. The array will be like '1, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5' and so on, but I just want to display 1 of them, not all. Kinda confusing but maybe someone gets it. Here is the code. <?php $selectendo = mysql_query("SELECT * FROM endorse WHERE agency = '$agency' AND finalized = 'No'")or die(mysql_error()); while($showendo = mysql_fetch_array($selectendo)) { $endonumber = $showendo['endonum']; ?> <li><a href="viewendo.php?endonum=<?php echo $endonumber;?>">Endorsement Number:<?php echo $endonumber . " Date: " . $showendo['date'];?></a></li> <?php } ?> Ok guys and gals I'm gettin' old! I know this is simple but I've spent way too much time on this now and am crying 'uncle'! I'm trying load a multi-dementional array with mysql_fetch_array results but I'm not getting it. Here's the rough basis for what I'm trying to do: $result = mysql_query("SELECT * FROM phpbb_profile_fields_data"); $row = mysql_fetch_array($result) or die(mysql_error()); $some_array = array( array( 'member_name' => $row['pf_firstname'] . " " . $row['pf_lastname'], 'member_title' => $row['pf_title'], 'member_employer' => $row['pf_employer'], ), array( 'member_name' => 'Janet', 'member_title' => '47', 'member_employer' => 'Husband', ), ); Okay, so that loads two $some_array elements with data. The first element has the first row of the database in question. Works fine but useless. So, with a "while ($row = mysql_fetch_array($result) )" what do I need to do to fill the $some_array with the query results? Thanks! Due to my home brewed templating system I must use 'return' instead of 'echo' or 'print'. I have a simple database query and running a while loop where all rows are to "printed" to the browser. But when I use return only the first row is shown. Using echo will print out all of the rows as it should but of course it prints the rows outside of where they should in the template. This may be very simple but I am just starting out. I tried to use the forum's search to see if this has been answered but the daemon could not 'be reached' and searching on google brings up a ton of non-helpful links. The solution will be very helpful as I will be doing this A LOT in my scripts for my current project. Thank you! Hello Guys, I have a question. I have the following code to grab all of my $_POST vars and run through my filter function Code: [Select] foreach($_POST as $key => $value) { $mydata[$key] = filter($value); } Before using the foreach loop I was just doing the basic $var1 = $_POST['var1']; $var2 = $_POST['var2']; I'm going to have about 40 - 50 $_POST vars so my question is how do i return it as just a $var name instead of having to do this echo "<br><br><br>example1" . $mydata['var1']; echo "<br><br><br>example2" . $mydata['var2']; I guess its hard for me to explain.. Thanks for your help! This is more of a technical question that i could not find the answer to pn the php.net manual pages. take the folowing example code: foreach ($array as $key => $value){ $tempvariable = some_property_of($value); } unset($tempvariable); is that unset statement needed? Does PHP automatically destroy the variables once the foreach loop is left? Hey.
So the issue I'm having is consecutive loops on semi-large arrays, over and over. Consider this array:
$firstArray = array( 'row1' => array( 'dates' => array( '2014-01-01' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-02' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-03' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-04' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-05' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-06' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-07' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), ) ), 'row2' => array( 'dates' => array( '2014-02-01' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-02' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-03' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-04' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-05' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-06' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-07' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-08' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-09' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), ) ) );Originally the data comes from ~2-3 database tables, of course. But to ilustrate the point, this is how the main array looks like. This array usually contains anywhere between 10-50 rows, each row containing at least 10 dates, with 10 key/values each. And after setting up all the data, it needs to be processed. Currently this is how a friend of mine did it.. $placeDataHere = array(); foreach($firstArray as $key => $dates) { foreach($dates as $date => $values) { foreach($values as $key => $value) { $placeDataHere['DV_' . $date]['SM_' . $key] = 'KS_' . $value; //Followed by another ~50-70 lines of processing the 3 loop's data.. ... ... .... .... .... .... .... .... } } }Obviously this isn't good practise, but we can't seem to figure out a better way of doing it, since both the data and the loops are horribly nested. This loop and setup of $firstArray is run anywhere between 10-20 times/request, due to amount of users we wish to process. So, the result is that this code can take up to over 2-3 minutes to complete, which isn't really optimal performance. In short my question is, are there any better methods of handling this with the data setup we currently have? Below is my output on the browser: Student: Kevin Smith (u0867587) Course: INFO101 - Bsc Information Communication Technology Course Mark 70 Grade Year: 3 Module: CHI2550 - Modern Database Applications Module Mark: 41 Mark Percentage: 68 Grade: B Session: AAB Session Mark: 72 Session Weight Contribution 20% Session: AAE Session Mark: 67 Session Weight Contribution 40% Module: CHI2513 - Systems Strategy Module Mark: 31 Mark Percentage: 62 Grade: B Session: AAD Session Mark: 61 Session Weight Contribution 50% Now where it says course mark above it says 70. This is incorrect as it should be 65 (The average between the module marks percentage should be 65 in the example above) but for some stange reason I can get the answer 65. I have a variable called $courseMark and that does the calculation. Now if the $courseMark is echo outside the where loop, then it will equal 65 but if it is put in while loop where I want the variable to be displayed, then it adds up to 70. Why does it do this. Below is the code: Code: [Select] $sessionMark = 0; $sessionWeight = 0; $courseMark = 0; $output = ""; $studentId = false; $courseId = false; $moduleId = false; while ($row = mysql_fetch_array($result)) { $sessionMark += round($row['Mark'] / 100 * $row['SessionWeight']); $sessionWeight += ($row['SessionWeight']); $courseMark = ($sessionMark / $sessionWeight * 100); if($studentId != $row['StudentUsername']) { //Student has changed $studentId = $row['StudentUsername']; $output .= "<p><strong>Student:</strong> {$row['StudentForename']} {$row['StudentSurname']} ({$row['StudentUsername']})\n"; } if($courseId != $row['CourseId']) { //Course has changed $courseId = $row['CourseId']; $output .= "<br><strong>Course:</strong> {$row['CourseId']} - {$row['CourseName']} <strong>Course Mark</strong>" round($courseMark) "<strong>Grade</strong> <br><strong>Year:</strong> {$row['Year']}</p>\n"; } if($moduleId != $row['ModuleId']) { //Module has changed if(isset($sessionsAry)) //Don't run function for first record { //Get output for last module and sessions $output .= outputModule($moduleId, $moduleName, $sessionsAry); } //Reset sessions data array and Set values for new module $sessionsAry = array(); $moduleId = $row['ModuleId']; $moduleName = $row['ModuleName']; } //Add session data to array for current module $sessionsAry[] = array('SessionId'=>$row['SessionId'], 'Mark'=>$row['Mark'], 'SessionWeight'=>$row['SessionWeight']); } //Get output for last module $output .= outputModule($moduleId, $moduleName, $sessionsAry); //Display the output echo $output; I think the problem is that it is outputting the answer of the calculation only for the first session mark. How in the while loop can I do it so it doesn't display it for the first mark only but for all the session marks so that it ends up showing the correct answer 65 and not 72? Hey guys, Got another question im hoping someone can help me with. I have a foreach loop (for use in a mysql query): foreach ($interests as $interest) { $query .= "($id, $interest), "; } problem is i do not want the comma(,) in the last loop. Is there some kinda of function i can use so it does not insert it on last loop? Or should i just use a for loop with a nested if loop? something like ; for($i=0; $i < count($interests); $i++){ $query .= "($id, '$interests[$i]')"; if($i + 1 < count($interests)) { $query .= ", "; } } Cheers guys This is strange.. I have the following code that checks if there is currently a cap set on requests. Code: [Select] $result = mysql_query("SELECT cap FROM requests"); while($data = mysql_fetch_array($result)) { if ($data['cap'] == '1') { echo"<h1>Requests are currently disabled at this time.</h1>"; }else{ echo'<h1><a href="requestlivery.php">Request Livery</a> | <a href="requestlogo.php">Request Logo</a></h1>'; } } For some reason, this: <h1><a href="requestlivery.php">Request Livery</a> | <a href="requestlogo.php">Request Logo</a></h1> is printed out twice on the webpage. Like: Request Livery | Request LogoRequest Livery | Request Logo I even put that code on a brand new blank page, and it does the same thing. Any ideas as to why would it do that? Unk Can someone please tell me what i have got wrong here? I am trying to return value C if conditions a AND B are met or return value D. Not sure if its parenthesis or something else? <?php if (($row_Recordset4['multidirection']=="yes") && ($_POST["widthcheck"] < $row_Recordset4['drop'])) echo $row_Recordset4['width'];else echo $row_Recordset4['drop'] ?> Thanks |