PHP - Dont Echo Certain Files?
I have the echo statement set up for all files, but what i want to do is put an if statement for example if it contains .pdf or .docx dont echo out an image how would i do this?
Code: [Select] <?php $id = explode("/", $_GET['a']); $id = $id[2]; ?> <?php global $allow_client_uploads; ?> <div id="content"> <div class="wrapper content"> <h3 class="page-title"><?php echo $project['name']; ?></h3> <div id="client-controls"> <a href="<?php echo $this->redirect('messages/add/'.$id, true); ?>" class="new-message">Post Message to Admin</a> <?php if($allow_client_uploads): ?> <a href="<?php echo $this->redirect('documents/add/'.$id, true); ?>" class="new-file">Upload A Document</a> <?php endif; ?> <a href="<?php echo $this->redirect('clients/change_password', true); ?>" class="change-password">Change Password</a> </div> <!--<div class="project-progress">Progress <div class="progressbar"> <div id="test" class="progressbar-completed" style="width:<?php // echo $project['progress']; ?>%;"> <div> </div> </div> <div><?php // echo $project['progress']; ?>%</div> </div> </div> --> <ul class="project-phases"> <?php $n=0; global $document_upload_path;?> <?php foreach($project['phases'] as $phase): ?> <li class="clearfix"> <div class="large-bullet"><?php echo ++$n; ?> </div> <h1 class="phase-title"><?php echo $phase ?></h1> <?php if(@count($documents[$n])>0): ?> <ol class="documents"> <?php foreach($documents[$n] as $doc): ?> <li> <a href="<?php echo $this->redirect('documents/download/'.$doc['path'], true); ?>"> <?php echo $doc['description']; ?> <br /> </a> <?php //echo $doc['size']."K - "; ?> <span class="date"><?php // echo date("F j, Y, g:i a", $doc['created']); ?></span> <?php // echo (isset($doc['uploaded_by']))? ", by ".$doc['uploaded_by']:""; ?> <a href="/clientele/uploads/<?php echo $doc['path'];?>" class="lightbox"><?php echo '<img src="/clientele/uploads/'.$doc['path'].'" height="300" width="300">'; ?></a> </li> <?php endforeach;?> </ol> <?php else: ?> <?php endif; ?> </li> <?php endforeach;?> </ul> <div class="sidebar"> <?php if(is_array($messages)): ?> <div class="messagebar">Latest News</div><br /> <?php foreach($messages as $message): ?> <div class="message clearfix"> <p class="body"><?php echo $message['message']; ?></p> <span class="meta"> <?php // echo $message['posted_by']; ?></span> </div> <?php endforeach; ?> <?php endif; ?> </div> <div class="clear"></div> </div> </div> Similar Tutorialshi everyone i am currently making my website with an uploadform. The upload function is working, but now i am trying to make the site remember the last 5 uploads. The filenames should appear in an array: $aotf[0] $aotf[1] $aotf[2] $aotf[3] $aotf[4] and since all files that can be/are uploaded are images, i want them to be drawed next to each other, each 128x128. THAT is working, but the fetch for images doesn't. When an image is uploaded, i execute this code: $readhandle=fopen("uploaddb.log","r"); $aotf=fread($handle,filesize("uploaddb.log")); fclose($readhandle); $writehandle=fopen("uploaddb.log","w"); fwrite($writehandle,"$aotf\r\n" . "uploadform/gebruikers/" . $naam); fclose($writehandle); then,there is some html code, and then there is this code: $aotf=explode("/n",$aotf); for($i = count($aotf) - 5; $i <= count($aotf); $i++) { echo ' <img src="'. $aotf[$i] . '" width="128" height="128"> '; } when i open the page, all img src's are empty. The writing works, and the folder of the image is 7777 chmod and the images draw on the screen, but not as the last uploaded. Does anyone know how to make this work? maybe even without a fwrite? Thank you, masterens EDIT: i cannot use mysql Hey I have this code which works fine, it echos the file names from a directory into a dropdown box how can I change it to include more then one directory <?php $dirname = "../images/staff"; $dir = opendir($dirname); echo '<select name="file2">'; echo '<option value="">none</option>'; while(false != ($file = readdir($dir))) { if(($file != ".") and ($file != "..")) { echo "<option value=".$file.">$file</option>"; } } echo '</select>'; ?> I tried this but it didnt work any help <?php $dirname = "../images/staff"; $dirname .= "../images/boarddirectors"; $dir = opendir($dirname); echo '<select name="file2">'; echo '<option value="">none</option>'; while(false != ($file = readdir($dir))) { if(($file != ".") and ($file != "..")) { echo "<option value=".$file.">$file</option>"; } } echo '</select>'; ?> Hey! First timer here, please be gentle on me. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Leettarin Uploader</title> //<link href="style.css" rel="stylesheet" type="text/css" /> <BODY BACKGROUND="Ready.jpg"> <link rel="shortcut icon" href="xxx/twg/favicon.ico"> </head> <?php ob_start(); define("MAX_COUNT", 10); define("UPLOAD_DIRECTORY", "valokuvat/"); define("MAX_SIZE", 1000000); if(!is_dir(UPLOAD_DIRECTORY)) { mkdir(UPLOAD_DIRECTORY, 0777); } if(file_exists($_FILES['file1']['tmp_name'])) { for($i=1; $i<=MAX_COUNT; $i++) { if($_FILES['file'.$i]['size'] > MAX_SIZE) { echo "Liian iso tiedosto!<br>".MAX_SIZE." on raja"; break; } while(file_exists(UPLOAD_DIRECTORY.$_FILES['file'.$i]['name'])) {$_FILES['file'.$i]['name']="$k".$_FILES['file'.$i]['name']; $k++; } move_uploaded_file($_FILES['file'.$i]['tmp_name'], UPLOAD_DIRECTORY.$_FILES['file'.$i]['name']); echo "xxx/waddap/valokuvat/".$_FILES['file'.$i]['name']; exit(); } } ?> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" ENCTYPE="multipart/form-data"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="102400000"> <?php for($i=1;$i<=MAX_COUNT;$i++) { echo " <b><font style=\"color: #00FFFF;\">$i</font></b> <input type=\"file\" name=\"file".$i."\" size=\"75\"><br>"; } ?> <input type="submit" value="Upload"></form><?php ob_end_flush(); exit; ?> Basically, I want this to also display details concerning EVERY uploaded file. I can fix the text and decoration part later, but for now I'd like to know how to make it display information from every uploaded file upon multi-uploading. Information, as in a simple link to the image will do now just fine. So it kind of would redirect you after an upload process to page where are links to all uploads just done. I can only get it to work with 1st file and evidently other files won't even be uploaded then, hm. Also would appreciate a code for blocking other filetypes but .jpeg, .jpg, .png, .gif and .bmp. I'd highly appreciate help! OK, have no idea what's going on... I've done this a million times... why wont this output!?? I must have a major brain meltdown and dont know it yet!!! Code: [Select] <?php // this echoes just fine: echo $_POST['testfield']; // but this wont echo: echo if (isset($_POST['testfield'])) { $_POST['testfield'] = $test; } echo $test; /// or even this DOESNT echo either!: $_POST['testfield'] = $test; echo $test; ?> Hi All, I'm trying to echo the response from an SLA query, the query works and returns the data when I test it on an SQL application.. but when I run it on my webpage it won't echo the result. Please help? <?php $mysqli = mysqli_connect("removed", "removed", "removed", "removed"); $sql = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1'"; $result = mysqli_query($mysqli, $sql); echo {$result['message']}; ?> So far I have managed to create an upload process which uploads a picture, updates the database on file location and then tries to upload the db a 2nd time to update the Thumbnails file location (i tried updating the thumbnails location in one go and for some reason this causes failure) But the main problem is that it doesn't upload some files Here is my upload.php <?php include 'dbconnect.php'; $statusMsg = ''; $Title = $conn -> real_escape_string($_POST['Title']) ; $BodyText = $conn -> real_escape_string($_POST['ThreadBody']) ; // File upload path $targetDir = "upload/"; $fileName = basename($_FILES["file"]["name"]); $targetFilePath = $targetDir . $fileName; $fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION); $Thumbnail = "upload/Thumbnails/'$fileName'"; if(isset($_POST["submit"]) && !empty($_FILES["file"]["name"])){ // Allow certain file formats $allowTypes = array('jpg','png','jpeg','gif','pdf', "webm", "mp4"); if(in_array($fileType, $allowTypes)){ // Upload file to server if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){ // Insert image file name into database $insert = $conn->query("INSERT into Threads (Title, ThreadBody, filename) VALUES ('$Title', '$BodyText', '$fileName')"); if($insert){ $statusMsg = "The file ".$fileName. " has been uploaded successfully."; $targetFilePathArg = escapeshellarg($targetFilePath); $output=null; $retval=null; //exec("convert $targetFilePathArg -resize 300x200 ./upload/Thumbnails/'$fileName'", $output, $retval); exec("convert $targetFilePathArg -resize 200x200 $Thumbnail", $output, $retval); echo "REturned with status $retval and output:\n" ; if ($retval == null) { echo "Retval is null\n" ; echo "Thumbnail equals $Thumbnail\n" ; } }else{ $statusMsg = "File upload failed, please try again."; } }else{ $statusMsg = "Sorry, there was an error uploading your file."; } }else{ $statusMsg = 'Sorry, only JPG, JPEG, PNG, GIF, mp4, webm & PDF files are allowed to upload.'; } }else{ $statusMsg = 'Please select a file to upload.'; } //Update SQL db by setting the thumbnail column to equal $Thumbnail $update = $conn->query("update Threads set thumbnail = '$Thumbnail' where filename = '$fileName'"); if($update){ $statusMsg = "Updated the thumbnail to sql correctly."; echo $statusMsg ; } else { echo "\n Failed to update Thumbnail. Thumbnail equals $Thumbnail" ; } // Display status message echo $statusMsg; ?> And this does work on most files however it is not working on a 9.9mb png file which is named "test.png" I tested on another 3.3 mb gif file and that failed too? For some reason it returns the following Updated the thumbnail to sql correctly.Updated the thumbnail to sql correctly. Whereas on the files it works on it returns REturned with status 0 and output: Retval is null Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif' Failed to update Thumbnail. Thumbnail equals upload/Thumbnails/'rainbow-trh-stache.gif'The file rainbow-trh-stache.gif has been uploaded successfully. Any idea on why this is? Hello I have a simple question about file handling... Is it possible to list all files in directories / subdirectories, and then read ALL files in those dirs, and put the content of their file into an array? Like this: array: [SomePath/test.php] = "All In this php file is being read by a new smart function!"; [SomePath/Weird/hello.txt = "Hello world. This is me and im just trying to get some help!";and so on, until no further files exists in that rootdir. All my attempts went totally crazy and none of them works... therefore i need to ask you for help. Do you have any ideas how to do this? If so, how can I be able to do it? Thanks in Advance, pros ok say I have a file that has something like 123456 abcde 654321 edcba in a file.. how would I go about having the script pull "123456" and make it a variable in the script.. and "abcde" a variable? and then "654321" a variable but is set in an array so that 123456 and 654321 are both the same variable but like $variable[0] and abcde and edcba would be $variable[1] what do I have to do? maybe some wiz kid out their can help me figure out whats going on here. What suppose to happen is a random site suppose to load into a iframe When the frameset code below is inside the <body> tags only the menubar shows up and not the iframe with a random site. Now when i take the code and put it oustide the <body> tag the menubar goes away and only the iframe with a random site is shown . The goal of course is to get the menubar to be visible and to have a iframe with a random site loaded into it. For some reason i can only get one of the two the happen. I do hope i explained this well enough Code: [Select] <frameset rows="80,*" BORDERCOLOR="#222222" BORDER="3"> <frame src="explore.php" name="surfbar" marginwidth="O" marginheight="0" NORESIZE SCROLLING="no" /> <frame src="<?php while ($row = mysql_fetch_array($result)){ print $row["url"];}?> " name="random" marginwidth="O" marginheight="0" noresize scrolling="auto" /> </frameset>-------------------------------------------------------------------------------------------------- Code: [Select] <?php /** * @author Brent Moeller * @copyright 2011 */ include ('functions.php'); db_connect(); $result = mysql_query("SELECT * FROM slinks where approval='1' ORDER BY RAND() LIMIT 1") or die(mysql_error()); ?> <html> <head> <title>DizzyUrl Discovery Engine</title> <link rel="stylesheet" type="text/css" href="mouseovertabs.css" /> <script src="mouseovertabs.js" type="text/javascript"> /*********************************************** * Mouseover Tabs Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more ***********************************************/ </script> </head> <body> <frameset rows="80,*" BORDERCOLOR="#222222" BORDER="3"> <frame src="explore.php" name="surfbar" marginwidth="O" marginheight="0" NORESIZE SCROLLING="no" /> <frame src="<?php while ($row = mysql_fetch_array($result)){ print $row["url"];}?> " name="random" marginwidth="O" marginheight="0" noresize scrolling="auto" /> </frameset> <div id="mytabsmenu" class="tabsmenuclass"> <ul> <li><a href="http://www.javascriptkit.com" rel="gotsubmenu[selected]">JavaScript Kit</a></li> <li><a href="http://www.cssdrive.com" rel="gotsubmenu">CSS Drive</a></li> <li><a href="http://www.codingforums.com">No Sub Menu</a></li> </ul> </div> <div id="mysubmenuarea" class="tabsmenucontentclass"> <!--1st link within submenu container should point to the external submenu contents file--> <a href="submenucontents.htm" style="visibility:hidden">Sub Menu contents</a> </div> <script type="text/javascript"> //mouseovertabsmenu.init("tabs_container_id", "submenu_container_id", "bool_hidecontentsmouseout") mouseovertabsmenu.init("mytabsmenu", "mysubmenuarea", true) </script> <noframes> <p>This Browser does not support Frames.</p> </noframes> </body> </html> I have this script where it uploads the file name to a database plus a few more things. Main Upload form. (img_add.php) <form enctype="multipart/form-data" action="img_add.php" method="POST"> Name: <input type="text" name="name"><br> E-mail: <input type="text" name = "email"><br> Phone: <input type="text" name = "phone"><br> Photo: <input type="file" name="photo"><br> <input type="submit" value="Add"> </form> Uploader. (img_add.php) <?php //This is the directory where images will be saved $target = "mainnewsimg/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $name=$_POST['name']; $email=$_POST['email']; $phone=$_POST['phone']; $pic=($_FILES['photo']['name']); // Connects to your Database mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("chat") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO `images` VALUES ('$name', '$email', '$phone', '$pic')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?> And the one that views it. (img_view.php) It uses a get function so do it with img_view.php?img=2 <?php mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("chat") or die(mysql_error()) ; //Retrieves data from MySQL $newsid = $_GET['img']; $data = mysql_query("SELECT * FROM `images` WHERE id ='$newsid'") or die(mysql_error()); //Puts it into an array while($info = mysql_fetch_array( $data )) { //Outputs the image and other data Echo "<img src=mainnewsimg/".$info['photo'] ."> <br>"; } ?> And my database sql. CREATE TABLE IF NOT EXISTS `images` ( `name` varchar(30) DEFAULT NULL, `email` varchar(30) DEFAULT NULL, `phone` varchar(30) DEFAULT NULL, `photo` varchar(30) DEFAULT NULL, `id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Dumping data for table `images` -- INSERT INTO `images` (`name`, `email`, `phone`, `photo`, `id`) VALUES ('sdf', 'sdfdsdsf', 'dsffsfsdf', 'arrow_forward_last.gif', 1), ('sadd', 'sadd', 'adsadasdad', 'artbottomshadr.png', 2); The values inside I had to put in manually to test if it worked for the img_view.php Anyways, It doesnt want to upload the images at all, even tho it says it did and gives the message The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory I would greatly appreciate some help, I also provided everything so you can try it on your own server too. why this simple code only works on chrome??
function mostrarOcultar(obj) { document.getElementById('seguro').style.visibility = (obj.checked) ? 'hidden' : 'visible'; } Hi Guys, im not sure if this is possible or not... i want to be able to paste information from stored information in one web browser to another browser with a different website... E.G i have a website where a user inputs information and i want to be able to export that in text format to another website where the page is set to take information. not sure if this makes sence but any ideas appriciated. keep gettin error msg Notice: Undefined index: id in C:\wamp\www\profile.php on line 42 dun everything to define the index cud it b the verion of wamp i am using Code: [Select] if ($_GET['id']) { $id = $_GET['id']; } else if (isset($_SESSION['id'])) { $id = $_SESSION['id']; } else { print "important data to render this page is missing"; //include_once "index.php"; //} } //exit(); [code] Hello! i am new to php. I need help to get all the displayed information in the mail, see below. I dont get the phone information. Thanks in adwansed <?php // anger en variabel som kan lagra de eventuella felaktigheterna $errors = array(); // kontrollera om ett Förnamn angivits if (!$_POST["namn"]) $errors[] = "- NAMN"; // kontrollera om ett TELEFONNUMMER angivits if (!$_POST["phone"]) $errors[] = "- TELEFONNUMMER"; // kontrollera om ett TELEFONNUMMER angivits $emailcheck = $_POST["email"]; if(!preg_match("/^[a-z0-9\å\ä\ö._-]+@[a-z0-9\å\ä\ö.-]+\.[a-z]{2,6}$/i", $emailcheck)) $errors[] = "- din E-POSTADRESS saknas eller är felaktig"; // kontrollera om ett Meddelande angivits if (!$_POST["message"]) $errors[] = "- inget MEDDELANDE har skrivits!"; if (count($errors)>0){ echo "<h1>Felmeddelande:</h1> <strong>Följande information måste anges innan du kan skicka formuläret:</strong><br /><br> "; foreach($errors as $fel) echo "$fel <br />"; echo "<br />Ange den information som saknas och skicka formuläret igen. Tack! <br />"; echo "<a href='javascript:history.go(-1)'>klicka här för att komma tillbaka till formuläret</a>"; } else { // formuläret är korrekt ifyllt och informationen bearbetas $to = "mailo@mail.com"; $from = $_POST["email"]; $subject = 'Kontakt från webbplatsen!'; $namn = $_POST["namn"]; $phone = $_POST["phone"]; $message = $_POST["message"]; ######################################################################## // HEADERS för innehållstyp och textkodning $headers = "Content-Type: text/plain; charset=utf-8 \r\n"; $headers .= "From:".$namn." <".$from.">"."\r\n"; $headers .= "MIME-Version: 1.0 \r\n"; ######################################################################## // Mailfunktionen som skickar bekräftelsen if (mail($to, $subject, $message, $headers)) echo nl2br("<h2>Tack $namn! Ditt meddelande har skickats!</h2> //###I WANT ALL THIS IN THE MAIL### <b>Mottaga </b> $to <b>Namn:</b> $namn <b>E-Mail:</b> $from <b>Telefonnummer:</b> $phone <b>meddelande:</b> <br/>$message "); else echo "Det gick inte att skicka ditt meddelande"; } ?>
although im using nl2br, and \r\n in the code below, my results are still displaying; result1,result2,result2 opposed to result1 result2 result3 How can i change to this format? $code = $_GET['postcode']; $message = $_GET['message']; $shortcode = substr($code,0,2); $subject = "subject here"; $result = mysql_query("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3") or die(mysql_error()); echo "<h2>Business Names:</h2>"; $number_of_results = mysql_num_rows($result); $results_counter = 0; if ($number_of_results != 0) {while ($array = mysql_fetch_array($result)) {$email = $array['email']; $results_counter++; if ($results_counter >= $number_of_results) {$to .= $email;} else {$to .= $email . ',';}}} $headers = 'From: me@me.com' . "\r\n" . 'Reply-To: me@me.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $message .= "\r\n". $to ; echo nl2br ($message); mail( "$to", "$subject","$message", "$headers"); echo "<br>" . "Thank you for using our mail form."; ?></body></html> Hi, im using colorbox(basically like lightbox) for some links on my site. When a user clicks the link it opens this lightbox. But if they type the link into the address bar manually it takes them to the actual page(which isnt formatted properly). Is there a way to open up the lightbox when they enter the address manually? or a work around? Hi. im baffled on this. boss wants a traffic feed for the office so im using SimplePie to grab rss feeds and the google maps traffic overlay as a view of the roads. The trouble is when i do it via xampp locally it looks fine, but when i load into onto our local webserver (ubuntu 18.04 with apache) it only shows a small line and cant figure out why? any help is appreciated. The attached images are how my local xampp sees it and the other is via the ubuntu 18.04 with apache, php & mysql installed My Code is below <?php // Include the SimplePie library require_once('php/autoloader.php'); // Because we're using multiple feeds, let's just set the headers here. header('Content-type:text/html; charset=utf-8'); // These are the feeds we want to use $feeds = array( 'http://m.highwaysengland.co.uk/feeds/rss/AllEvents.xml', 'https://traffic.wales/feeds/incidents-events/rss.xml', 'https://traffic.wales/feeds/roadworks/rss.xml', 'https://trafficscotland.org/rss/feeds/currentincidents.aspx', 'https://trafficscotland.org/rss/feeds/roadworks.aspx' ); // This array will hold the items we'll be grabbing. $first_items = array(); // Let's go through the array, feed by feed, and store the items we want. foreach ($feeds as $url) { // Use the long syntax $feed = new SimplePie(); $feed->set_feed_url($url); $feed->init(); // How many items per feed should we try to grab? $items_per_feed = 5; // As long as we're not trying to grab more items than the feed has, go through them one by one and add them to the array. for ($x = 0; $x < $feed->get_item_quantity($items_per_feed); $x++) { $first_items[] = $feed->get_item($x); } // We're done with this feed, so let's release some memory. unset($feed); } // We need to sort the items by date with a user-defined sorting function. Since usort() won't accept "SimplePie::sort_items", we need to wrap it in a new function. function sort_items($a, $b) { return SimplePie::sort_items($a, $b); } // Now we can sort $first_items with our custom sorting function. usort($first_items, "sort_items"); // Begin the (X)HTML page. ?> <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <title>Traffic Layer</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous"> <style type="text/css"> body { height: 100%; font:12px/1.4em Verdana, sans-serif; color:#333; background-color:#fff; } a { color:#326EA1; text-decoration:underline; padding:0 1px; } a:hover { background-color:#333; color:#fff; text-decoration:none; } div.header { border-bottom:1px solid #999; } div.item { padding-left:5px; border-bottom:1px solid #999; } div#site { padding:5px 0; width:300px; } /* Always set the map height explicitly to define the size of the div * element that contains the map. */ #map { height: 100%; } /* Optional: Makes the sample page fill the window. */ html, body { height: 100%; margin: 0; padding: 0; } footnote, p{ color:red; font:9px/1.4em Verdana, sans-serif; font-weight:bold; } </style> </head> <body> <!-- NEW --> <div class="row"> <div class="col-md-2"> <!-- BOF Simple Pie News Feed Info --> <div id="site"> <?php foreach($first_items as $item): $feed = $item->get_feed(); ?> <div class="chunk"> <h6><b><?php echo html_entity_decode($item->get_title(), ENT_QUOTES, 'UTF-8'); ?></a></b></h6> <?php echo $item->get_content(); ?> <?php if ($enclosure = $item->get_enclosure()): ?> <div> <?php echo $enclosure->native_embed(array( )); ?> </div> <?php endif; ?> <p class="footnote">Source: <?php echo $feed->get_title(); ?></a> | <?php echo $item->get_date('j M Y | g:i a'); ?></p> </div> <?php endforeach; ?> </div> <!-- EOF Simple Pie News Feed Info --> </div> <div class="col-md-10"> <!-- BOF Map Info --> <div id="map"></div> <script> function initMap() { var map = new google.maps.Map(document.getElementById('map'), { zoom: 7.4, center: {lat: 53.8059821, lng: -1.6057714} }); var trafficLayer = new google.maps.TrafficLayer(); trafficLayer.setMap(map); } </script> <script async defer src="https://maps.googleapis.com/maps/api/js?key=<My Google API Key>&callback=initMap"> </script> <!-- EOF Map Info --></div> </div> <!--OEF Test --> </script> </body> </html>
i am a beginerr in php.. and here is my code..which shows error in the querry line.. erro goes like this Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\restafinal\process_edit_page.php on line 56 and code goes like this.. echo part works well...that query line is the error line..please tell me whats the problem... Code: [Select] <?php //$id=$_GET["id"]; $id= $_GET['id']; $menu_name= $_POST['menu_name']; $position= $_POST['position']; $visible= $_POST['visible']; $note= $_POST['note']; $content= $_POST['content']; //echo part works well.. echo "menu_name"; echo $menu_name; echo "<br/>"; echo "position"; echo $position; echo "<br/>"; echo "visible"; echo $visible; echo "<br/>"; echo "note"; echo $note; echo "<br/>"; echo "id"; echo $id; echo $content; [b]$result = mysql_query(UPDATE page SET note =$note, nevigation = $menu_name WHERE id = $id,$connection)[/b] // test to see if the update occurred if (mysql_affected_rows() == 1) { // Success! } else { $message = "The page could not be updated."; $message .= "<br />" . mysql_error(); } ?> hi, im getting the error Quote Fatal error: Call to undefined function notification() in C:\xampp\htdocs\xampp\index.php on line 21 after including the functions.php file i wrote. It does include it but the data isnt being recognised from it. If i copy/paste the notification() function into index.php it works. Can someone tell me why so i can fix it? I am using WPSQT plugin in my blog site .I code some files in PHP also.how to add that files in plugin files.
|