Jump to content

dk4210

Members
  • Posts

    154
  • Joined

  • Last visited

Everything posted by dk4210

  1. dk4210

    Hello!!!

    Hello, phpfreaks used to be my number 1 site for PHP. I drifted away, but I'm back now.
  2. Hello all, I need some help. I have a database structure like this Date | time | Walk-in 1 Front | Walk-in 1 Front | Walk-in 2 7/3/2016 | 0:01:01 | 5.00 | 4.86 | 4.31 7/3/2016 | 0:02:01 | 4.375 | 4.22 | 2.34 7/3/2016 | 0:03:01 | 5.13 | 4.12 | 3.65 7/3/2016 | 0:04:01 | 4.89 | 3.99 | 3.32 I want to be able to query it for the Highest, Lowest and the average ( I know I may have to add a drop down for this ) but I can't get it to work correctly. I'm using Highcharts and it is creating 3 bar graphs based on the values for Walk-in 1 Front, Walk-in 1 Front & Walk-in 2 Here is my code and here's the link - to see the bar graph - http://www.kellywebserv.com/temperature/ <?php $con = mysql_connect("localhost","****","####"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("mydb", $con); // Format the date // Today's date $date = date("m-d-Y"); // Convert date $date1 = str_replace('-', '/', $date); // Set date of previous day $from_date = date('n/j/Y',strtotime($date1 . "-1 days")); //echo "this is date" . $from_date; $query = mysql_query("SELECT * FROM SensorData WHERE Date = '$from_date' LIMIT 1"); $category = array(); $category['name'] = 'Date'; $series1 = array(); $series1['name'] = 'Walk-in 1 Front'; $series2 = array(); $series2['name'] = 'Walk-in 1 Rear'; $series3 = array(); $series3['name'] = 'Walk-in 2'; while($r = mysql_fetch_array($query)) { $category['data'][] = $r['Date']; $series1['data'][] = $r['Walk-in 1 Front']; $series2['data'][] = $r['Walk-in 1 Rear']; $series3['data'][] = $r['Walk-in 2']; } $result = array(); array_push($result,$category); array_push($result,$series1); array_push($result,$series2); array_push($result,$series3); print json_encode($result, JSON_NUMERIC_CHECK); mysql_close($con); ?>
  3. Hello Guys, I am looking for some help in showing an instant update without reloading Here is my code currently. It basically a query to the database to find out if the table has been updated. I would like to create a new page and past all this code on it, then add an ajax call to grab the vaues and instantly update the notification instead of reloading... Page 1 (with ajax call) ---------------------------- Page2 (This code). I would like it to constantly look for changes.. I need some help getting started.. Please advise.. <?php $testvar="1"; echo "<span class=\"welcometxt\">Welcome: "; if ($_SESSION['fname'] == "") { echo "Guest </span></div>"; }else{ // Grab the session id(member-id) $m_id = $_SESSION['id']; // find out how many messages there are total with the status of 1 $result = mysql_query("SELECT * FROM notifications WHERE member_id=$m_id AND status=1"); $num_rows = mysql_num_rows($result); //Find out how many there are with the status of 1 and if the message has been read $resultcount = mysql_query("SELECT * FROM notifications WHERE member_id=$m_id AND status=1 AND m_read=1"); $num_rows2 = mysql_num_rows($resultcount); // if there are no rows There should not be a link on the flag if ($num_rows == '0') { echo $_SESSION['fname']." ".$_SESSION ['lname']." <a href=\"#\" title=\"You have $num_rows2 Messages waiting in que\" id=\"message-tip\">"; echo"<img src=\"/images/flag_off.jpg\" border=\"0\"></a></span></span></div>"; // If the status is 1 and the message has been read }elseif ($num_rows > 0 && $num_rows2 =='0') { echo $_SESSION['fname']." ".$_SESSION ['lname']." <a href=\"".$_SESSION['site_url']."/index.php?content=messages\" title=\"You have no new Messages waiting\" id=\"message-tip\">"; echo"<img src=\"/images/flag_off.jpg\" border=\"0\"></a></span></span></div>"; // If the status is 1 and the message has been not been read }else if ($num_rows2 > 0){ echo $_SESSION['fname']." ".$_SESSION ['lname']." <a href=\"".$_SESSION['site_url']."/index.php?content=messages\" title=\"You have $num_rows2 NEW messages waiting!\" id=\"message-tip\">"; echo"<img src=\"/images/flag_on.jpg\" border=\"0\"></a></span></span></div>"; }else{ // Notify admin if there is a problem with this $t_error = 24; notify_Admin($t_error,$m_id,$ip); } } ?>
  4. Hello Guys, I need some help converting this ajax call to jquery but I am clueless to how to do it.. Please advise Here is my code <script type="text/javascript"> function loadXMLDoc(imgID,isSold,order) { if(isSold == 1) $('.soldWatermark').css('display',''); else $('.soldWatermark').css('display','none'); var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","artist_title.php?imgid=" + imgID ,true); xmlhttp.send(); } </script> The reason I want to change it to jquery is because I am seeing a strange error. When loading my site in IE - http://frameworksgallery.com/view_artist2.php?artist_id=Baskin_Fran 1. I click on the second thumbnail. 2. I click on the third thumb 3. I go back to the second thumb The large image does not display after re clicking. IE web developer tool says it is this that it's having an issue with xmlhttp=new XMLHttpRequest(); Thanks in advance..
  5. Hello Guys, I have a page with thumb nails and a large image that changes when clicking on thumbnail. I need to display dynamic title for the image. It wont display because the page is not reloading.. How do you pass the name so it will show up without reloading? Here is the JS for switching dynamically loading the large image <script language="javascript"> $(document).ready(function() { $('.thumbnail').live("click", function() { $('#mainImage').hide(); $('#atitle').hide(); $('#imageWrap').css('background-image', "url('/images/ajax-loader.gif')"); var i = $('<img />').attr('src',this.href).load(function() { $('#mainImage').attr('src', i.attr('src')); $('#imageWrap').css('background-image', 'none'); $('#mainImage').fadeIn(); $('#atitle').fadeIn(); }); return false; }); }); </script> Here is the link for the thumb // Thumbnail Display echo '<a href="artists/'.$artist.'/'.$imgname.'.jpg" class="thumbnail"><img src="artists/'.$artist.'/previews/'.$imgname.'.jpg" border="0" /></a>'; [/code] Link to the large image // Large image display echo '<img src="artists/'.$artist.'/'.$first_image.'.jpg" alt="Main Image" id="mainImage"/>'; Here is the php echo for the title <? echo str_replace('"', '`', $iname); ?> I need to some how pass a php var from the thumb link to the js and have it display dynamically (Without Reloading) Hope I explained this correctly.. Please advise.. Thanks, Dan
  6. Hello Guys, I have a var for height like $height="67" and want to be able to split that number into, so that I can display 6 feet 7 inches but I have not figured out how to do it.. Please advise.. This is the current code I am working with but doesn't work. The problem is that explode won't work without some type of separator. $height2 = explode(" ", $height); echo "This is feet". $height2[0] ."<br>"; echo "This is inches". $height2[1]. "<br>";
  7. Not sure why that is.. I found the fix on another site and it works fine...Just like I wanted it to..
  8. FYI - This is what I used to fix my issue $feature2 = explode(",", $features); $feature3 = implode(',', $feature2); // First Query to grab Feature1 $result = mysql_query("SELECT * FROM features WHERE f_id IN ( $feature3 ) ") or die("Sql error : " . mysql_error()); while($row = mysql_fetch_assoc ($result)){ $f_name=$row["f_name"]; echo "<br>".$f_name; }
  9. Shouldn't it be $feature2 = explode(",", $features); Instead of $feature2 = explode(",", $features2);
  10. So what can be used instead of IN for arrays?
  11. Hi Bspace, That didn't work.. Nothing was printed from the while loop
  12. Basically, I am querying one table and getting the id(s) of features (see attachment #1) Then I want to query the "Features" table for the names (See attachment #2)
  13. Hello Guys, I have a question I have the following query $result3 = mysql_query("SELECT * FROM table1 WHERE ad_id='$id2'") or die(mysql_error()); $row3 = mysql_fetch_array( $result3 ); // Grab all the var $features = $row3['features']; I am turning it into an array (comma separated) $feature2 = explode(",", $features); print_r($feature2); ) The result is like so Array ( [0] => 5 [1] => 9 [2] => 13 I want to query the features for just the ids (F_name) are for the features . This query will show all.. I would like to just display the f_name values from the array query. // build and execute the query $sql = "SELECT * FROM features"; $result = mysql_query($sql); // iterate through the results while ($row = mysql_fetch_array($result)) { echo $row['f_name']; echo "<br />"; } Please Advise.. Thanks, Dan
  14. Hello guys, Got a question here.. If I have a database table called features with the following columns with example f_id | f_name | f_status 1 | deck | 1 2 | Fireplace | 1 3 | Alarm | 1 I have another table another table called ads that has a column called features and it has the following 1,2,3 (for example) I want to be able to query the db and display all the f_name. Here is what I have so far but it's not working and need some help // Query the ads table $result3 = mysql_query("SELECT * FROM ads WHERE ad_id='$id2'") or die(mysql_error()); $row3 = mysql_fetch_array( $result3 ); $features = $row3['features']; echo'This is the features ' . $features .''; $feature2 = explode(",", $features); print_r($feature2); echo "test" . $feature2[0]; // piece1 echo $feature2[1]; // piece2 $result = mysql_query("SELECT * FROM features WHERE f_id=$feature2[1]") or die("Sql error : " . mysql_error()); while($row = mysql_fetch_assoc ($result)){ $f_name=$row["f_name"]; echo $f_name; }
  15. PERFECT - silkfire! worked like a champ! Thnak you also PFMaBiSmAd !
  16. Hello Guys, I need some help here.. I am trying to extract the lat and long from a json query from google. Here is what I receive back from json { "name": "795PollardBlvdSW,Atlanta,GA", "Status": { "code": 200, "request": "geocode" }, "Placemark": [ { "id": "p1", "address": "Atlanta, GA, USA", "AddressDetails": { "Accuracy" : 4, "Country" : { "AdministrativeArea" : { "AdministrativeAreaName" : "GA", "SubAdministrativeArea" : { "Locality" : { "LocalityName" : "Atlanta" }, "SubAdministrativeAreaName" : "Fulton" } }, "CountryName" : "USA", "CountryNameCode" : "US" } }, "ExtendedData": { "LatLonBox": { "north": 33.8231844, "south": 33.6747422, "east": -84.2599230, "west": -84.5160418 } }, "Point": { "coordinates": [ -84.3879824, 33.7489954, 0 ] } } ] } Here is the code I am using $geocode=file_get_contents('http://maps.google.com/maps/geo?output=json&q=795PollardBlvdSW,Atlanta,GA'); $output= json_decode($geocode); $lat = $output->results[0]->geometry->location->lat; $long = $output->results[0]->geometry->location->lng; echo $lat; echo $long; Just not sure how to pull the lat and long out of a json into vars.. Please advise.. Dan
  17. Hello Guys, I have a question I have the following function that is located in a different file. I want to be able to use the $lat and $long in my main page how would I code it? function toCoordinates($all_address) { $bad = array( " " => "+", "," => "", "?" => "", "&" => "", "=" => "" ); $all_address = str_replace(array_keys($bad), array_values($bad), $all_address); $data = new SimpleXMLElement(file_get_contents("http://maps.google.com/maps/geo?output=xml&q={$all_address}")); $coordinates = explode(",", $data->Response->Placemark->Point->coordinates); return array( "latitude" => $coordinates[0], "longitude" => $coordinates[1] ); } Tried this but it didn't work $all_address2 = toCoordinates($all_address); echo "$all_address2; Please advise... Thanks, Dan
  18. Hello Guys. I have a question here.. I have a photo upload script that uploads photos to the server and then sends the photo name to another page via POST. I only have one var name called $image_all when I echo it this is what I get (When uploading 2 files) This is the list 2011-12-05_0751.png,2011-12-05_0747.png I also tested with "explode" print_r(explode(',', $image_all, 10)); and I get this Array ( [0] => 2011-12-05_0751.png [1] => 2011-12-05_0747.png [2] => What I would like for it to do is assign an incremental var name to each image uploaded and passed in the POST. Like this $image1 = 2011-xx.png $image2 = 2011-xx.png $image3 = 2011-xx.png It should created the variable names dynamically based on the number of images (Up to 10) Thanks for your help!
  19. Hello Guys, I have a question here.. I have a scroller on my pages that basically reads a text file and displays.. The problem that I am having is it doesn't update until I reload the page(even though the .txt file updates about every 3 minutes).. I would like it to update when the file has been changed.. Here is my page. <link rel="stylesheet" href="../../css/li-scroller.css" type="text/css"> <script src="../../js/jquery.li-scroller.1.0.js" type="text/javascript"></script> <script type="text/javascript" src="../../jquery-1.6.1.min.js"></script> <script type="text/javascript"> $(function(){ $("ul#ticker01").liScroll(); }); </script> <?php $file = file_get_contents ('playingnow.txt'); ?> <div class="scrollpos"> <ul id="ticker01"> <li><a href="#"><?php Echo $file;?></a></li> <!-- eccetera --> </ul> </div> What can I add to make it go out and reload just the div not the entire page? Please advise..
  20. That's what I ended up doing and it's working. Thanks for your help!
  21. Yea I noticed that after wards and fixed it but still having the issue..
  22. Hello Can some one help me with a problem Problem with my iframe div overlapping another div. http://screencast.com/t/uFdidurNxC <div class="iframe1"> <iframe src="image_upload/main/index.php?test=21" id="MyFrame" frameborder="0" marginheight="0" marginwidth="0" width="900px" height="900px" scrolling="auto"></iframe> <div> <div class="clear"> </div> <div id="adcanvas" class="bldtxt">Place Ad</div> css for both .uploadwrappper { width:800px; margin-left:20px; } .upcontainer { margin: 0 auto; padding: 20px 0 0; width: 960px; } .upload_iframe{ width: 940px; } .iframe1 { height:100px; margin-bottom:5px; width:100%; padding:5px; float:left; position: relative; z-index:1; } #adcanvas2 { background-color:#c6c7c9; width:900px; margin:20px; padding:5px; float:left; position: relative; z-index:1; } iframe { float:left; z-index:1; } How can I get the other div to just move down instead of it over lapping Please advise.. Thanks, Dan
×
×
  • 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.