Jump to content

fife

Members
  • Posts

    381
  • Joined

  • Last visited

Everything posted by fife

  1. I have the query below which works great. Alls I want to do is all the projects from the query grouped by the description. $query_rs_installs = "SELECT Calls.Call_Ref, Calls.Link_to_Contract_Header, Calls.Order_No, Calls.Date_Received, Calls.Scheduled_Date_Time, Clients.Co_Name, Clients.Post_Code, LU_Call_Types.Call_Type_Description, LU_Call_Types.Type_Band, LU_Call_Status.Call_Status_Description, LU_Company_Types.Company_Type_DescriptionFROM { oj (((Siclops_Dispense.dbo.Calls Calls INNER JOIN Siclops_Dispense.dbo.LU_Call_Types LU_Call_Types ON Calls.Call_Type = LU_Call_Types.Call_Type_Code) INNER JOIN Siclops_Dispense.dbo.LU_Call_Status LU_Call_Status ON Calls.Last_Event_Status = LU_Call_Status.Call_Status_Code) INNER JOIN Siclops_Dispense.dbo.Clients Clients ON Calls.Link_to_Client = Clients.Client_Ref) LEFT OUTER JOIN Siclops_Dispense.dbo.LU_Company_Types LU_Company_Types ON Clients.Company_Type = LU_Company_Types.Company_Type_Code}WHERE Calls.Link_to_Contract_Header = '".$row_rs_member['companyident']."' AND (LU_Call_Types.Type_Band = 'Project' OR LU_Call_Types.Type_Band = 'Project Complete' OR LU_Call_Types.Type_Band = 'Project Invoiced') AND (LU_Call_Status.Call_Status_Description = 'Reported Done' OR LU_Call_Status.Call_Status_Description = 'PTF Rep Done' OR LU_Call_Status.Call_Status_Description = 'Proforma Sent' OR LU_Call_Status.Call_Status_Description = 'Paperwork Recvd' OR LU_Call_Status.Call_Status_Description = 'In Query' OR LU_Call_Status.Call_Status_Description = 'Cryo PW Sent' OR LU_Call_Status.Call_Status_Description = 'Complete' OR LU_Call_Status.Call_Status_Description = 'Awaiting P/work' OR LU_Call_Status.Call_Status_Description = 'Awaiting Invoic' OR LU_Call_Status.Call_Status_Description = 'Await TB Return' OR LU_Call_Status.Call_Status_Description = 'ApplicationSent')GROUP BY LU_Call_Status.Call_Status_Description"; Now before the group by the query works fine. As soon as i write it in the query fails completely. I have also tried selecting distinct and unique on the same field but each time I write them in it fails. I believe this maybe because this is an MS SQL query and as such I may have the syntax wrong. Any ideas? Thanks guys
  2. Hi Barand. thanks for your reply. yes this database is a very old application and as such has weird table structures that we cant change or mess with. The table you wrote though actually looks like this part | status | qty used -----------|----------|----------- widget | I | 1 gixmo | I | 1 widget | N | 1 ----------------------|----------- so the gixmo was used but the widget was returned and not used
  3. Hi Psycho and all. Thank you for your reply and sorry for my late one. Ok I have tried this and fixed my query to stop using sprintf but it just shows no parts if I put this in. Psycho you seem to be on the right path but for some reason the query still fails. At the minute I have the query for just parts used as.... $query = "SELECT Call_Parts_Used.Part_No, Calls.Order_No, Calls.Call_Ref, Call_Parts_Used.Qty, Call_Parts_Used.Date, Call_Parts_Used.Description, LU_Call_Part_Status.Part_Status_DescFROM { oj (Siclops_Dispense.dbo.Calls Calls INNER JOIN Siclops_Dispense.dbo.Call_Parts_Used Call_Parts_Used ON Calls.Call_Ref = Call_Parts_Used.Link_to_Call) INNER JOIN Siclops_Dispense.dbo.LU_Call_Part_Status LU_Call_Part_Status ON Call_Parts_Used.Part_Status = LU_Call_Part_Status.Part_Status}WHERE Calls.Call_Ref = '$colname_rs_call' AND Call_Parts_Used.Part_Status = 'I' " This works fine. If we add GROUP BY Call_Parts_Used.Part_No to this query all of a sudden even this query comes back with no parts. Makes me think there is a deeper routed problem. Anyway . Basically I want to show all parts used "status I" minus the parts returned "status N" Each part has a qty field to state how many times it has been used or returned (depending on its status obviously). That seems to be it. I thought it would be simple but its causing major problems.
  4. So the question is I need to show the total of the parts used minus the total of parts returned! (realized I didnt actually ask the question). Is this possible?
  5. Hi all I have a query which echos all parts used in a job from a database. The table in question has a qty for amount used and a status of 'I' to say it has been used. Parts can also have a status of 'N'. This means they were initially sent out but were not used at the job and returned. Unfortunately due to database design which can not be changed as its a MS SQL program the returned part creates a new row instead of just being knocked of the total used. It gets the status of N this means that when I echo my parts qty with the query below its not taking into account that some parts were sent back. Now before I show the query let me explain what I have tried. I have tried using array_diff() to compare the arrays but realized that this was wrong. I have tried running the second query for the returns within the loop of the first query and then manipulating the results. This too was wrong. I tried using WHERE NOT EXISTS on the querys but this was removing duplicates not minus-ing the qty value. That leaves me to where i am now. completely stuck. Here is the parts used query. Please note this is a mssql query //the query for parts used in the header $query_rs_parts = sprintf("SELECT Call_Parts_Used.Part_No, Calls.Order_No, Calls.Call_Ref, Call_Parts_Used.Qty, Call_Parts_Used.Date, Call_Parts_Used.Description, LU_Call_Part_Status.Part_Status_DescFROM { oj (Siclops_Dispense.dbo.Calls Calls INNER JOIN Siclops_Dispense.dbo.Call_Parts_Used Call_Parts_Used ON Calls.Call_Ref = Call_Parts_Used.Link_to_Call) INNER JOIN Siclops_Dispense.dbo.LU_Call_Part_Status LU_Call_Part_Status ON Call_Parts_Used.Part_Status = LU_Call_Part_Status.Part_Status}WHERE Calls.Call_Ref = '$colname_rs_call' AND Call_Parts_Used.Part_Status = 'I' ORDER BY Call_Parts_Used.Description ASC");$rs_parts = odbc_exec($conn, $query_rs_parts);$row_rs_parts = odbc_fetch_array($rs_parts);$totalRows_rs_parts = odbc_num_rows($rs_parts); //on the page I have the loop<?php if ($totalRows_rs_parts > 0){?> <h3>Parts Used</h3><table width="600" border="0" cellpadding="5"> <tr> <td width="494"><strong>Description</strong></td> <td width="80" align="right"><strong>Qty</strong></td> </tr> <?php do { ?> <tr> <td> <?php echo $row_rs_parts['Description'];?></td> <td align="right"><?php echo number_format($row_rs_parts['Qty']); ?></td> </tr> <?php } while($row_rs_parts = odbc_fetch_array($rs_parts)); ?></table> <?php } else{echo "No parts have been used!";} ?>
  6. dont understand i mean
  7. ok so download the jquery UI but you only want the sortable plugin and its extensions. sample database structure, customerID, name, custOrder on your main page create something like below //so in your header link out to your jquery UI files <script src="/js/sort/js/jquery-ui-1.9.2.custom.js" type="text/javascript"></script><script src="/js/sort/js/touch.js" type="text/javascript"></script><script type="text/javascript"> $(function() { $("#sortable").sortable({opacity:0.6, stop: function(i) { $.ajax({ type: "GET", url: "sortable.php", data: $("#sortable").sortable("serialize"),success: $("#successorder").show().delay(1000).fadeOut('slow')}); } }); $("#sortable").disableSelection(); });</script> //first your query for the customers mysql_select_db($database_dbconnet, $dbconnet);$query_rs_page = sprintf("SELECT * FROM customers ORDER BY custOrder ASC");$rs_page = mysql_query($query_rs_page, $dbconnet) or die(mysql_error());$row_rs_page = mysql_fetch_assoc($rs_page); // then on the page <ul id="sortable"> <?php while($row = mysql_fetch_array($rs_page)){ echo "<li id='item_{$row['customerID']}'>{$row['name']}</li>"; }?> </ul> thats you main page. see how you echo the customer id into the item array? Thats what you want to parse to the next page. Create your self a new blank page with a link to your database. Call this page sortable.php to match what is in your header and make sure its in the same folder. On this page you wan to create a query which updates the custOrder in the customer table. foreach($_GET['item'] as $key=>$value) {mysql_select_db($database_dbconnet, $dbconnet); mysql_query("UPDATE customers SET `custOrder`='".intval($key)."' WHERE `customerID`='".intval($value)."'", $dbconnet) or die(mysql_error());} Thats basically it. JqueryUI handles the rest for you. When you have a list of customers you will now be able to select one and drag it into a new order. Jquery UI will then call the sortable.php and update the custOrder. As the query on the main page pulls results in order of custOrder ASC each time you load the page the new order will be saved. I hope that helps. Not the best coder myself but I managed to stumble through the UI tuts. PM me if you do understand anything and good luck
  8. bare with me ill do it now for you
  9. Hi Guys Ok i have a query which when a user types into a search box a city name the search box auto fills with other city names like the one they have typed The query for these city names is as follows $query_rs_city = "SELECT city.*, countries.countryID, countries.country FROM city INNER JOIN countries ON countries.countryID = city.cityCountryUK ORDER BY city.cityNameUK ASC";$rs_city = mysql_query($query_rs_city, $dbconnect) or die(mysql_error()); //and the record set do{ echo $row['cityname'];}while($row = mysql_fetch_assoc($rs_city)); As you can see the query uses a join so i can get the country name too (excuse the awful field names from the previous designer). Now when the results are pulled back they come in the order below on the results page liverpool, uk london, uk berlin, germany paris, france I would like them back in the following order on the results page UK liverpool london Germany Berlin Fance Paris I have tried changing the query to.... $query_rs_city = "SELECT city.*, countries.countryID, countries.country FROM city INNER JOIN countries ON countries.countryID = city.cityCountryUK GROUP BY city.cityCountryUK";$rs_city = mysql_query($query_rs_city, $dbconnect) or die(mysql_error()); //and the record set$country = false;do{ if($country != $row['country']){echo "<strong>$row['country']</strong>";} else {$country = $row['country'];} echo " $row['cityname']"; }while($row = mysql_fetch_assoc($rs_city)); but that seems to fail. Can anyone point me in the right direction please? Im a little stuck as to what to try next.
  10. I have just solved this for myself with Jquery UI. If you need a hand let me know. I can send you a copy of my files so you can see for yourself how its done
  11. Nogray thank you very much for your help that has fixed the issue for IE7. I have just spent a bit of time reading about commas in IE 7 and its problems. This is not the first time I have made this mistake but I think it will be the last now. Again thank you
  12. That will probably be the end of your replies. Id listen to Jessica as being a Guru, she knows her stuff. Best to learn and then post code you havent found else where or at least understand slightly yourself. Just stick to php form validation to start with then make it more fancy once it works however http://lmgtfy.com/?q=jquery+form+validation
  13. Hi guy I hope someone can help with this as im really panicking over it. Ok so im building my first CMS ever! Its about 5 months down the line. Im self taught so making lots of mistakes but im getting there. From the beginning I've been using..... http://caroufredsel.dev7studios.com/ for image scrollers and such. Works great!!!!!! I highly recommend!!!!!!! Basically I've come to check my webpage and it looks great. my images scroll and my services scroll. Ive checked it in Crome, firefox, safari, IE8, IE9 and it looks great. However load it in IE7 and real problems occur. It seems all my CSS to do with the carousel boxes just gets completely ignored! As much as i dont want to show a site that is working in a awful state with broken links and text im afraid ill have to for the purpose of this post. Please view the site in any browser then view it in IE 7 and you will see what I mean. wooden.yourarena.co.uk/ I have the code for the scroller below. $(document).ready(function() { $("#servicescroller").carouFredSel({ width: "100%", responsive: true, circular:true, infinite:true, height: 340, items: { visible: { min: 3, max: 4 }, width: 220, height: "variable", }, scroll: { duration: 1000, items: 1, pauseOnHover: true }, auto: 4000, swipe: true, mousewheel: true }); $("#foo<?php echo $row['randname'];?>").carouFredSel({ prev : { button : "#foo_prev", key : "left", items : 1, easing : "easeInOutCubic", duration : 750 }, next : { button : "#foo_prev", key : "right", items : 1, easing : "easeInQuart", duration : 1500 }, width: 500, height: 245, items : { visible :1, minimum: 1, width: 500, height: 250, }, direction : "up", scroll : { fx: "crossfade", pauseOnHover: true, }, auto : { duration : 2000, timeoutDuration: 5000, delay: 3000, pauseOnEvent: 'resume', } }).find(".<?php echo $row['randname'];?>").hover( function() { $(this).find("div").slideDown(); }, function() { $(this).find("div").slideUp(); } ); }); I have tried every combination of trailing comma's with and without and nothing seems to fix it. I can only assume something else on the page is interfering but I cant see what. I have used this scroller over and over and never had this problem. Can someone please at least tell me a way to debug the error or to even find what the error is. Im in dyer need of help as I have deadlines coming up which I am already way too far behind and I have no clue what the problem is. Thanks for your time guys
  14. Hi guys. Ok im trying to achieve pagination through PHP on a ODBC query. I have used the pagination before on mysql database so I know it works. I have copied the code and changed it up so it match's the correct criteria for ODBC or mssql however its not working. Or should I say it is partly. Basically the buttons appear to move through the records and the total records returned counter seems to be working but the loop brings back no results. If i remove the pagination parts from the query and load the page the records are returned. This show me that the query is at least right but something in my pagination is killing it when I put it in. $currentPage = $_SERVER["PHP_SELF"]; $maxRows_rs_installs = 5;$pageNum_rs_installs = 0;if (isset($_GET['pageNum_rs_installs'])) { $pageNum_rs_installs = $_GET['pageNum_rs_installs'];}$startRow_rs_installs = $pageNum_rs_installs * $maxRows_rs_installs; $query_rs_installs = "SELECT allcalldataall.Call_Ref, allcalldataall.Call_Status_Description, allcalldataall.Date_Received, allcalldataall.Order_No, allcalldataall.Scheduled_Date_Time, allcalldataall.Link_to_Contract_Header, allcalldataall.Severity_Description, allcalldataall.repdonedate, Clients.Co_Name, Clients.Post_Code, LU_Call_Types.Type_Band, LU_Company_Types.Company_Type_DescriptionFROM { oj ((Siclops_Dispense.dbo.allcalldataall allcalldataall LEFT OUTER JOIN Siclops_Dispense.dbo.LU_Call_Types LU_Call_Types ON allcalldataall.Call_Type_Description = LU_Call_Types.Call_Type_Description) LEFT OUTER JOIN Siclops_Dispense.dbo.Clients Clients ON allcalldataall.Client_Ref = Clients.Client_Ref) LEFT OUTER JOIN Siclops_Dispense.dbo.LU_Company_Types LU_Company_Types ON Clients.Company_Type = LU_Company_Types.Company_Type_Code}WHERE allcalldataall.Call_Ref >= 710000 AND (allcalldataall.Call_Status_Description <> 'Reported Done' AND allcalldataall.Call_Status_Description <> 'PTF Rep Done' AND allcalldataall.Call_Status_Description <> 'Proforma Sent' AND allcalldataall.Call_Status_Description <> 'Paperwork Recvd' AND allcalldataall.Call_Status_Description <> 'Left On Site' AND allcalldataall.Call_Status_Description <> 'In Query' AND allcalldataall.Call_Status_Description <> 'Cryo PW Sent' AND allcalldataall.Call_Status_Description <> 'Complete' AND allcalldataall.Call_Status_Description <> 'Cancelled Admin' AND allcalldataall.Call_Status_Description <> 'Cancelled' AND allcalldataall.Call_Status_Description <> 'Awaiting Invoic' AND allcalldataall.Call_Status_Description <> 'Await TB Return' AND allcalldataall.Call_Status_Description <> 'ApplicationSent') AND (LU_Call_Types.Type_Band = 'Project' OR LU_Call_Types.Type_Band = 'Install') AND allcalldataall.Link_to_Contract_Header = '".$row_rs_member['companyident']."'ORDER BY allcalldataall.Call_Ref DESC"; //im thinking the problem might be occuring on the line below but im not sure$query_limit_rs_installs = sprintf("%s LIMIT %d, %d", $query_rs_installs, $startRow_rs_installs, $maxRows_rs_installs); $rs_installs = odbc_exec($conn, $query_limit_rs_installs);$row_rs_installs = odbc_fetch_array($rs_installs); if (isset($_GET['totalRows_rs_installs'])) { $totalRows_rs_installs = $_GET['totalRows_rs_installs'];} else { $all_rs_installs = odbc_exec($conn, $query_rs_installs); $totalRows_rs_installs = odbc_num_rows($all_rs_installs);}$totalPages_rs_installs = ceil($totalRows_rs_installs/$maxRows_rs_installs)-1; $queryString_rs_installs = "";if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_rs_installs") == false && stristr($param, "totalRows_rs_installs") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_rs_installs = "&" . htmlentities(implode("&", $newParams)); }}$queryString_rs_installs = sprintf("&totalRows_rs_installs=%d%s", $totalRows_rs_installs, $queryString_rs_installs); // then further down the page i have a loop which looks as follows //first the pagination <table border="0"> <tr> <td><?php if ($pageNum_rs_installs > 0) { ?> <a href="<?php printf("%s?pageNum_rs_installs=%d%s", $currentPage, 0, $queryString_rs_installs); ?>">First</a> <?php } ?></td> <td><?php if ($pageNum_rs_installs > 0) { ?> <a href="<?php printf("%s?pageNum_rs_installs=%d%s", $currentPage, max(0, $pageNum_rs_installs - 1), $queryString_rs_installs); ?>">Previous</a> <?php } ?></td> <td><?php if ($pageNum_rs_installs < $totalPages_rs_installs) { ?> <a href="<?php printf("%s?pageNum_rs_installs=%d%s", $currentPage, min($totalPages_rs_installs, $pageNum_rs_installs + 1), $queryString_rs_installs); ?>">Next</a> <?php } ?></td> <td><?php if ($pageNum_rs_installs < $totalPages_rs_installs) { ?> <a href="<?php printf("%s?pageNum_rs_installs=%d%s", $currentPage, $totalPages_rs_installs, $queryString_rs_installs); ?>">Last</a> <?php } ?></td> </tr></table> // then below that i have a do while loop do { //some stuff }while($row_rs_installs = odbc_fetch_array($rs_installs));
  15. Brill thanks all. It now works using SELECT DISTINCT YEAR(FROM_UNIXTIME(creation_date)) as year FROM customer_details ORDER BY creation_date ASC
  16. Hi Jessica. Unfortunately that doesn't work and echos nothing when I run the loop. Awesome how you think in such simple terms Jessica thank you for your help. It still amazes me how complicated I tend to try and make things for myself.
  17. Im trying to create a repeated list of all the years forms have been filled in, in my database. The database has been running for 4 years and the row creation_date is unixtime. I want a list that looks as follows 2010 2011 2012 2013 to create this list I understand Im after creation_date between the highest and lowest value of Year in unixtime. So I wrote the following query mysql_select_db($database_dbconnet, $dbconnet); $query_rs_frmyear = sprintf("SELECT creation_date FROM customer_details WHEREcreation BETWEEEN (SELECT MIN(DATE_FORMAT(FROM_UNIXTIME(creation_date), 'Y')) AS lowyear FROM customer_details)AND (SELECT MAX(DATE_FORMAT(FROM_UNIXTIME(creation_date), 'Y')) AS highyear FROM customer_details)"); $rs_frmyear = mysql_query($query_rs_frmyear, $dbconnet) or die(mysql_error()); //echo the yearsdo {echo $row_rs_frmyear['creation_date']; } while($row_rs_frmyear = mysql_fetch_assoc($rs_frmyear)); Which fell flat on its face!!! Any ideas anyone?
  18. omg that worked!!!!!!!!!!!!!! thank you very much thats been getting me down all day. Love this forum. you guys always rock sox!!
  19. I'm having trouble comparing two arrays. Ive never worked with arrays like this till today so bare with me. Ill explain as best I can with my code. So I have one array Im pulling from the database. which I get as follows //now get all the tags mysql_select_db($db, $db); $getq = mysql_query("SELECT * FROM blogtags",$db); //create the tags array $arr1 = array(); do{ $arr1[] = $row['tagname']; }while($row = mysql_fetch_assoc($getq)); If I print the outcome of this $arr1 array(3) { [0]=> NULL [1]=> string(4) "cars" [2]=> string(4) "vans" } cars and vans are the only 2 entries in the database Next I have a form field called $_POST['hidden-tags']; which stores data as ....... tanks, bikes, trains here is the code I have to turn that into an array $arr2[] = explode(",",$_POST['hidden-tags']); if I echo that out I get array(1) { [0]=> array(4) { [0]=> string(4) "cars" [1]=> string(5) "bikes" [2]=> string(6) "trains" [3]=> string(5) "tanks" } } which are entries into the form (cars, bikes, trains, tanks) Now Im trying to only show items that are not in the first array with array_diff but for some reason it doesnt work correctly. First I can see in the second array does not look like the first and I dont understand why but im sure thats coursing problems!!!!! secondly If I run the code //show only items in the second array that are not in the first $tmp = array_diff($arr2, $arr1); var_dump($tmp); then this pops out array(1) { [0]=> array(4) { [0]=> string(4) "cars" [1]=> string(5) "bikes" [2]=> string(6) "trains" [3]=> string(5) "tanks" } } surely this should just show bikes, trains, tanks and not the cars as it appears in $arr1
  20. I have the following ajax call which seems to work great in chrome. When I run it in IE (all versions) it fails. the link you click is <a href="javascript:void(0);" onclick="getImages(1)">Folder 1</a> This calls the ajax function below. Excuse if its messy its my first ever call <script type="text/javascript"> $.ajaxSetup ({ cache: false }); function getImages(id) { $.ajax({ type: "POST", url: 'getImage.php', data: "id=" + id, success: function(data) { $('#scrolimg').html(data); $("#car1").carouFredSel({ auto : false, items : 4, scroll : 4, circular : false, infinite : false, prev : "#foo1_prev", next : "#foo1_next", swipe : { onTouch : true, onMouse : false } }); } }); } the getImage.php <?php do { $image = $_SERVER['DOCUMENT_ROOT']."/images/uploads/".$row_rs_image['thumbfile']; list($width, $height)= getimagesize($image); ?> <img src="/images/uploads/<?php echo $row_rs_image['thumbfile']; ?>" width="<?php echo $width;?>" height="<?php echo $height;?>" /> <?php } while ($row_rs_image = mysql_fetch_assoc($rs_image)); ?> This images are only outputted if there is a width and height value. This is a must with the carousel the images are displayed in. Which is fine because in chrome it works. When It comes to IE though. If I record the ajax output I can see the error. For the image to be displayed it needs a width and height The image being outputted in IE is <img src"/images/uploads/img_thumb.jpg" width="" height="" /> The same image in chrome <img src"/images/uploads/img_thumb.jpg" width="150" height="160" />
  21. Thanks Josh. Its been solved. I needed to use $_SERVER['DOCUMENT_ROOT'] $image = $_SERVER['DOCUMENT_ROOT'].$row_rs_imgpath['userimagespath'].$row_rs_smimg['thumbfile'];
  22. Im trying to echo the width and height of an image into a looping array I have. Everything other than the width and height seems to be there. The images are displayed in a carousel that I have. For the carousel to work properly it likes to have the image width and height. I dont want to enter manual values and distort the images!! Here is a snippet of my code. <?php do { $image = $row_rs_imgpath['userimagespath'].$row_rs_smimg['thumbfile']; $x= imagesx($image); $y = imagesy($image); ?> <img src="<?php echo $image; ?>" alt="<?php echo $row_rs_smimg['imgname']; ?>" width="<?php echo $x;?>" height="<?php echo $y;?>" /> <?php } while ($row_rs_smimg = mysql_fetch_assoc($rs_smimg)); ?> And when you view the page source code you get the following: <img src="/images/uploads/my-future-car-1358783315_thumb.jpg"width="" height="" /> <img src="/images/uploads/albert_docks_liverpool-1358872736_thumb.jpg" width="" height="" /> I have also tried list($width, $height)= getimagesize($image); but that doesnt work either.
  23. I have this code <script type="text/javascript"> $(document).ready(function() { // I added the video size here in case you wanted to modify it more easily var vidWidth = 300; // 425; var vidHeight = 200; // 344; var obj = '<object width="' + vidWidth + '" height="' + vidHeight + '">' + '<param name="movie" value="http://www.youtube.com/v/[vid]&hl=en&fs=1">' + '</param><param name="allowFullScreen" value="true"></param><param ' + 'name="allowscriptaccess" value="always"></param><em' + 'bed src="http://www.youtube.com/v/[vid]&hl=en&fs=1" ' + 'type="application/x-shockwave-flash" allowscriptaccess="always" ' + 'allowfullscreen="true" width="' + vidWidth + '" ' + 'height="' + vidHeight + '"></embed></object> '; $('.posthold:contains("youtube.com/watch")').each(function() { var that = $(this); var vid = that.html().match(/v=([\w\-]+)/g); // end up with v=oHg5SJYRHA0 that.html(function(i, h) { return h.replace(/(http:\/\/www.youtube.com\/watch\?v=+\S+\S?)/g, ''); }); if (vid.length) { $.each(vid, function(i) { that.append(obj.replace(/\[vid\]/g, this.replace('v=', ''))); }); } }); }); </script> It works great at embeding videos from url's. But I have a small problem with it that I have been trying to solve but i keep breaking the code. Basically I have the following div setup <div class="grid_10 alpha omega posthold" > <div class="clearfix"> <div class="grid_2 alpha"> <img src="/images/no-image/logo_default.jpg" width="100" height="100" /> </a></div> <div class="grid_8 omega"> <h1>Some Name Here</h1> <p>Some Comment here</p> </div> </div> </div> Im trying to get the video to appear directly after the closing paragraph tag where it says some comment here. The user enters the video as part of a post. I store the post in a database and when I pull the post out I swap the url from youtube to the embed code. This is a repeating div so there maybe many instances that a video appears. Is this even possible. At the minute the video appears after the last closing div tag.
  24. Thanks PFMaBiSmAd Ill do that now
  25. Ok I have a permission set in session. This permission can be 1,2,3. I have a page in which I echo the permission to make sure its correct. Currently when I view this page the permission is 1 at the top of the next page I have this if($_SESION['per']!='1'){ $url = "/members/?permission=false"; header("Location: $url"); } for some reason the redirect is running when it shouldnt as the per is 1!! Not only that but I want to allow 2 to view this page too so the code would read... if($_SESION['per']!='1' || $_SESION['per']!='2'){ $url = "/members/?permission=false"; header("Location: $url"); } but the first part isnt working so adding the other permission is pointless for now. Any ideas?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.