PHP - I'm Having Trouble Listing The Latest Data.
I'm having trouble listing the most recent 10 content. How can I solve this problem. $sorgu = mysqli_query("select * from icerik order by id desc limit 0,10");
while($goster=mysqli_fetch_assoc($sorgu)) { } error code: Fatal error: Uncaught ArgumentCountError: mysqli_query() expects at least 2 arguments, 1 given in C:\xampp\htdocs\blog\orta.php:3 Stack trace: #0 C:\xampp\htdocs\blog\orta.php(3): mysqli_query('select * from i...') #1 C:\xampp\htdocs\blog\index.php(4): include('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\blog\orta.php on line 3 Similar Tutorialshello guys, I'm stuck he I have a table called customer_messages which has a entryid, custid, fromname, message, flag i have written a script to enter data into this. and another script to count the number of entries in the table. now i want to display entries in the table on to a script what i did was this: flag is by default '0' which mean unread. insertion code: Code: [Select] insert into customer_messages (customer_id,customer_fname,customer_message,flag) values('21','mike','hello!','0') fetching number of unread messages Code: [Select] select count(*) from customer_messages where flag = '0' $q = "select count(*) from customer_messages where flag = '0'"; $w = mysql_query($q); $r = mysql_fetch_array($w); $t = $r[0]; $t now gives me total number of unread messages in the db. now, I want to display these messages on to a page in the following format: ----------------------------------------------------------------------------------------------- | sender | message | mark as read | ----------------------------------------------------------------------------------------------- | name_from_db | message_from_db | check box | ----------------------------------------------------------------------------------------------- | name_from_db | message_from_db | check box | ----------------------------------------------------------------------------------------------- how do I do this? I'm assuming that I have to use a loop here, I put the code in a while loop, but that didnt work out for me. can I use a for loop here? if yes how do i use it? my brain's froze now so, i cant think atm, can someone help me out please? ================================================================================= in short i need the data from database to be listed as listbox control in asp.. is it possible? Hi there im not quite sure how to do something and was wondering if anyone can help me, I am going to create a large database with lots of fields and these are going to be displayed on a page i want to limit it to 20 per page and be able to sort them aswell by ID (default) and then a-z or z-a, i dont know how to do this and i also need to know how to create the next previous and last and first links im guessing theres a count++ involved ? im not quite sure but anyway if someone can help it will be great. Thanks, Blink359 Ok...working with serialized data is not fun. This is how WordPress does it. I had something working a little, but it wasn't getting all the information I needed. The query below appears to retrieve all the information I need. What I'm trying to do is determine what type of Subscription (s2member_level) a User gets and where they live (county). I eventually want to show the total number of each group, as well as the Usernames (only 18 total right now). The below code SHOULD look like this: Region 1: ## members Region 2: ## members Region 3: ## members Region 4: ## members Region 5: ## members But...right now it just shows Region : 18 members (no number after the region) Code: [Select] $custom = 'SELECT * FROM wp_usermeta um1 INNER JOIN wp_usermeta um2 JOIN wp_users u ON um1.user_id=um2.user_id WHERE um1.meta_key = "wp_s2member_custom_fields" AND um2.meta_value LIKE "%s2member_level%" AND um1.user_id = u.ID GROUP BY um1.user_id'; $c_results = mysql_query($custom); $region = array(); while($line = mysql_fetch_assoc($c_results)) { $meta_value = unserialize($line['um1.meta_value']); $region[$meta_value['county']]++; }; foreach ($region as $key => $value) { echo "Region $key: $value members<br>"; } This is just a sample of the data retrieved for four Users. I used the Inner Join through help on here. Each row shows two entries from the same table. The code above appears to be counting the valid results properly, but it's not dividing them up. So it appears to work down to the "foreach" part. Quote umeta_id user_id meta_key meta_value umeta_id user_id meta_key meta_value 15624 1073 wp_s2member_custom_fields a:1:{s:6:"county";s:1:"1";} 15617 1073 wp_capabilities a:1:{s:15:"s2member_level2";s:1:"1";} 16041 1094 wp_s2member_custom_fields a:1:{s:6:"county";s:1:"3";} 16034 1094 wp_capabilities a:1:{s:15:"s2member_level2";s:1:"1";} 16491 1117 wp_s2member_custom_fields a:1:{s:6:"county";s:1:"2";} 16484 1117 wp_capabilities a:1:{s:15:"s2member_level2";s:1:"1";} 16671 1126 wp_s2member_custom_fields a:1:{s:6:"county";s:1:"3";} 16664 1126 wp_capabilities a:1:{s:15:"s2member_level2";s:1:"1";} Hello, I'm having trouble inserting data into a MySQL table. The user has a form which is HEIGHT and WIDTH and NUMBER_OF_OBSERVATIONS. All these values are stored in the same table. NUMBER_OF_OBSERVATIONS does what it needs to and inserts its calculated results into the database, as does DATE_TIME. I've been trying for a couple of days to get this done, and I am having no luck in getting it sorted. Any help is greatly appreciated! Generator.php Code: [Select] $WIDTH = $_POST['WIDTH']; $HEIGHT = $_POST['HEIGHT']; $NUMBER_OF_OBSERVATIONS = $_POST['NUMBER_OF_OBSERVATIONS']; $db1 = new Number_Information(); $db1->openDB(); $OBSERVATION_ID = $db1->insert_Observation(); echo "<br /><br />Success. ID: <strong>$OBSERVATION_ID<strong>"; $db1->closeDB(); Number_Information.php Code: [Select] function insert_Observation() { //$Date_Now = datetime(); $sql = "INSERT INTO Observations (DATE_TIME, HEIGHT, WIDTH) VALUES (NOW(), '{$esc_HEIGHT}','{$esc_WIDTH}' )"; $result = mysql_query($sql, $this->conn); if (!$result) { die("SQL Insertion error: " . mysql_error()); } else { return mysql_insert_id($this->conn); } The table name is Observations Again - Any help is greatly appreciated! Hey, Having some troubles extracting data from simpleXML object. var_dump outputs all the stuff correctly but when i try access data in the object, it just comes back empty. $rss = "/data/rss/"; $rss = file_get_contents($rss); // simplexml_load_file() fails $feed = new SimpleXMLElement($rss); foreach($feed->item as $news) { echo $news->title; // returns empty } echo $feed->item->title; // also is empty so var_dump($feed) outputs this, shortened version: object(SimpleXMLElement)#10 (2) { ["@attributes"]=> array(1) { ["version"]=> string(3) "2.0" } ["channel"]=> object(SimpleXMLElement)#11 (6) { ["title"]=> string(38) "Bradford Bulls Super League Rugby News" ["description"]=> string(75) "RSS Feed for the latest Bradford Bulls Super League rugby news and updates." ["link"]=> string(46) "http://www.superleaguefans.com/bradford-bulls/" ["language"]=> string(2) "en" ["pubDate"]=> string(26) "Sat, 03 Sep 13:42:39 +0100" ["item"]=> array(10){ [0]=> object(SimpleXMLElement)#12 (1) { ["title"]=> string(32) "Briggs and Walker in Bulls squad" } } } } so, $feed->item->title should return the ["title"] contents, but it doesn't, driving me crazy. what am i doing wrong? Any pointers will be much appreciated, thank you. Hi i'm new to PHP/web development but not new to coding. I have some php code that I grabed from a template where I am selecting data from a file and having it diplay on the screen in a form. My $query = "select * from file where" statement works and bring the data back to the screen. However, I want the data to be returned in a textarea instead of a text field that is not big enough to display the 3 paragraph that i need to display. Please see code below, thsi code will return the data but the text box only returns the data in a line, I need the data to be returned in a textarea, so I can update it. I have looked for the correct syntex with no luck, please correct me. $row = mysql_fetch_array($result, MYSQL_ASSOC); $recordid = $row['recordid']; $homepage = $row['homepage']; echo "<h2>Update About Us Information</h2>\n"; echo "<form enctype=\"multipart/form-data\" action=\"admin.php\" method=\"post\">\n"; echo "<table width=\"100%\" cellpadding=\"1\" border=\"1\">\n"; echo "<tr><td><h3>Record ID</h3></td><td>$recordid</td></tr>\n"; echo "<tr><td><h3>Homepage</h3></td><td><input type=\"text\" size=\"100\" name=\"homepage\" value=\"$homepage\" /></td></tr>\n"; echo "</table>\n"; echo "<input type=\"submit\" name=\"button\" value=\"Update\">\n"; echo "<input type=\"submit\" name=\"button\" value=\"Delete Product\">\n"; echo "</form>\n"; Hi: I am working with a PHP Event Calendar. I am having trouble displaying the data the way I want to. If a person clicks on a number/date in the calendar (17, for example) the data will display fine below the calendar.\ However, I want to display only the Event Title ("calName") in the date box as a link, and allow the user to click the title to go to a new page to see the full Event info. I can not get any of the data to display and hope someone can tell me what I'm doing wrong. This is the code: Code: [Select] <script> function goLastMonth(month, year){ // If the month is January, decrement the year if(month == 1){ --year; month = 13; } document.location.href = '<?=$_SERVER['PHP_SELF'];?>?month='+(month-1)+'&year='+year; } //next function function goNextMonth(month, year){ // If the month is December, increment the year if(month == 12){ ++year; month = 0; } document.location.href = '<?=$_SERVER['PHP_SELF'];?>?month='+(month+1)+'&year='+year; } function remChars(txtControl, txtCount, intMaxLength) { if(txtControl.value.length > intMaxLength) txtControl.value = txtControl.value.substring(0, (intMaxLength-1)); else txtCount.value = intMaxLength - txtControl.value.length; } function checkFilled() { var filled = 0 var x = document.form1.calName.value; //x = x.replace(/^\s+/,""); // strip leading spaces if (x.length > 0) {filled ++} var y = document.form1.calDesc.value; //y = y.replace(/^s+/,""); // strip leading spaces if (y.length > 0) {filled ++} if (filled == 2) { document.getElementById("Submit").disabled = false; } else {document.getElementById("Submit").disabled = true} // in case a field is filled then erased } </script> ............... <p> <div id="legend"> <img src="images/Cal-Icon.jpg" style="padding: 0 15px 15px 0;" /> Today is: <? $today = date("F j, Y, g:i a"); echo " $today " ?> </div> <?php //$todaysDate = date("n/j/Y"); //echo $todaysDate; // Get values from query string $day = (isset($_GET["day"])) ? $_GET['day'] : ""; $month = (isset($_GET["month"])) ? $_GET['month'] : ""; $year = (isset($_GET["year"])) ? $_GET['year'] : ""; //comparaters for today's date //$todaysDate = date("n/j/Y"); //$sel = (isset($_GET["sel"])) ? $_GET['sel'] : ""; //$what = (isset($_GET["what"])) ? $_GET['what'] : ""; //$day = (!isset($day)) ? $day = date("j") : $day = ""; //comparaters for today's date //$todaysDate = date("n/j/Y"); //$sel = (isset($_GET["sel"])) ? $_GET['sel'] : ""; //$what = (isset($_GET["what"])) ? $_GET['what'] : ""; //$day = (!isset($day)) ? $day = date("j") : $day = ""; if(empty($day)){ $day = date("j"); } if(empty($month)){ $month = date("n"); } if(empty($year)){ $year = date("Y"); } //set up vars for calendar etc $currentTimeStamp = strtotime("$year-$month-$day"); $monthName = date("F", $currentTimeStamp); $numDays = date("t", $currentTimeStamp); $counter = 0; //$numEventsThisMonth = 0; //$hasEvent = false; //$todaysEvents = ""; //run a selec statement to hi-light the days function hiLightEvt($eMonth,$eDay,$eYear){ //$tDayName = date("l"); $todaysDate = date("n/j/Y"); $dateToCompare = $eMonth . '/' . $eDay . '/' . $eYear; if($todaysDate == $dateToCompare){ //$aClass = '<span>' . $tDayName . '</span>'; $aClass='class="today"'; }else{ //$dateToCompare = $eMonth . '/' . $eDay . '/' . $eYear; //echo $todaysDate; //return; $sql="select count(calDate) as eCount from calTbl where calDate = '" . $eMonth . '/' . $eDay . '/' . $eYear . "'"; //echo $sql; //return; $result = mysql_query($sql); while($row= mysql_fetch_array($result)){ if($row['eCount'] >=1){ $aClass = 'class="event"'; }elseif($row['eCount'] ==0){ $aClass ='class="normal"'; } } } return $aClass; } ?> <table width="900" cellpadding="0" cellspacing="0"> <tr> <td width="50" colspan="1"> <input type="button" value=" < " onClick="goLastMonth(<?php echo $month . ", " . $year; ?>);"> </td> <td width="250" colspan="5"> <span class="title"><?php echo $monthName . " " . $year; ?></span><br> </td> <td width="50" colspan="1" align="right"> <input type="button" value=" > " onClick="goNextMonth(<?php echo $month . ", " . $year; ?>);"> </td> </tr> <tr> <th>S</th> <th>M</th> <th>T</th> <th>W</th> <th>T</th> <th>F</th> <th class="lastOne">S</th> </tr> <tr> <?php for($i = 1; $i < $numDays+1; $i++, $counter++){ $dateToCompare = $month . '/' . $i . '/' . $year; $timeStamp = strtotime("$year-$month-$i"); //echo $timeStamp . '<br/>'; if($i == 1){ // Workout when the first day of the month is $firstDay = date("w", $timeStamp); for($j = 0; $j < $firstDay; $j++, $counter++){ echo "<td> </td>"; } } if($counter % 7 == 0){ ?> </tr><tr> <?php } ?> <!--right here--><td width="128" <?=hiLightEvt($month,$i,$year);?>><a href="<?=$_SERVER['PHP_SELF'] . '?month='. $month . '&day=' . $i . '&year=' . $year;?>&v=1"><?=$i;?></a> // TRYING TO DISPLAY CALENDAR EVENTS HERE <?php $sql="select calName,calDesc, DATE_FORMAT(calStamp, '%a %b %e %Y') as calStamp from calTbl where calDate = '" . $month . '/' . $day . '/' . $year . "'"; //echo $sql; //return; $result = mysql_query($sql); $numRows = mysql_num_rows($result); ?> <? while($row = mysql_fetch_array($result)){ ?> <div class="output"> <h5><?=$row['calName'];?></h5> <?=$row['calDesc'];?><br/> Listed On: <?=$row['calStamp'];?> </div> </td> </table> // END OF TRYING TO DISPLAY CALENDAR EVENTS HERE <?php } } ?> </p> Can anyone tell me what is wrong? Thanks! Hey guys, I have a script that grabs data from a separate .txt file which is used to perform certain actions within a user's account. The data I'm having trouble with is user key which is used to authenticate an http header. An example of what the txt file would hold is this: 360235276 PbI1c5+PGHSshccYd58AklmTgf5u+tbWZplMRYYxFSivRYw4AZhaVNHwADozYZhZhPnXRSV1rmsrhf1td7w6bJbySZmPHLl+hleyz/Ht4iM= 477947328 cXTnFEVP74RWtAgqM5BlwtgW2i9rP/v44oANzwF+yJZ+9mpvaschyo/HaYP1qUXgIK8nK7jy74iSCEHAgpPgPdryzpReM5cbnVDjRw7h9S0= 503724987 XXEJsklZTFaTx8MLjuNIz0S65Sn02rgbHl2sahdReQdadKP39 evIXUoYdr5NyQMWDVE7cRpvn+zJ7mteH7WJzVh0U/sOcSG7kfcuaWpAOfo= The format I have is: account_ID user_key New account on a fresh line. So in my script I have it grabbing the data as so: $User_DataFile = "accountdata.txt"; $AccData = file($User_DataFile, FILE_SKIP_EMPTY_LINES); foreach($AccData as $line_num => $line) { $AccData = explode(" ", htmlspecialchars(str_replace(" "," ",$line))); if(stristr($AccData[1], "\n")) $AccData[1] = substr($AccData[1], 0, strlen($AccData[1])-2); $AccountID = $AccData[0]; $UserKey = $AccData[1]; echo "Account ID: ".$AccountID."<br/>User Key: ".$UserKey."<br/><br/>"; I have it set to simply echo out the data for debugging which is where I noticed that any slashes or plus or equal signs were not included. When run in Apache it returns this: Account ID: 360235276 User Key: PbI1c5+PGHSshccYd58AklmTgf5u+tbWZplMRYYxFSivRYw4AZhaVNHwADozYZhZhPnXRSV1rmsrhf1td7w6bJbySZmPHLl+hleyz/Ht4iM Account ID: 477947328 User Key: cXTnFEVP74RWtAgqM5BlwtgW2i9rP/v44oANzwF+yJZ+9mpvaschyo/HaYP1qUXgIK8nK7jy74iSCEHAgpPgPdryzpReM5cbnVDjRw7h9S0 Account ID: 503724987 User Key: XXEJsklZTFaTx8MLjuNIz0S65Sn02rgbHl2sahdReQdadKP39 evIXUoYdr5NyQMWDVE7cRpvn+zJ7mteH7WJzVh0U/sOcSG7kfcuaWpAOfo So as you can see by comparison there is no slashes or plus or equal signs present, which is going to be a major problem. Is there any way of getting around this problem? Thanks. I'm trying to create a script to use PDO prepared statements to enter data from a post form using functions to perform the PDO required statements. But, it's not working. When I execute it, it enters null in all the fields. I'm hoping someone can tell me why this is not working. I think the functions output what PDO is looking for. I'm not sure how to do this otherwise without writing a lot of code like $site_name= $_POST['site_name']; and entering all of that in the PDO statments. It seemed like it made sense to create the statements from the post array. My code is included below and after that is some output I used to monitor what is going on that shows the output of the functions in the script. Am I doing this all wrong. Is another approach that I haven't discovered? Thanks --Kenoli <?php if(isset($_POST['submit'])){ /** Establish DB connection. Not real data, of course. */ $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); /** Remove empty $_POST elements. */ $insert_array = array_filter($_POST); /** Whitelists input to identify columns to which changes are allowed */ $whitelist = array('site_name' =>'', 'site_address' =>'', 'description' =>'', 'surface' =>'', 'tio_contact' =>'', 'site_contact' =>'', 'contact_phone' =>'', 'contact_email' =>'', 'contact_date' =>'', 'comments' =>''); $insert_array = array_intersect_key($insert_array,$whitelist); /************/ /** Create query from $insert_array. */ foreach($insert_array as $key => $value) { $col .= $key . ', '; $val .= ':' .$key . ', '; } /** Remove ', " from end of each array. */ /* For use with update actions to prevent deleting data from fields that contain data. */ $col = substr_replace($col ,"",-2); $val = substr_replace($val ,"",-2); $sql = "INSERT INTO Sites ($col) VALUES ($val)"; /* The result is: INSERT INTO Sites (site_name, site_address, description, contact_phone) VALUES (:site_name, :site_address, :description, :contact_phone)*/ /************/ /** Prepared statement functions */ $stmt = $conn->prepare($sql); foreach($insert_array as $key => $value) { $param = ':' . $key; $stmt->bindParam($param, $$value); echo '$' . "stmt->bindParam($param, $$key)<br>"; // Monitor output } foreach($insert_array as $key => $value) { $$key = $value; echo "$$key = $value<br>"; // Monitor output } $stmt->execute(); // Execute insert ?> The result with dummy data: $insert_array
(
$stmt->bindParam(:site_name, $site_name)
$site_name = asdfasdf Everything looks right but NULLs are inserted in all fields.
I am bit confused. Can we display the latest tweet in the webpage. Right now I just cheated and sorted by descending then put like thirty <br />'s so you couldn't see old ones. How can I do this properly? hey I am not usually in this php forum, I am usually around html/css but a task arose and I figure since this forum uses smf it would be a perfect place to ask. Not saying you are all smf experts though. My question is how do I display the latest posts for smf in a page thats not a forum page. Like On my index page I want to display the latest posts on the forum. Help anyone? I'm in the process of creating a webage that shows latest scores and an updated league table for soccer/football matches like the bbc sports website does. I have the database set up with a form to update and display latest score all work well apart from if i update a score like the following teamA 1 teamB 0 it updates table to give teamA 3 points based on the current score however if teamA score again teamA 2 teamB 0 it updates table again but gives teamA another 3 points which is not correct so i need a way to stop it happening. thought about it for a while and only thing i can come up with is some maths to compare the values of score for each team and add/remove points as dependent on current score. Anyone got something similar to this Hi, I want to get a latest video from Youtube Playlist. I look it on Google API, and the other solutions, but I think dont undestand quit good what I need to do. For example a have a playlist: https://www.youtube.com/playlist?list=PLW8l7rX2YaXkaSI8GGbmqPjOEmfzd2hz3 And I want to see always only a latest uploaded video, so I need a link (embed - watch, or "youtu.be/xy"): https://www.youtube.com/watch?v=LyzziLETNUw&list=PLW8l7rX2YaXkaSI8GGbmqPjOEmfzd2hz3 Thanks in advanced, T Hi Guys, Sorry if this is the wrong forum but i wasnt sure the best one. i am trying to see how others control the version of apps they have written and updating. i want to set the version of my app e.g. 1.0 and then have a section where if i release 1.5 it will show up that a new version is available for upgrade. the only thing im not too sure about is when someone goes to upgrade if not all of the updated files are uploaded correctly i want it to say version missmatch. could someone give me examples of how i could achieve this? Hello all, My question is about a custom-coded latest-news plugin written by someone else. I don't know if it is generic, a copy of something else or what. It works good! but when I go to add a new news item to the list under Settings, it adds the item to the bottom of the list. The news is displayed on my homepage in short form and in full format on the primary news page. I need new items to be added to the TOP of the list instead or in reverse, so that in all the containers where it resides, the latest news item added is always at the top of the list. I know nothing about php but I am looking to learn. I plan on taking some basic classes on css and php to upgrade my archaic html skills, but I'm currently studying other subjects. Regardless, if this has a simple fix, I would be very interested in knowing what is needed and where/why. Here is the core of the php that I am finding in the plugin: There are three php files, This one says active, the other two say inactive so I get the impression they are not in use. Let me know if I should post their contents as well. Appreciate any help with this! My sincere thanks in advance. Labeled active: latest_news.php */ob_start();register_activation_hook(__file__, latest_news_install);function latest_news_install() { global $wpdb; $table_name = $wpdb->prefix . "latest_news"; if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) { $sql = "CREATE TABLE IF NOT EXISTS " . $table_name . " ( `id` int(10) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `description` text NOT NULL, `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) );"; mysql_query($sql) or die(mysql_error()); }}if( !function_exists('wp_latest_news_init') ) { function wp_latest_news_init() { add_shortcode( 'wp_latest_news', 'shortcode_latest_news'); }}if( !function_exists('shortcode_latest_news') ) { function shortcode_latest_news() { // extract(shortcode_atts(array('limit' => '5', ), $atts)); global $wpdb; $user_count = $wpdb->get_results("SELECT * FROM wp_latest_news ORDER BY date ASC LIMIT 4"); foreach ($user_count as $output) { $htmlOutput[] = "<li><b><a href='". get_permalink(287)."?news_id=".$output->id."'>" . $output->title . "</a></b></li>"; } //echo $htmlOutput; //echo "<pre>"; print_r($user_count); echo "</pre>"; foreach ($htmlOutput as $out) { echo $out; } return $htmlOutput; }}/* add_action('init', 'wp_latest_news_init' ) is used for call init function for create shortcode */add_action('init', 'wp_latest_news_init' );add_action('admin_menu', 'wp_latestnews_links' );function wp_latestnews_links() { add_submenu_page( 'options-general.php', __( 'Latest News ' ), __( 'Latest News ' ), 5 , 'latest_news_settings', 'latest_news_settings' );}// function latest_news_settings() {// global $wpdb;// if (isset($_POST["submit"])) {// $sql="INSERT INTO ".$wpdb->prefix . "latest_news(`title`,`description`) VALUES ('".$_POST['news_title']."','".$_POST['description']."') ";// //$sql=$wpdb->insert( $wpdb->latest_news, array( 'title' => $_POST['news_title'] ,'description' => $_POST['description'] ) );// mysql_query($sql) or die(mysql_error());// }// include 'Latest_news_setting.php';function latest_news_settings() { global $wpdb; $action = $_REQUEST["action"]; $id = $_REQUEST['id']; $sql = "SELECT * from ".$wpdb->prefix."latest_news "; $results = $wpdb->get_results($sql); //echo "<pre>";print_r($results); //$post_arr = query_posts(""); //echo "<pre>";print_r($post_arr);exit; switch ($action) { case 'add' : include('news_form.php'); break; case 'save' : if(isset($_POST['cancel'])) { include('latest_news_list.php'); } else if(isset($_POST['add'])) { $wpdb->query("insert into ".$wpdb->prefix."latest_news (`title`,`description`) VALUES ('".$_REQUEST['news_title']."','".$_REQUEST['description']."')"); //header("Location: http://localhost:81/Bravo/wp-admin/edit.php?page=slider_images"); header("location:?page=latest_news_settings"); } break; case 'edit' : $sql = "SELECT * from ".$wpdb->prefix."latest_news where id = '".$id."' "; $results_arr = $wpdb->get_results($sql); //echo "<pre>";print_r($results_arr); include('news_form.php'); break; case 'update' : if(isset($_POST['cancel'])) { include('news_form.php'); } else if(isset($_POST['edit'])) { //echo $id; $wpdb->query("update ".$wpdb->prefix."latest_news set title = '".$_REQUEST['news_title']."', description = '".$_REQUEST['description']."' where id='".$id."'"); header("location:?page=latest_news_settings"); } break; case 'delete' : $wpdb->query("delete from ".$wpdb->prefix."latest_news where id='".$id."'"); header("location:?page=latest_news_settings"); break; default: include('latest_news_list.php'); break; }}?>() I need to find the earliest and latest times, but there must be at least 3 to count it. $array[] = "09:00 - 15:00" $array[] = "09:00 - 15:00" $array[] = "09:00 - 15:00" $array[] = "09:00 - 17:00" $array[] = "09:00 - 15:30" $array[] = "07:30 - 15:00" $array[] = "07:00 - 12:00" So the above would return 09:00 - 15:00 I thin would need to ensure that a maximum 4 hours inbetween, so I then get something like 10:00 - 14:00 returned hello dear Linux-experts well at the moment i wonder how i can find out the latest schools at openstreetmap - note: i focus on a country - south america and he on Argentina: so here we go [date:"2014-09-18T00:00:00Z"];area[name="Argentina"][boundary=administrative]->.a;(node(area.a)[amenity=school];way(area.a)[amenity=school];);out center;js this doable with overpass-api.de or with overpass-turbo.eu love to hear from you Hello guys, I've been reading through various threads here about getting latest tweets with php but they're all basically methods I've seen before, and involve getting the tweets from the atom feed xml. I've been experimenting with various code snippets that do this on my site, and most of the time they work. But about one in every 10 times it doesn't, because for some reason the tweet doesn't appear in the atom feed. I guess this is a problem with Twitter, but I've google this, and to be honest there's only a few whispers from people that could be experiencing something like this problem, which makes me wonder whether I'm just unlucky or being stupid and overlooking something..? I don't see what though. Anyway I know there's methods where you can actually log into your twitter acount and post tweets, and all the rest of it, but the codes I've found are all extremely lengthy and arcane, and do far more than what I want them to. So what I'm wondering is- has anyone used this foolproof method of retrieving tweets, and if so I wonder is you could share your code with me, or point me in the right direction? All I want to do is get my latest tweet and display it on my site. Many Thanks |