Search Results

Search found 31819 results on 1273 pages for 'sphinx php'.

Page 80/1273 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • Displaying name instead of ID PHP MySQL

    - by Derek
    Hi, I need something simple; I have page where a user clicks an author to see the books associated with that author. On my page displaying the list of books for the author, I want a simple HTML title saying: 'The books for: AUTHORNAME' I can get the page to display author ID but not the name. When the user clicks the link in the previous page of the author, it looks likes this: <a href="viewauthorbooks.php?author_id=<?php echo $row['author_id']?>"><?php echo $row['authorname']?></a> And then on the 'viewauthorbooks.php?author_id=23' I have declared this at the start: $author_id = $_GET['author_id']; $authorname = $_GET['authorname']; And finally, 'The books for: AUTHORNAME, where it says AUTHORNAME, I have this: echo $authorname (With PHP tags, buts its not letting me put them in!) And this doesnt show anything, however if I change it to author_id, it displays the correct author ID that has been clicked, but its not exactly user friendly!! Can anyone help me out!

    Read the article

  • web site in pure php with clean url

    - by Testadmin
    Hi I have enabled mod_rewrite in my Xampp apache. When I run my php info page, I saw mod_rewrite under Loaded Modules. So I think it's enabled. Then I create a folder clean-url under htdocs. Inside clean-url folder I have 3 files 1) index.php here I put Welcome 2) Test. php 3) .htaccess Here I put RewriteEngine On RewriteRule ^([a-z]+)/([a-z-]+)$ /$1/$2.php [L] I want to run the index page, and by clicking on that hyper link I want to display the test.php page with URL mydomain/clean-url/test I know I am in a wrong path. Does any one help me? Or correct me? ALso i don't know any idea about url rewriting and .htaccess. Please help me.

    Read the article

  • PHP to C# and Vice versa

    - by Daniel Sh.
    I'm in this project: A web page that's gonna be used by the front-end company people to query and update data from a SQL DB. I'm working with visual studio and the code behind (C#) is almost done, so the interactions between SQL and C# and ok. My original idea was to work with ASP.NET which is familiar to me, but that's not gonna be possible. I have to switch to PHP. So, today is my first day learning PHP, checking http://php.net/manual/en/index.php and a lot of things seem quite similar to ASP.NET so I guess it won't be that hard. Anyways, some questions popped up quite fast as I wanted to script something else than a "hello world" . Is there an easy way to get/send C# variables from my class using a php page? I've read soemthing about using XML in order to do so, but still I'm scratching my head, is there another, easier, way to do this?

    Read the article

  • Executing functions parallelly in PHP

    - by binaryLV
    Hi! Can PHP call a function and don't wait for it to return? So something like this: function callback($pause, $arg) { sleep($pause); echo $arg, "\n"; } header('Content-Type: text/plain'); fast_call_user_func_array('callback', array(3, 'three')); fast_call_user_func_array('callback', array(2, 'two')); fast_call_user_func_array('callback', array(1, 'one')); would output one (after 1 second) two (after 2 seconds) three (after 3 seconds) rather than three (after 3 seconds) two (after 3 + 2 = 5 seconds) one (after 3 + 2 + 1 = 6 seconds) Main script is intended to be run as a permanent process (TCP server). callback() function would receive data from client, execute external PHP script and then do something based on other arguments that are passed to callback(). The problem is that main script must not wait for external PHP script to finish. Result of external script is important, so exec('php -f file.php &') is not an option.

    Read the article

  • How to assign a PHP variable that contains a mixed of PHP and html elements?

    - by Rick
    I have a PHP page that contains html and tags and PHP codes and I am using AJAX to manipulate some data and now I need to spit out the response but I am not sure if it is possible to put the mixed content into a string variable to pass through... Is this possible? For example I need to: $response = "<p>some text--<?php echo $something; ?>"; Thanks... To clear things up, I am not trying to send raw PHP code to clientside as that would be silly and won't be evaluated as it is a server side script. I am just looking for a fast way to put everything into a variable without manually re-doing the whole page stripping out the php open and close tags and echos...etc

    Read the article

  • PHP Redirect location with htaccess

    - by Wayne
    In one of the page I have is where administrators are allowed, however, I use if the session isn't set, the header will redirect them to index.php and that method works. If I replace index.php with home which is for the htaccess which changes it to index.php but it gives an error in the browser This works: if(!isset($_SESSION['MEMBER'])){ header("Location: index.php"); } This does not work: if(!isset($_SESSION['MEMBER'])){ header("Location: home"); } htaccess: RewriteRule ^home$ index.php The error in Firefox: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies. What's wrong with it? How do I get this method to work?

    Read the article

  • PHP: include inside include

    - by Karem
    In dbc.php I have where the connection to the mysql db gets made, and all my functions is there. dbc.php is included on all my files. Now all functions are in dbc.php and i would like to sort out alittle. I was thinking about putting all form_*() functions to form_api.php, and then include it in dbc.php. But will this work? Can i just include inside a file i included? Or should i use require/include_once ? help me out thank you

    Read the article

  • php variable persistance

    - by Illes Peter
    I have two files: index.php /lib/user.php Index contains the form: <div class="<? echo $msgclass; ?>"> <? echo $msg; ?> </div> <form id="signin" action="/lib/user.php" method="post"> ... </form> User.php makes all the processing. It sets $msg to 'some error message' and $msgalert to 'error' in case of any error. At the end of processing it uses header() to redirect to index.php But after redirection $msg and $msgalert no longer persist and index only gets empty vars. How can i fix this?

    Read the article

  • Calling C/C++ library function from PHP

    - by Anon. BlackBerry Developer
    We have a PHP web app running on a customer's machine. For an update, we have a bit of code in C that we'd like to include as a native opaque library along with the PHP web app. How does one go about calling a C/C++ lib. function from PHP? It cannot be assumed that the PHP app, called by the web server, has any sort of permission to call an exec(), eval(), or system() type of function to execute a C wrapper driver which in turn uses the C/C++ library, so it would need to be a direct C library use from within the PHP code.

    Read the article

  • (PHP)how to hold javascript alertbox on screen

    - by Piyush
    when user changes password I want to show message "Successfully changed!" and when user clicks on OK button of alert box I call logout.php and force user to login with new password.But the problem is PHP header() is not waiting for alertbox and directly goes to logout.php. my code- if($count==1) { $sqlchange="UPDATE $tbl_name SET password='$newpassword' WHERE userId='$myusername'"; unset($result); $result=mysql_query($sqlchange,$link); if($result>0) { ?> <script type="text/javascript"> alert("Your Password has been changed successfully.Please login again."); </script> <?php header("location:logout.php"); exit; } else {....

    Read the article

  • Pass value to an include file in php.

    - by Muhammad Sajid
    Hi, How do you pass a parameter into an include file? I tried the following but it doesn't work. include "myfile.php?var=123"; and in myfile.php, I try to retrieve the parameter using $_GET["var"]. include "myfile.php?var=123"; will not work. PHP searches for a file with this exact name and does not parse the parameter for that I also did this: include "http://MyGreatSite.com/myfile.php?var=123";but it does not also work. Any hints? Thanks.

    Read the article

  • Making a PHP object behave like an array?

    - by Mark Biek
    I'd like to be able to write a PHP class that behaves like an array and uses normal array syntax for getting & setting. For example (where Foo is a PHP class of my making): $foo = new Foo(); $foo['fooKey'] = 'foo value'; echo $foo['fooKey']; I know that PHP has the _get and _set magic methods but those don't let you use array notation to access items. Python handles it by overloading __getitem__ and __setitem__. Is there a way to do this in PHP? If it makes a difference, I'm running PHP 5.2.

    Read the article

  • Easy way to combine php code (lame question)

    - by alekseygr
    Hi, I have vary easy and LAME question. I have code: <?php if (function_exists("insert_audio_player")) {insert_audio_player("[audio:|titles=]"} ?> This code outputs audio player to my page in wordpress. I need to call custom field inside this code. My custom field code is: <?php print_custom_field('tc_filename'); ?> Something like: <?php if (function_exists("insert_audio_player")) {insert_audio_player("[audio:<?php print_custom_field('tc_filename'); ?>|titles=<?php print_custom_field('tc_title'); ?>]"} ?> How can I call for second code inside first? Thx.

    Read the article

  • Does FastCGI support PHP 5.3.2 centOS?

    - by bn
    I just upgrade the PHP version in my VPS to 5.3.2 I used FastCGI and worker MPM in php 5.1.2 or 5.2.1 I forgot, it worked fine, and it was so fast, I like it. After I upgrade the PHP version, it gives me Internal Server Error 500 on all .php pages. What is wrong? does FCGI support php 5.3.2? If yes, there should be some differences in setting it up? what should I change to get it back working? Thank You

    Read the article

  • Apache/PHP is determined to serve the wrong file

    - by Lucas
    I have a page that is called with a url like http://testserver/path/to/foo/bar/ but apache is serving the wrong file altogether. /path/to/ is a real directory where all the code and .htaccess file is. foo/bar/ is supposed to redirect to foo_bar.php with a RewriteRule, but it never gets there. It's not a mod_rewrite issue as I have commented out all the rules that could be interfering, which should give me 404s for that request, but the same problem occurs: the file that is served is /path/to/foo.php, so in it I var_dump $_SERVER and get: REQUEST_URI = /path/to/foo/bar/ SCRIPT_NAME = /path/to/foo.php SCRIPT_FILENAME = /real/path/to/foo.php PATH_INFO = /bar/ PATH_TRANSLATED = /real/bar/ PHP_SELF = /path/to/foo.php/bar/ Why is this request being routed to this file at all?

    Read the article

  • Passing PHP session variable to AJAX URL

    - by user547794
    Hello, I am trying to pass a session variable into an AJAX loaded page. Here is the code I am using: jQuery(document).ready(function(){ $("#userdetail").click(function() { $.ajax({ url: "userdetail.php?id=<?php $_SESSION['uid']?>", success: function(msg){ $("#results").html(msg); } }); }); }); This is the HTML URL I had working, not sure how to get this into the AJAX call: userdetail.php?id=<?php $_SESSION['uid']?> I should also mention that if I manually pass in the userID it works fine url: "userdetail.php?id=1",

    Read the article

  • PHP and Java interoperablity

    - by Jack
    I am working on windows using tomcat 6 and PHP/Java Bridge. I know how to access a Java file from PHP but how do we do it the other way i.e accessing PHP from Java <?php require_once("java\Java.inc"); $systemInfo = new Java("java.lang.System"); print "Total seconds since January 1, 1970: ".$systemInfo->currentTimeMillis(); ?> Also how do I access Java classes that are created by me. Do I write a CLASSPATH env variable or change the php.ini config file?

    Read the article

  • php include file issue using document root

    - by nithi
    I have used the following code to get the document root. $path = get_file_dir(); function get_file_dir() { global $argv; return realpath($argv[0]); } Below code includes config.php and config.php has the $setuprun variable with a value. if((file_exists("$path/admin/config.php"))) { include_once "$path/admin/config.php"; } if($setuprun=="true") { //do some code } In my system, it takes the document root like /home/myname/myfolder and the variable $setuprun has the value and the code works perfectly. But in another user's system, it shows the following error. Notice: Undefined variable: setuprun in /usr/local/www/chat/setup.php on line 22. He is using FreeBSD 8.2 Stable with MySQL 5, PHP5 and Apache 2.2. Can anyone please help me to solve this error?

    Read the article

  • generate php classes in bash

    - by Derek
    i have this script: #!/bin/bash if [[ -z "$1" ]] ; then echo "Class is required" exit 1; fi if [[ -z "$2" ]] ; then package="Default" else package=$2; fi echo "<?php /** * $1.class.php * * Vcard class file. * @name Project * @author Author * @link http://www.domain.com * @copyright Copyright © 2011 * @package $package * @version 1.0 */ /** * The main $1 class * @package $package */ class $1 { /** * Constructor setup. */ public function __construct() { } /** * Destructor setup. */ public function __destruct() { } } " > $1.class.php php -l $1.class.php echo "Done"; if i do: ./generate.sh my_class it creates everything with my_class. how can i modify this to: MyClass? i need to use MyClass for the filename, and the class name etc... later in the code i use the argument (in this case my_class) for some other purposes. thanks

    Read the article

  • PHP 5.3 Namespaces should i use every PHP function with backslash?

    - by lhwparis
    Hi, im now using namespaces in PHP 5.3 now there is a fallback mechanism for functions which dont exist in the namespace. so php every time checks if the function exists in namespace and then tries to load it from global space. So what about all php internal functions? strstr for example? Should i now use every php internal function with a \ ? to avoid php first checking the namespace? is this fallback a huge performance drop? what do you think?

    Read the article

  • Format MySQL code inside PHP string

    - by JohnA
    Is there any program IDE or not that can format MySQL code inside PHP string e.g. I use PHPStorm IDE and it cannot do it. It does that for PHP and MYSQL but not for MYSQL inside php string. I am ready to use new IDE because now i have to manually format hundreds of database requests that are one line and not readable. Only criteria for my choice is that ide can do that automatically. <?php ... $request1 = "select * from tbl_admin where admin_id= {$_SESSION['admin_id']} and active= 1 order By admin_id Asc"; ... ?> should become <?php ... $request1 = "SELECT * FROM tbl_admin WHERE admin_id = {$_SESSION['admin_id']} AND active = 1 ORDER BY admin_id ASC"; ... ?>

    Read the article

  • PHP Mail Function

    - by vgathan
    Is it possible to send a mail in PHP without any external packages or tools? If so, is there any requirement to configure the php.ini file? Its as follows: $to = $row-EMail_ID; $subject = "Reset your password"; $body = "Hi ".$row->Username.", \n\t\t\tA request to reset your password was received from you. \n\n\n"; $headers = "From: [email protected]\r\n"."X-Mailer: php/"; mail($to, $subject, $body, $headers); The error i get: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in F:\wamp\www\pwd.php on line 20

    Read the article

  • Using Classes / OOP in PHP

    - by Alex Demchak
    I'm pretty proficient with PHP, outside of OOP - which I am just now starting to jump in to. I've been watching videos and reading tutorials, but they are all still pretty confusing... If I have FILE 1 (class.time.php) class Time { function GetTime(){ $time = date('H:i:s'); printf($time); } } and then in a nother php page I've got FILE 2 (page.php) I can do include('class.time.php'); and then anywhere in this page I can then do $time = new Time; //Calling the class and setting the class to a variable $time->GetTime(); //This is BASICALLY saying (run the 'GetTime' function in the 'Time Class' My main question is, is the comment above (This is BASICALLY saying.....) correct? or is there a better way to think of it?

    Read the article

  • PHP Guideline required

    - by user160820
    I am interested in learning PHP, but the books that I read are in procedural style and the source code that I try to reay are also mixtures of SQL,PHP and HTML. My Background is from Java. What I want to learn is PHP really with seprate Layers. Database Layer, Controller and View but I don't want to use any Framework. I also have fried some OOP PHP books, but they not what I am lloking for. What I need is a book or any Document that develops a sample website in pure PHP but in OOP style. Any Help. Thanks a lot in advance.

    Read the article

  • Sometimes when visiting a php page, the browser asks me to download the .php file with nothing in it

    - by John
    I've noticed an unusual problem with some of my php programs. Sometimes when visiting a page like profile.edit.php, the browser throws a dialogue box asking to download profile.edit.php page. When I download it, there's nothing in the file. profile.edit.php is supposed to be a web form that edits user information. I've noticed this on some of my other php pages as well. I look in my apache error logs, but don't see any errors. How do i figure out why this is happening?

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >