Search Results

Search found 42698 results on 1708 pages for 'php in array'.

Page 159/1708 | < Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >

  • php insert doesnot take place _ URGENT HELP PLEASE

    - by reggie
    my code is as follows <?php include("config.php"); $ip=$_SERVER['REMOTE_ADDR']; if($_POST['id']) { $id=$_POST['id']; $id = mysql_escape_String($id); $ip_sql=mysql_query("select ip_add from Voting_IP where mes_id_fk='$id' and ip_add='$ip'"); $count=mysql_num_rows($ip_sql); if($count==0) { $sql = "update Messages set up=up+1 where mes_id='$id'"; mysql_query($sql); $sql_in = "insert into Voting_IP (mes_id_fk,ip_add) values ('$id','$ip')"; mysql_query($sql_in) or die(mysql_error()); echo "<script>alert('Thanks for the vote');</script>"; } else { echo "<script>alert('You have already voted');</script>"; } $result=mysql_query("select up from Messages where mes_id='$id'"); $row=mysql_fetch_array($result); $up_value=$row['up']; echo "<img src='button.png' width='110' height='90'>"; echo $up_value; } ?> My problem is that the insert process doesnot take place at all. the script tags echos an alert box. even the img tag is echoed to the web page. but the insert process doesnot take place. the config file is fine.. note: this code works on my local machine which has php 5.3 but it doesnot work on the server which has php 5.2.. any advice..???

    Read the article

  • PHP Included files writing their own content from Importer values ...

    - by Adrian
    Hello, I have a index.php file that will include several external files: "content/templates/id1/template.php" "content/templates/id2/template.php" "content/templates/id3/template.php" etc. All these files are loaded dynamically into index.php (it reads all folders inside "templates" directory and then includes every "template.php" file). I want to make "template.php" to have the same code in all the "id1,id2,id3" folders, BUT to load values from index.php depending in which folder it stays.. How can I do that? Thank You!

    Read the article

  • PHP classes totally forgotten something today - sorry

    - by russp
    Hi guys, really sorry about being "totally thick today" but I have forgotten how to do something simple - too much time not in php recently. Want to use the OS phpapi How do I print out the individual rows - see told you I was being thick today // The fields we will be fetching. if (isset($_GET['test']) && $_GET['test'] == 'plaxo') { // plaxo is a PortableContacts end-point so doesn't know about the OpenSocial specific fields $profile_fields = array(); } else { $profile_fields = array( 'aboutMe', 'displayName', 'bodyType', 'currentLocation', 'drinker', 'happiestWhen', 'lookingFor' ); } // The number of friends to fetch. $friend_count = 2; $batch = $osapi->newBatch(); // Fetch the current user. $self_request_params = array( 'userId' => $userId, // Person we are fetching. 'groupId' => '@self', // @self for one person. 'fields' => $profile_fields // Which profile fields to request. ); $batch->add($osapi->people->get($self_request_params), 'self'); // Fetch the friends of the user $friends_request_params = array( 'userId' => $userId, // Person whose friends we are fetching. 'groupId' => '@friends', // @friends for the Friends group. 'fields' => $profile_fields, // Which profile fields to request. 'count' => $friend_count // Max friends to fetch. ); $batch->add($osapi->people->get($friends_request_params), 'friends'); // Get supportedFields Request $batch->add($osapi->people->getSupportedFields(), 'supportedFields'); // Send the batch request. $result = $batch->execute(); Say I wanted to print out "aboutMe", whats the echo? cos echo $result['aboutMe'] doesn't work.

    Read the article

  • jQuery Validate PHP Response

    - by Kurt
    Hello Everybody, my problem is, I want to validate an email adresse with jquery. Not only the syntax but rather if the email is already registrated. There are some tutorials but they are not working! At first the Jquery Code: <script id="demo" type="text/javascript"> $(document).ready(function() { // validate signup form on keyup and submit var validator = $("form#signupform").validate({ rules: { Vorname: { required: true, minlength: 3 }, Nachname:{ required: true, minlength: 4 }, password: { required: true, minlength: 5 }, password_confirm: { required: true, minlength: 5, equalTo: "#password" }, Email: { required: true, email: true, type: "POST", remote: "remotemail.php" }, dateformat: "required", ... </script> And now the PHP Code: <?php include('dbsettings.php'); $conn = mysql_connect($dbhost,$dbuser,$dbpw); mysql_select_db($dbdb,$conn); $auslesen1 = "SELECT Email FROM flo_user"; $auslesen2 = mysql_query($auslesen1,$conn); $registered_email = mysql_fetch_assoc($auslesen2); $requested_email = $_POST['Email']; if( in_array($requested_email, $registered_email) ){ echo "false"; } else{ echo "true"; } ?> I tried return TRUE/ return FALSE as well, but this displays "Email is registrated" all the time. json_encode didn't work as well. Thanks a lot!

    Read the article

  • jQuery AJAX PHP JSON problem

    - by Curro
    Hi Gurus I'm facing the problem of receiving an empty array when I do an AJAX request in the following way: This is the code I'm executing in JavaScript: <script type="text/javascript" src="lib/jquery.js"></script> <script type="text/javascript" src="lib/jquery.json.js"></script> <script type="text/javascript"> $(document).ready(function(){ /* Preparar JSON para el request */ var mJSON = new Object; mJSON.id_consulta = new Array; for (var i=0; i<3; i++){ mJSON.id_consulta[i] = new Object; mJSON.id_consulta[i].id = i; } var sJSON = $.toJSON(mJSON); $.ajax({ type: "POST", url: "getUbicaciones.php", data: sJSON, dataType: "json", contentType: "application/json; charset=utf-8", success: function(respuesta){ alert(respuesta); }, error: function (request,error){ alert("Error: " + request.statusText + ". " + error); } }); }); </script> And this is the code under PHP: <?php /* Decodificar JSON */ $m_decoded = $_POST; print_r($m_decoded); exit; ?> And all I get from this, using Chrome's Developer Tools is an empty array: Array ( ) Any clues on what am I doing wrong? The string sJSON is being encoded correctly, this is what I get when I do an "alert" on that one: {"id_consulta":[{"id":1},{"id":2},{"id":3}]} Thank you everyone in advance!

    Read the article

  • How to send XML and other post parameters via cURL in PHP

    - by tomaszs
    Hello. I've used code below to send XML to my REST API. $xml_string_data contains proper XML, and it is passed well to mypi.php: //set POST variables $url = 'http://www.server.cu/mypi.php'; $fields = array( 'data'=>urlencode($xml_string_data) ); //url-ify the data for the POST $fields_string = ""; foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); echo $fields_string; //open connection $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); curl_setopt($ch,CURLOPT_HTTPHEADER,array ( "Expect: " )); //execute post $result = @curl_exec($ch); But when I've added other field: $fields = array( 'method' => "methodGoPay", 'data'=>urlencode($xml_string_data) ); It stopped to work. On the mypi.php I don't recieve any more POST parameters at all! Could you you please tell me what to do to send XML and other post parameters in one cURL request? Please don't suggest using any libraries, I wan't to acomplish it in plain PHP.

    Read the article

  • Find numbers that equals a sum in an array

    - by valli-R
    I want to find the first set of integers in an array X that the sum equals a given number N. For example: X = {5, 13, 24, 9, 3, 3} N = 28 Solution = {13, 9, 3, 3} Here what I have so far : WARNING, I know it uses global and it is bad,that's not the point of the question. <?php function s($index = 0, $total = 0, $solution = '') { global $numbers; global $sum; echo $index; if($total == 28) { echo '<br/>'.$solution.' = '.$sum.'<br/>'; } elseif($index < count($numbers) && $total != 28) { s($index + 1, $total, $solution); s($index + 1, $total + $numbers[$index], $solution.' '.$numbers[$index]); } } $numbers = array(5, 13, 24, 9, 3, 3); $sum = 28; s(); ?> I don't get how I can stop the process when it finds the solution.. I know I am not far from good solution.. Thanks in advance

    Read the article

  • HTML5 audio with PHP script does not work on iPad/Iphone

    - by saulob
    Ok, I'm trying to play an HTML audio code on iPad but does not work. I created one PHP script to send to the MP3 request to the HTML5 audio code mp3_file_player.php?n=mp3file.mp3 The player is here: http://www.avault.com/news/podcast-news/john-romero-podcast-episode-80/ You will see that works on every HTML5 supported browser even on my iPod Touch. But does not work on iPad/iPhone, even on Safari on Mac OSX (I tried on Safari/Windows, worked fine) This is my PHP code: header("X-Powered-By: "); header("Accept-Ranges: bytes"); header("Content-Length: ". (string)(filesize($episode_filename)) .""); header("Content-type: audio/mpeg"); readfile($episode_filename); exit(); Everything works fine, the MP3 has the same headers like reading the mp3 directly. HTTP Headers from direct file access: (Status-Line) HTTP/1.1 200 OK Date Mon, 31 May 2010 20:27:31 GMT Server Apache/2.2.9 Last-Modified Wed, 26 May 2010 13:39:19 GMT Etag "dac0039-41d91f8-4877f669cefc0" Accept-Ranges bytes Content-Length 50656162 Content-Range bytes 18390614-69046775/69046776 Keep-Alive timeout=15, max=100 Connection Keep-Alive Content-Type audio/mpeg HTTP Header from my PHP script: (Status-Line) HTTP/1.1 200 OK Date Mon, 31 May 2010 20:27:08 GMT Server Apache/2.2.9 Accept-Ranges bytes Content-Length 69046776 Keep-Alive timeout=15, max=100 Connection Keep-Alive Content-Type audio/mpeg The only thing different it's the Content-Range, I even tried to add it, but if I use it the player will not work on my Ipod Touch. So I removed. Thank you very much.

    Read the article

  • php request variables assigning $_GEt

    - by chris
    if you take a look at a previous question http://stackoverflow.com/questions/2690742/mod-rewrite-title-slugs-and-htaccess I am using the solution that Col. Shrapnel proposed- but when i assign values to $_GET in the actual file and not from a request the code doesnt work. It defaults away from the file as if the $_GET variables are not set The code I have come up with is- if(!empty($_GET['cat'])){ $_GET['target'] = "category"; if(isset($_GET['page'])){ $_GET['pageID'] = $_GET['page']; } $URL_query = "SELECT category_id FROM cats WHERE slug = '".$_GET['cat']."';"; $URL_result = mysql_query($URL_query); $URL_array = mysql_fetch_array($URL_result); $_GET['category_id'] = $URL_array['category_id']; }elseif($_GET['product']){ $_GET['target'] = "product"; $URL_query = "SELECT product_id FROM products WHERE slug = '".$_GET['product']."';"; $URL_result = mysql_query($URL_query); $URL_array = mysql_fetch_array($URL_result); print_r($URL_array); $_GET['product_id'] = $URL_array['product_id']; The original variable string that im trying to represent is /cart.php?Target=product&product_id=16142&category_id=249 And i'm trying to build the query string variables with code and including cart.php so i can use cleaner URL's So I have product/product-title-with-clean-url/ going to slug.php?product=slug Then the slug searches the db for a record with the matching slug and returns the product_id as in the code above.Then built the query string and include cart.php

    Read the article

  • Unserializing an API return object (PHP/Ebay API)

    - by DavidYell
    I have been working with the Ebay api for a project and have found it great. I have however found a problem now, more PHP related. When I read my items from Ebay, I store a bunch of details in the database. Currently, just for the sake of it really, I serialize the whole return object and store it in the database in a related table. The idea being, that when I display my information, I have all the details to hand should I need them. The problem arises in that the pricing information is always in a sub object. [ConvertedAdjustmentAmount] => __PHP_Incomplete_Class Object ( [__PHP_Incomplete_Class_Name] => eBayAmountType [_] => 0 [currencyID] => USD ) As you can see when I unserialize my object, my cunning plan falls foul of the Incomplete class problem. I have checked the following question, without success. http://stackoverflow.com/questions/965611/forcing-access-to-php-incomplete-class-object-properties The main issue lies, as far as I can see, in that the price class is stored in the Ebay api, so how do I recreate it? I have been reading this page, http://uk3.php.net/manual/en/function.unserialize.php and trying to figure out, unserialize_callback_func which I can't figure out either, so any help would be appreciated!

    Read the article

  • PHP static objects giving a fatal error

    - by Webbo
    I have the following PHP code; <?php component_customer_init(); component_customer_go(); function component_customer_init() { $customer = Customer::getInstance(); $customer->set(1); } function component_customer_go() { $customer = Customer::getInstance(); $customer->get(); } class Customer { public $id; static $class = false; static function getInstance() { if(self::$class == false) { self::$class = new Customer; } else { return self::$class; } } public function set($id) { $this->id = $id; } public function get() { print $this->id; } } ?> I get the following error; Fatal error: Call to a member function set() on a non-object in ....../classes/customer.php on line 9 Can anyone tell me why I get this error? I know this code might look strange, but it's based on a component system that I'm writing for a CMS. The aim is to be able to replace HTML tags in the template e.g.; <!-- component:customer-login --> with; <?php component_customer_login(); ?> I also need to call pre-render methods of the "Customer" class to validate forms before output is made etc. If anyone can think of a better way, please let me know but in the first instance, I'd like to know why I get the "Fatal error" mentioned above. Cheers

    Read the article

  • bitly php url wont work???

    - by mathiregister
    Hi guys, <?php include('bitly.php'); $bitly = new bitly('myusername', 'myapikey'); print $bitly->shorten('http://www.google.com'); ?> WORKING!!! $currenturl = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; include('bitly.php'); $bitly = new bitly('myusername', 'myapikey'); print $bitly->shorten($currenturl); WORKING!!! include('bitly.php'); $currenturl = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; $url = "somehashtag" $shareurl = $currenturl . '#' . $url; $bitly = new bitly('myusername', 'myapikey'); print $bitly->shorten($shareurl); NOT WORKING!!! Any idea why? If i print out the $shareurl i can see that it's a completely normal url that i could paste onto the normal bit.ly website. I don't get it! Any ideas? Would be great if you could help me!

    Read the article

  • Problem with checkboxes, sql select statements & php

    - by smokey20
    I am trying to display some rows from a database table based on choices submitted by the user. Here is my form code <form action="choice.php" method="POST" > <input type="checkbox" name="variable[]" value="Apple">Apple <input type="checkbox" name="variable[]" value="Banana">Banana <input type="checkbox" name="variable[]" value="Orange">Orange <input type="checkbox" name="variable[]" value="Melon">Melon <input type="checkbox" name="variable[]" value="Blackberry">Blackberry From what I understand I am placing the values of these into an array called variable. Two of my columns are called receipe name and ingredients(each field under ingredients can store a number of fruits). What I would like to do is, if a number of checkboxes are selected then the receipe name/s is displayed. Here is my php code. <?php // Make a MySQL Connection mysql_connect("localhost", "*****", "*****") or die(mysql_error()); mysql_select_db("****") or die(mysql_error()); $variable=$_POST['variable']; foreach ($variable as $variablename) { echo "$variablename is checked"; } $query = "SELECT receipename FROM fruit WHERE $variable like ingredients"; $row = mysql_fetch_assoc($result); foreach ($_POST['variabble'] as $ingredients) echo $row[$ingredients] . '<br/>'; ?> I am very new to php and just wish to display the data, I do not need to perform any actions on it. I have tried many select statements but I cannot get any results to display. My db connection is fine and it does print out what variables are checked. Many thanks in advance.

    Read the article

  • accessing private variable from member function in PHP

    - by Carson Myers
    I have derived a class from Exception, basically like so: class MyException extends Exception { private $_type; public function type() { return $this->_type; //line 74 } public function __toString() { include "sometemplate.php"; return ""; } } Then, I derived from MyException like so: class SpecialException extends MyException { private $_type = "superspecial"; } If I throw new SpecialException("bla") from a function, catch it, and go echo $e, then the __toString function should load a template, display that, and then not actually return anything to echo. This is basically what's in the template file <div class="<?php echo $this->type(); ?>class"> <p> <?php echo $this->message; ?> </p> </div> in my mind, this should definitely work. However, I get the following error when an exception is thrown and I try to display it: Fatal error: Cannot access private property SpecialException::$_type in C:\path\to\exceptions.php on line 74 Can anyone explain why I am breaking the rules here? Am I doing something horribly witty with this code? Is there a much more idiomatic way to handle this situation? The point of the $_type variable is (as shown) that I want a different div class to be used depending on the type of exception caught.

    Read the article

  • PHP Recursive Function

    - by Tempname
    In my database I have a hierarchical flat table that returns data ordered by ParentID, ObjectID asc I am having a bit of an issue getting this recursive function to work properly. I get the first ParentChildChild but after that I get nothing else. Any help with this is greatly appreciated. Here is my testing code: $objectArr = array(); $objectData = DAOFactory::getTemplateObjectsDAO()->queryByTemplateID(1); for($i = 0; $i < count($objectData); $i++) { if(empty($objectData[$i]->parentID)) { echo $objectData[$i]->objectID; $objectArr[$i] = $objectData[$i]; $objectArr[$i]->children = array(); $objectArr[$i]->children = getChildren($objectData[$i]->objectID, $objectData); } } function getChildren($objectID, $data) { $childArr = array(); foreach($data as $object) { if($object->parentID == $objectID) { $childArr = $object; $childArr->children = array(); $childArr->children = getChildren($object->objectID, $data); } } return $childArr; } new dBug($objectData); This is the output that I am getting: Fullsize Link

    Read the article

  • Problem with thumbnails after newly added - PHP on-the-fly method

    - by Wayne
    Hey again... to those that may have read my previous question that got solved a couple minutes ago .< The on-the-fly php script works perfectly, but when I went to upload new images into a gallery which I made myself, the images are resized to 150 x 150 for what I wanted... however, when it comes to new images being added it is all black... As you can see the three black images that were uploaded to the folder and the directory added to the database. What is causing this? If I view the source, the code is fine... the while loop in the PHP generates an output like this: <div class="view-wrap" id="photo-10"> <div class="view-icon"> <div class="img-label"> <a href="#" id="10" class="delete"><img src="img/small-delete.png" /> Delete</a> </div> <a href="img/events/Paintballing/24251_1395408043148_1170626626_1204038_5382765_n.jpg"> <img src="image.php?dir=img/events/Paintballing/24251_1395408043148_1170626626_1204038_5382765_n.jpg" alt="" width="110" height="110" /> </a> </div> </div> An example of one block. If I view the source (in Firefox) and click on the image.php?dir=img/events/Paintballing/24251_1395408043148_1170626626_1204038_5382765_n.jpg by exmaple, I can see the thumbnail at it's 150 x 150 size but in the layout, it shows a black thumbnail... Does anyone know why this is happening?

    Read the article

  • Codeigniter return config file as array with autoload enabled

    - by Fverswijver
    So I'm using CodeIgniter to build a website and I've made it so that all my specific settings are stored in a config file that's automatically loaded. I've also built a page that loads the settings file, makes a nice little table and allows me to edit everything from that page, afterwards it saves the entire page again (I know I could've done the same with a database but I want to try it this way). My problem is that I can't seem to use this bit when autoloading of my config file is enabled, but when I disable autoloading I can't seem to manually load it, it never finds my variables. So what I'm doing here is just taking all values from the config file and putting them in a single array so I can pass this array onto my settings administration page (edit/show all settings). $this->config->load('site_settings', TRUE); $data['settings'] = $this->config->item('site_settings'); ... $this->load->view('template', $data); config/site_settings.php <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); $config['header_img'] = './img/header/'; $config['copyright_text'] = 'Copyright Instituto Kabu'; $config['copyright_font'] = './system/fonts/motoroil.ttf'; $config['copyright_font_color'] = 'ffffff'; $config['copyright_font_size'] = '32';

    Read the article

  • Image generated with PHP dosn't show

    - by lolalola
    Hi, whats wrong with my code. image dosn't show in test2.php file File: test2.php: <img src = "test.php" /> File: test.php session_start(); $md5_hash = md5(rand(0,999)); $security_code = substr($md5_hash, 15, 5); $_SESSION["security_code"] = $security_code; $width = 100; $height = 20; header("Content-type: image/png"); $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 204, 204, 204); ImageFill($image, 0, 0, $black); //Add randomly generated string in white to the image ImageString($image, 3, 30, 3, $security_code, $white); //Throw in some lines to make it a little bit harder for any bots to break imageRectangle($image,0,0,$width-1,$height-1,$grey); imageline($image, 0, $height/2, $width, $height/2, $grey); imageline($image, $width/2, 0, $width/2, $height, $grey); imagepng($image); imagedestroy($image);

    Read the article

  • php, image dosn't show

    - by lolalola
    Hi, whats wrong with my code. image dosn't show in test2.php file File: test2.php: <img src = "test.php" /> File: test.php session_start(); $md5_hash = md5(rand(0,999)); $security_code = substr($md5_hash, 15, 5); $_SESSION["security_code"] = $security_code; $width = 100; $height = 20; header("Content-type: image/png"); $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $grey = ImageColorAllocate($image, 204, 204, 204); ImageFill($image, 0, 0, $black); //Add randomly generated string in white to the image ImageString($image, 3, 30, 3, $security_code, $white); //Throw in some lines to make it a little bit harder for any bots to break imageRectangle($image,0,0,$width-1,$height-1,$grey); imageline($image, 0, $height/2, $width, $height/2, $grey); imageline($image, $width/2, 0, $width/2, $height, $grey); imagepng($image); imagedestroy($image);

    Read the article

  • Creating an HTML file by combining multiple PHP files via the command line?

    - by FishOrDie
    Is it possible to combine multiple PHP files via the command line and create an HTML file? For example, this will save the rendered version of a single PHP file as HTML: php /path/to/my/file/filename.php > /path/to/my/file/test.html I need it to combine multiple files, but I can't seem to get it it to work. Ideally, it would be something like this: php /path/to/my/file/filename.php + /path/to/my/file/filename2.php + /path/to/my/file/filename3.php > /path/to/my/file/test.html Is this possible? If so, how?

    Read the article

  • Why doesn't this PHP execute?

    - by cam
    I copied the code from this site exactly: http://davidwalsh.name/web-service-php-mysql-xml-json as follows, /* require the user as the parameter */ if(isset($_GET['user']) && intval($_GET['user'])) { /* soak in the passed variable or set our own */ $number_of_posts = isset($_GET['num']) ? intval($_GET['num']) : 10; //10 is the default $format = strtolower($_GET['format']) == 'json' ? 'json' : 'xml'; //xml is the default $user_id = intval($_GET['user']); //no default /* connect to the db */ $link = mysql_connect('localhost','username','password') or die('Cannot connect to the DB'); mysql_select_db('db_name',$link) or die('Cannot select the DB'); /* grab the posts from the db */ $query = "SELECT post_title, guid FROM wp_posts WHERE post_author = $user_id AND post_status = 'publish' ORDER BY ID DESC LIMIT $number_of_posts"; $result = mysql_query($query,$link) or die('Errant query: '.$query); /* create one master array of the records */ $posts = array(); if(mysql_num_rows($result)) { while($post = mysql_fetch_assoc($result)) { $posts[] = array('post'=>$post); } } /* output in necessary format */ if($format == 'json') { header('Content-type: application/json'); echo json_encode(array('posts'=>$posts)); } else { header('Content-type: text/xml'); echo '<posts>'; foreach($posts as $index => $post) { if(is_array($post)) { foreach($post as $key => $value) { echo '<',$key,'>'; if(is_array($value)) { foreach($value as $tag => $val) { echo '<',$tag,'>',htmlentities($val),'</',$tag,'>'; } } echo '</',$key,'>'; } } } echo '</posts>'; } /* disconnect from the db */ @mysql_close($link); } And the php doesn't execute, it just displays as plain text. What's the dealio? The host supports PHP, I use it to run a Wordpress blog and other things.

    Read the article

  • Check if date is allowed weekday in php?

    - by moogeek
    Hello! I'm stuck with a problem how to check if a specific date is within allowed weekdays array in php. For example, function dateIsAllowedWeekday($_date,$_allowed) { if ((isDate($_date)) && (($_allowed!="null") && ($_allowed!=null))){ $allowed_weekdays=json_decode($_allowed); $weekdays=array(); foreach($allowed_weekdays as $wd){ $weekday=date("l",date("w",strtotime($wd))); array_push($weekdays,$weekday); } if(in_array(date("l",strtotime($_date)),$weekdays)){return TRUE;} else {return FALSE;} } else {return FALSE;} } ///////////////////////////// $date="21.05.2010"; $wd="[0,1,2]"; if(dateIsAllowedWeekday($date,$wd)){echo "$date is within $wd weekday values!";} else{echo "$date isn't within $wd weekday values!"} I have input dates formatted as "d.m.Y" and an array returned from database with weekday numbers (formatted as 'Numeric representation of the day of the week') like [0,1,2] - (Sunday,Monday,Tuesday). The returned string from database can be "null", so i check it too. Them, the isDate function checks whether date is a date and it is ok. I want to check if my date, for example 21.05.2010 is an allowed weekday in this array. My function always returns TRUE and somehow weekday is always 'Thursday' and i don't know why... Is there any other ways to check this or what can be my error in the code above? thx

    Read the article

  • using usort to re-arrange multi-dimension array

    - by Thomas Bennett
    I have a large array: [0] => stdClass Object ( [products] => Array ( [0] => stdClass Object ( [body_html] => bodyhtml [published_at] => 2012-12-16T23:59:18+00:00 [created_at] => 2012-12-16T11:30:24+00:00 [updated_at] => 2012-12-18T10:52:14+00:00 [vendor] => Name [product_type] => type ) [1] => stdClass Object ( [body_html] => bodyhtml [published_at] => 2012-12-16T23:59:18+00:00 [created_at] => 2012-12-16T10:30:24+00:00 [updated_at] => 2012-12-18T10:52:14+00:00 [vendor] => Name [product_type] => type ) ) ) and I need to arrange each of the products by the date they where created... I've tried and failed all kinds of usort, ksort, uksort techniques to try and get it to be in a specific order (chronological) but failed! any guidance would be most appreciated

    Read the article

  • PHP GET issue - it aint workin!

    - by benhowdle89
    I have a simple PHP form which displays inputs with values from a mysql DB and send the form results to another page which updates a db table based on the GET results: echo "<form method='get' action='updateprojects.php'>"; echo "<table>"; echo "<tr>"; echo " <th>Project No</th> <th>Customer Name</th> <th>Description</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><input value=" . $row['project_no'] . "></input></td>"; echo "<td><input value='" . $row['cust_name'] . "'></input></td>"; echo "<td><input value='" . $row['description'] . "'></input></td>"; echo "</tr>"; } echo "</table>"; echo "<input type='submit' value='Update' />"; echo "</form>"; on updateprojects.php i have set up the GET variable and even echoed them to check but nothing comes through! Cannot see why!? This is the start of updateprojects.php: echo $_GET['project_no'].$_GET['cust_name'].$_GET['description'];

    Read the article

  • Any PHP MVC framework planning to use 5.3 features?

    - by alexandrul
    I would like to get started with PHP, and 5.3 release seems to bring many nice features (namespaces, lambda functions, and many others). I have found some MVC frameworks, and some of them support only PHP 5: PHP Frameworks PHP MVC Frameworks Model–view–controller on Wikipedia but can anyone recommend one of those MVC frameworks that plans to actively use PHP 5.3 features, not just being compatible with PHP 5.3? Update Results so far: Zend Framework 2.0 (in development) Lithium (in development, based on CakePHP) Symfony (in development) FLOW3 (in development, alpha)

    Read the article

< Previous Page | 155 156 157 158 159 160 161 162 163 164 165 166  | Next Page >