Search Results

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

Page 169/1708 | < Previous Page | 165 166 167 168 169 170 171 172 173 174 175 176  | Next Page >

  • PHP/MySQL won't update decimal field

    - by Serhiy
    I have this query: UPDATE table_name SET field_1 = field_1 +100, field_2 = field_2 +100, field_3 = field_3 +100 WHERE id = 1 LIMIT 1; Where Field_1 is regular integer, Field_2 is decimal(15,6) and Field_3 is double(15,6). When I run this query from php script they update just field_1 and nothing happen with field_2 and field_3 they just stay as before. But when I run in phpMyAdmin it's work without any problems. I'm tried to lock tables, make round() before run update, nothing help. Please help... why I can't update decimal and float fields from php? PHP version: 5.2 Mysql version 5

    Read the article

  • PHP Variable to JQuery function?

    - by grolle
    Hi, I need a relative path in this function: $(function() { $("#searchbox").autocomplete({ minLength : 2, source : function (request, response){ $.ajax({ url : "http://linux/project/index.php/main/search/", dataType : "json", data : { key : request.term}, type : "POST", success : function(data){ response($.map(data, function(item) { return { label: item.original_name, value: item.original_name, id : item.project_id+"/"+item.folder_id+"/"+item.id } })) } }) }, select : function(event, ui) { document.location.href = "http://linux/project/index.php/projects/loaddocument/"+ui.item.id; } }); }); How can I use a PHP Variable path to replace http://linux/project in the function above? Best regards ...

    Read the article

  • Javascript alert instead of redirect in PHP mail script

    - by JCHASE11
    Thanks to Col. Shrapnel I am using a VERY basic PHP script to send emails. The form is located here. This is the script: <?php mail('[email protected]','Live Date Submission',implode("\n\n",$_POST)); header("Location: thankyou.html"); ?> When a user submits the form, they are redirected to a thankyou.html page. I want to edit the code to display a javascript alert, instead of a redirect. I don't have much PHP knowledge, so how would I edit this code to return a alert instead of a redirect?

    Read the article

  • I cant browse php pages in my local server

    - by tibin mathew
    Hi, I cant browse php pages in my local server.Before it was working fine. But now i cant browse php pages, i can browse html pages and asp pages , no problems with that. But when i try to browse a php page its not loading. What will be the problem?? I am using windows 2000 advanced server and my web server is Tomcat please someone help me Guys i'm not getting anything in my browser, its just continue to loading Nothing showing in that page i'm not getting any 404 error or anything like that. its just continue to be loading

    Read the article

  • php database session handling problem in IE8!

    - by psyb0rg
    I've got an html page from where Im making this call periodically: function logon(id) { $.get("data.php", { action: 'online', userID: id}, function(data){ $("#msg").html(data); }); } What this does is it calls this SQL script in data.php: $sql = "update user_sessions set expires=(expires + 2) where userID = $userID"; mysql_query($sql, $conn) or die(mysql_error()); echo $sql; I can see by the echo that the sql syntax and values are correct, but THE CHANGES TO THE expires FIELD ARE NOT DONE, ONLY IN IE8!! It works fine in other ff, safari, chrome, ie6 and 7. There is nothing browser specific about making this sql call, but the user_sessions table is used to store PHP's sessions. Im only increasing the session expiry time when the call is made. What in IE8's session handling is preventing the session time from changing? Is there any caching or cookie problem that needs to be changed?

    Read the article

  • [PHP] - Lowering script memory usage in a "big" file creation

    - by Riccardo
    Hi there people, it looks like I'm facing a typical memory outage problem when using a PHP script. The script, originally developed by another person, serves as an XML sitemap creator, and on large websites uses quite a lot of memory. I thought that the problem was related due to an algorithm holding data in memory until the job was done, but digging into the code I have discovered that the script works in this way: open file in output (will contain XML sitemap entries) in the loop: ---- for each entry to be added in sitemap, do fwrite close file end Although there are no huge arrays or variables being kept in memory, this technique uses a lot of memory. I thought that maybe PHP was buffering under the hood the fwrites and "flushing" data at the end of the script, so I have modified the code to close and open the file every Nth record, but the memory usage is still the same.... I'm debugging the script on my computer and watching memory usage: while script execution runs, memory allocation grows. Is there a particular technique to instruct PHP to free unsed memory, to force flushing buffers if any? Thanks

    Read the article

  • Reading multiple json values with php

    - by jason
    I am trying to read certain values from a json string in php, I am able to do a simple json string with only one value such as $json = '{"value":"somevalue"}'; Using this: <?php $json = '{"value":"somevalue"}'; $obj = json_decode(json_encode($json)); print $obj->{'value'}; ?> But when i try an get a value from the following json string it throws an error... $json = '{"field": "title","rule": {"required": "true","minlength": "4","maxlength": "150" }}'; I validated the json on JSONlint but not sure how to access the values within this with php. Thanks

    Read the article

  • deny direct access to a php file by typing the link in the url

    - by aeonsleo
    hi, I am using php session for a basic login without encryption for my site. I want to prevent a user from directly accessing a php page by typing the url when he/she is not signed in. But this is not happening. I am using session_start(), initializing session variables and aslo unsetting and destroying sesssion during logout. Also if I type the link in a different browser the page is getting displayed. I am not very well versed with php , only a beginner. I googled for such problem and found few alternatives as keeping all files in a seperate folder from the web root, using .htaccess etc. Can someone explain in simple terms what could be a good solution.thanks in advance.

    Read the article

  • How to use backreferences in PHP

    - by Slinky
    I want to add a character to the end of each file extension found in a body of text using preg_replace(). Here is some sample text: $string='http://www.mysite.com/expert/images/imageone.jpghttp://www.mysite.com/expert/images/imagetwo.jpg'; This search & replace works fine in TextWrangler, appending a semi colon to file extensions: (\.(jpg|gif|html?|php|tiff?|pdf|png)) \1; Translated to PHP, however does not work, having no effect; no errors. preg_replace("/(\.(jpg|gif|html|php|tif|tiff|pdf|htm|png))/","\\1;",$string);

    Read the article

  • Best protocol for client/server communication, from PHP/Perl to C++/Qt4

    - by Kyle
    I'm the author of an Open Source kiosk management system, Libki. The current version, though functional, was very much a learning experience for me. I'm working on a complete rewrite and am having a hard time deciding what protocol to use. The server will be written in PHP or Perl. Most likely PHP because I need to support some uncommon protocols that Library software use, ( SIP and NCIP ). So far I've only found a SIP2 library in PHP. The client is written in C++/Qt4. I'm looking at RPC and REST for client/server communication. I've found RPC client libraries for Qt4, and REST is already part of the Qt4 libraries. Is there an alternative I've missed? So far, REST seems to be the winner.

    Read the article

  • PHP Possible Memory Leak

    - by dropson
    I have a script that loops through a database for images to convert with gd & imagick. I unset or replace all variables and objects in between each loop. For each loop, get_memory_usage(1) reveals a concurrent amount of memory used by that script. Which is expected. But, when I run "top", the %MEM column reports that this script, (same PID), increments with several percentages for each loop. I destroy all images when I'm done with them, and when I run get_defined_vars(); only the standard globals and a few variables I have is set. Why is "top" % Memory Usage different than what PHP reports? After 10 loops, PHP has taken 20% percetage of the system memory. I run php 5.2.6 on Debian 5

    Read the article

  • Use text input as php variable

    - by Thomas Lai
    <input type="text" onkeydown="domaincheck()" /> <?php function domaincheck() { $recordexists = checkdnsrr("", "ANY"); if ($recordexists) echo "The domain name has been taken. Sorry!"; else echo "The domain name is available!"; } ?> I want my php code to process the text input and say if it's a valid domain or not. The only thing that doesn't work is linking the input to the php.

    Read the article

  • Quick way to do data lookup in PHP

    - by Ghostrider
    I have a data table with 600,000 records that is around 25 megabytes large. It is indexed by a 4 byte key. Is there a way to find a row in such dataset quickly with PHP without resorting to MySQL? The website in question is mostly static with minor PHP code and no database dependencies and therefore fast. I would like to add this data without having to use MySQL if possible. In C++ I would memory map the file and do a binary search in it. Is there a way to do something similar in PHP?

    Read the article

  • receive xml file via post in php

    - by thegunner
    Hi, I'm looking for a PHP script that can accept an XML file via a POST, then send a response.... Does anyone have any code that could do this? So far the only code I have is this but not sure about the response or if indeed I am even going in the right direction as XML characters are not saved correctly. Any ideas? <?php if ( $_SERVER['REQUEST_METHOD'] === 'POST' ){ $postText = file_get_contents('php://input'); } $datetime=date('ymdHis'); $xmlfile = "myfile" . $datetime . ".xml"; $FileHandle = fopen($xmlfile, 'w') or die("can't open file"); fwrite($FileHandle, $postText); fclose($FileHandle); ?> Thanks,

    Read the article

  • php quick form creation

    - by Akshey
    Hi, I have been using php from some time and I have noticed that it takes a long time to create a form with validation using php. Are there any scripts or IDE wizards which can assist a programmer to create php forms quickly and also give the programmer flexibility to customize the form easily? I found some webservices which provide such services but they are mostly oriented towards non-programmers and the forms they generate are not easily customizable and do not support all kinds of functionalities. Infact, most of them are meant for generating contact forms. Regards, Akshey

    Read the article

  • jQuery prepend a auto fetch php file database

    - by newinjs
    Hello, Currently i have a php file which fetch data from mysql to display in website. I'm using input value to send as $_GET parameter to php file to determine the data to show. mysql_query("SELECT * FROM messages WHERE msg_id>'$refID' ORDER BY msg_id DESC"); //$refID is input value So once it load, i'm using this jquery code to display it on website setInterval( function () { $.get('load.php?id='+refID, function(html) { $("ol#update").prepend(html); $("ol#update li:first").slideDown("slow"); }); }, 10000); My question is how do i stop it from keep on repeating the same message? i want it to display if there is new data.

    Read the article

  • Getting Older PHP Extensions

    - by maSnun
    Hello All, It happens that I need the GD, SQLite and a few more extensions for php 5.1. But I can't find out where to get them. I am using WinBinder to develop some desktop applications for Windows with php. The minimal php 5.1 pack has the winbinder extension only. I need other extensions for enhanced features like image editing or data storage. Can anybody help? I really need this very much. Thanks and Regards, Masnun

    Read the article

  • best way to prgram php and mysql query

    - by air
    most of times in our pages we need to print only 1 field value of table in loop. for example <?php for($i=1;$i<=mysql_num_rows($result);$i++) { echo $row['name']; $sql1="select industry from table_industry where profid='".$row['prof']."'"; $result1=mysql_query($sql1); $row1=mysql_fetch_array($result1); echo $row1['industry']; ?> } ?> above is one PHP code just for example where we think that $row['prof'] carry value of profession ID and we print profession of each person. for example we have 5000+ record in table and above loop will execute for 5000+ times what will be the best way to print value of industry field from table table_industry Same code which i write above ? any other php code suggestion for faster execution and less use of resources? Thanks

    Read the article

  • php second countdown

    - by jesop
    in my php page i have: <?php setcookie("game", "GOW2", time()+3); echo $_COOKIE["game"]."</br>"; echo "<a href=\"/mypro/mypro2.php/\">Refresh</a></br>"; ?> now i want at page load or when user clicks on 'Refresh' the following functionality the timer should get reset and get displayed (as a countdown) and this countdown goes till it reaches 0 and stops. is this can be done??

    Read the article

  • PHP code in drupal pages treating > as ?>

    - by AmaDaden
    While working on an existing Drupal site I've noticed a strange glitch that causes any PHP operator with in it to act like a ? tag. This is happening in in Drupal pages that I create that have a 'Input Format' of 'PHP code'. For example this line of code foreach($array as $key = $value){ results in a very broken page that prints out $value){ Does any one know what could be causing this? My Dev environment is XAMPP. Drupal version is 6.15. PHP version is 5.2.9.

    Read the article

  • Upload image using CURL + PHP via remote form

    - by user253530
    I have a few images that i need to upload using an online form. So far here's my code $info = array('test title','1234','virginia','@'.realpath('e:\wamp\www\1.jpg'),'@'.realpath('e:\wamp\www\2.jpg'),'@'.realpath('e:\wamp\www\3.jpg'),'@'.realpath('e:\wamp\www\4.jpg'),'test description'); $post->postAd($url, $info); The $info array is processed in the postAd method and it's being sent as an associative array using a method from a Curl class i have (it has been tested and worked nicely with everything i needed to do so far with curl). The problem is that the data is completed correctly on the form but the images are not uploaded. Can anyone help with advices/code/guidance?

    Read the article

  • a reddit-php-sdk method not outputting anything

    - by diggpthoo
    I'm trying to learn reddit code and using this https://github.com/jcleblanc/reddit-php-sdk There's a method in this library $reddit->getUser() which outputs null always. Everything else seems to be working though. include_once("jcleblanc-reddit-php-sdk-4a4cc32/reddit.php"); $reddit = new reddit("my-username", "my-password"); $userData = $reddit->getUser(); var_dump($userData); outputs null. $response = $reddit->getListing("all", 5); var_dump($response); outputs what's expected just fine. Then what could be going wrong with $reddit->getUser()?

    Read the article

  • PHP require/include only works once in script then fails

    - by Colin
    Hi everybody, this isn't a problem as such but it's bugging me and I would appreciate any help. It might be totally obvious but I can't see it. $root_path = $_SERVER['DOCUMENT_ROOT'] require($root_path .'template/header.php') require($root_path .'template/footer.php') The script will include one or the other but not both. It will run and include the header but not the footer, if I swap them round it will load the footer first but not the header. I've tried using include instead of require but get the same result. It gives the error allow_url_include = 0. I know turning this on will solve it but my question is why is it happening? Why will it include one file but not the other? Is there any way to get them to both run without turning allow_url_include on (I'm trying to be security conscious). I have PHP 5.3 and am running WAMP. Thanks in advance for your help!

    Read the article

  • PHP - SQL query to get update time from table status

    - by Tribalcomm
    This is my php code (I already have a connection to the db): $array = mysql_query("SHOW TABLE STATUS FROM mytable;"); while ($array = mysql_fetch_array($result)) { $updatetime = $array['Update_time']; } echo $updatetime; I get: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource. I am running MySQL 5.0.89 and PHP5. I do not want to add a new field to the table... I want to use the table status... Any help? Thanks!

    Read the article

  • Passing variables from SQL proceedure to PHP

    - by Sam Corbet
    I am trying to create an sql proceedure that will return the results back to the php page. I want to be able to call the procedure as follows from the php call procedure_name($var1) which will run this script: -- --------------------------------------------------------------------------------- -- pUIGetCliStmtGenFlag -- -- This procedure returns the status of the Trading Period: -- -- --------------------------------------------------------------------------------- drop procedure if exists pUIGetCliStmtGenFlag; delimiter // create procedure pUIGetCliStmtGenFlag( IN pTradingPeriodMonth DATE ) MODIFIES SQL DATA COMMENT 'Checks if the TP has been closed' begin SELECT trading_period_month, dt_end, amt_traded_system_ccy FROM ca_trading_period WHERE trading_period_month=$var1 -- If amt_traded_system_ccy is NULL give the TP an open status otherwise mark as closed IF amt_traded_system_ccy is NULL $tpstatus='open' ELSE $tpstatus='closed' end; // delimiter ; I then want to be able to use $tpstatus in the rest of the php script. I know this is simple but this is completely new to me and I cant find the correct method

    Read the article

< Previous Page | 165 166 167 168 169 170 171 172 173 174 175 176  | Next Page >