Search Results

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

Page 57/1273 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • trying to backup mysql database using php

    - by user225269
    I got this code from this site: http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx But I'm just a beginner so I don't know what the config.php and opendb.php suppose to mean. Do I have to create those 2 files in order for this code to work? If yes, then how do I create it, it isn't included in the site how to create it. <?php include 'config.php'; include 'opendb.php'; $tableName = 'mypet'; $backupFile = 'backup/mypet.sql'; $query = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName"; $result = mysql_query($query); include 'closedb.php'; ?> can I just include these lines on the top code so that I will not be putting the include 'opendb.php' anymore: $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Hospital", $con);

    Read the article

  • Sanitize input before executing at server in php

    - by Interfaith
    I want to let user input two variable, Name and Password in a form. I want to disable any XSS or script insert in the input values. I have the following code in the form method: <form name="form1" method="post" action="checkpw.php"> Your Name: <table> <tr><td><input class="text" name="name" onBlur="capitalize(this);" maxlength=12 type="text" /></td></tr> </table> Password: <table> <tr><td><input class="text" name="passwd" maxlength=8 type="password" /></td></tr> <tr><td align="center"><br/> <input class="text" type="submit" name="submitbt" value="Login" /> </td></tr> </table> and the following checkpw.php: <?php // Clean up the input values $post = filter_input_array(INPUT_POST, array( 'name' => FILTER_SANITIZE_STRING, 'pw' => FILTER_SANITIZE_STRING, )); if (is_null($post) || in_array(null, $post)) { header("location:login.php"); return; // missing fields (or failed filter) } // pw is the password sent from the form $pw=$_POST['passwd']; $name=$_POST['name']; if($pw == 'testpass'){ header("location:index.php"); } else { header("location:wrong.php"); } ?> Is this a secure way to ensure the form is sent to the server and executed ONLY after the input values have been sanitized? Also, the $name value i want to pass it to index.php file. I insert a code in the index.php as follow: <?php echo $name ?> But it's empty. Any idea how to resolve it?

    Read the article

  • cURL Affects Cookie Retrieval in PHP?

    - by CJ
    I'm not sure if I'm asking this properly. I have two PHP pages located on the same server. The first PHP page sets a cookie with an expiration and the second one checks to see if that cookie was set. if it is set, it returns "on". If it isn't set, it returns "off". If I just run the pages like "www.example.com/set_cookie.php" AND "www.example.com/is_cookie_set.php" I get an "on" from is_cookie_set.php. Heres the problem, on the set_cookie.php file I have a function called is_set. This function executes the following cURL and returns the contents ("on" or "off"). Unfortunately, the contents are always returned as "off". however, if I check the file manually ("www.example.com/is_cookie_set.php") I can see that the cookie was set. Heres the function : <?php function is_set() { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://example.com/is_cookie_set.php'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec ($ch); curl_close ($ch); echo $contents; } ?> Please note, I'm not using cURL to GET or SET cookies, only to check a page that checks if the cookie was set. I've looked into CURLOPT_COOKIEJAR, and CURLOPT_COOKIEFILE, but I believe those are for setting cookies via cURL and I don't want to do this.

    Read the article

  • A stupid question about wordpress and php

    - by bubdada
    It may seem stupid question, but i've a serious problem... if you could check out orcik.net the thumbnail images does not appear. I figured out the reason but I don't know how to solve.. http://orcik.net/projects/thumb/orcikthumb.php?src=http://orcik.net/wp-content/uploads/2010/05/mac-safari-search-cache.png If you go to the above link you will get page not found error. However, if you go to the link below you'll get the thumbnail version of the image... http://orcik.net/projects/thumb/orcikthumb.php?src=/wp-content/uploads/2010/05/mac-safari-search-cache.png I'm using this piece of code on wordpress and the line appears like <a href="<?php the_permalink() ?>" rel="bookmark"> <img src="<?php bloginfo('template_directory'); ?>/includes/orcikthumb.php?src=<?php get_thumbnail($post->ID, 'full'); ?>&amp;h=<?php echo get_theme_mod($height); ?>&amp;w=<?php echo get_theme_mod($width); ?>&amp;zc=1" alt="<?php the_title(); ?>" /> </a> Thus, I believe I can't change the directory of image. But I could not figure out why I am getting page not found error. Is that might be CHMOD'es??? or something else?? Thanks

    Read the article

  • header location won't work in php

    - by Jayden Kelly
    I am making a login page for my website but the header location won't work. here is the code of login.php: <?php include ( './includes/header.php' ); if (isset($_POST['submit'])) { $username = $_POST['username']; $password = $_POST['password']; $check_username = mysql_query("SELECT username FROM users WHERE username='$username'"); $numrows = mysql_num_rows($check_username); if ($numrows != 1) { echo 'That User doesn\'t exist.'; } else { $check_password = mysql_query("SELECT password FROM users WHERE password='$password' && username='$username'"); while ($row = mysql_fetch_assoc($check_password)) { $password_db = $row['password']; if ($password_db == $password) { $_SESSION['username'] = $username; header("Location: members.php"); } } } } ?> <h2>Login to Your Account</h2> <form action='login.php' method='POST'> <input type='text' name='username' value='Username ...' onclick='value=""'/><p /> <input type='password' name='password' value='Password ...' onclick='value=""'/><p /> <input type='submit' name='submit' value='Login to my Account' /> </form> I would really appreciate it if someone could help me, thanks. P.S. If you need the php part of the header file it is here: <?php session_start(); include ( './includes/functions.php' ); include ( './includes/connect_to_mysql.php' ); ?>

    Read the article

  • PHP Mail() not working on remote server

    - by Amaerth
    I am developing an application and have been testing the mail() function in PHP. The following works just fine on my local machine to send emails to myself, but as soon as I try to send it from the testing environment to my local machine, it silently fails. I will still get the "Mail Sent" message, but no message is sent. I turned on the mail logging in the php.ini file, but even that doesn't seem to be populated after I refresh the page. Again, the .php files and php.ini files are identical in both environments. Port 25 has been opened on the testing environment, and we are using a Microsoft Exchange server. <?php $to = "[email protected]"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "[email protected]"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> SMTP area of the php.ini file: [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = exhange.server.org ; http://php.net/smtp-port smtp_port = 25 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = [email protected]

    Read the article

  • PHP Session doesn't get read in next page after login validation, Why?

    - by NetStar
    I have a web site and when my users login it takes them to verify.php (where it connects to the DataBase and matches email and password to the user input and if OK puts client data into sessions and take the client to /memberarea/index.php ELSE back to login page with message "Invalid Email or password!") <?php ob_start(); session_start(); $email=$_POST['email']; $pass=md5($_POST['pass']); include("conn.php"); // connects to Database $sql="SELECT * FROM `user` WHERE email='$email' AND pass='$pass'"; $result=mysql_query($sql); $new=mysql_fetch_array($result); $_SESSION['fname']=$new['fname']; $_SESSION['lname']=$new['lname']; $_SESSION['email1']=$new['email1']; $_SESSION['passwrd']=$new['passwrd']; $no=mysql_num_rows($result); if ($no==1){ header('Location:memberarea/index.php'); }else { header("Location:login.php?m=$msg"); //msg="Invalid Login" } ?> then after email id and password is verified it takes them to ` /memberarea/index.php (This is where the problem happens.) where in index.php it checks if a session has been created in-order to block hackers to enter member area and sends them back to the login page. <? session_start(); isset($_SESSION['email'])` && `isset($_SESSION['passwrd'])` The problem is the client gets verified in verify.php (the code is above) In varify.php only after I put ob_start(); ontop of session_start(); It moves on to /memberarea/index.php , If I remove ob_start() It keeps the client on the verify.php page and displays error header is alredy SENT. after I put ob_start() it goes in to /memberarea/index.php but the session is blank, so it goes back to the login page and displays the error ($msg) "Invalid Login" which I programed to display. Can anyone tell me why the session cant pass values from verify.php to /memberarea/index.php

    Read the article

  • Image error with wordpress and php

    - by bubdada
    It may seem stupid question, but i've a serious problem... if you could check out orcik.net the thumbnail images does not appear. I figured out the reason but I don't know how to solve.. http://orcik.net/projects/thumb/orcikthumb.php?src=http://orcik.net/wp-content/uploads/2010/05/mac-safari-search-cache.png If you go to the above link you will get page not found error. However, if you go to the link below you'll get the thumbnail version of the image... http://orcik.net/projects/thumb/orcikthumb.php?src=/wp-content/uploads/2010/05/mac-safari-search-cache.png I'm using this piece of code on wordpress and the line appears like <a href="<?php the_permalink() ?>" rel="bookmark"> <img src="<?php bloginfo('template_directory'); ?>/includes/orcikthumb.php?src=<?php get_thumbnail($post->ID, 'full'); ?>&amp;h=<?php echo get_theme_mod($height); ?>&amp;w=<?php echo get_theme_mod($width); ?>&amp;zc=1" alt="<?php the_title(); ?>" /> </a> Thus, I believe I can't change the directory of image. But I could not figure out why I am getting page not found error. Is that might be CHMOD'es??? or something else?? Thanks

    Read the article

  • Which is faster: in_array() or a bunch of expressions in PHP?

    - by Darryl Hein
    Is it faster to do the following: if ($var != 'test1' && $var != 'test2' && $var != 'test3' && $var != 'test4') { ... } Or: if (!in_array($var, array('test1', 'test2', 'test3', 'test4') { ... } Is there a number of values at which point it's faster to do one or the other? (In this case, the array used in the second option doesn't alreay exist.)

    Read the article

  • PHP rewrite an included file - is this a valid script?

    - by Poni
    Hi all! I've made this question: http://stackoverflow.com/questions/2921469/php-mutual-exclusion-mutex As said there, I want several sources to send their stats once in a while, and these stats will be showed at the website's main page. My problem is that I want this to be done in an atomic manner, so no update of the stats will overlap another one running in the background. Now, I came up with this solution and I want you PHP experts to judge it. stats.php <?php define("my_counter", 12); ?> index.php <?php include "stats.php"; echo constant("my_counter"); ?> update.php <?php $old_error_reporting = error_reporting(0); include "stats.php"; define("my_stats_template",' <?php define("my_counter", %d); ?> '); $fd = fopen("stats.php", "w+"); if($fd) { if (flock($fd, LOCK_EX)) { $my_counter = 0; try { $my_counter = constant("my_counter"); } catch(Exception $e) { } $my_counter++; $new_stats = sprintf(constant("my_stats_template"), $my_counter); echo "Counter should stand at $my_counter"; fwrite($fd, $new_stats); } flock($fd, LOCK_UN); fclose($fd); } error_reporting($old_error_reporting); ?> Several clients will call the "update.php" file once every 60sec each. The "index.php" is going to use the "stats.php" file all the time as you can see. What's your opinion?

    Read the article

  • Can't call an object method. PHP reports variable undefined

    - by user1285697
    This is the weirdest bug! It is probably something silly, but I have no idea how to fix it. If anyone could help, I would be most grateful! I have three files, one is called items.php, another is called tableFunctions.php, and the third is called mysql.php. I use two global objects called 'mysql' and 'tableFunctions'. They are stored in the files 'mysql.php', and 'tableFunctions.php', respectively. In each file, I create an instance of its object, assigning it to the global variable $_mysql, or $_table. like this: In the file mysql.php: global $_mysql; $_mysql = new mysql(); In the file tableFunctions.php: global $_table; $_table = new tableFunctions(); Here's how it is supposed to work: The items.php file includes the tableFunctions.php file... Which in turn, needs the mysql.php file, so it includes it too. In the items.php file, I call the method getTable(), which is contained in the object tableFunctions.(and in the variable $_table.) Like this: $t = $_table->getTable('items'); The getTable function calls the method, arrayFromResult(), which is contained within in the object mysql.(and in the variable $_mysql.) Like this: $result = $_mysql->arrayFromResult($r); That's where I get the error. PHP says that the variable '$_mysql' is undefined, but I defined it in the 'mysql.php' file.(see above) I also included mysql.php with the following code: include_once 'mysql.php'; I have no idea what is wrong! If anyone can help that would be much appreciated. The source files can be downloaded with the following link: https://www.dropbox.com/sh/bjj2gyjsybym89r/YLxqyNvQdn

    Read the article

  • Why doesn't this require_once statement find the file? (PHP)

    - by ggfan
    I not sure what's going on..maybe I missed something simple. In my connectvars.php file, I connect to the database using the variables in my config.php folder. Here's the hierarchy: admin(folder) config.php includes(folder) connectvars.php I want to get information from config.php to use in connectvars.php, so I use: require_once("../admin/config.php"); But everytime I do this I get Warning: require_once(../admin/config.php) [function.require-once]: failed to open stream: No such file or directory in /home/a8879415/public_html/includes/connectvars.php on line 2 BUT when I type: require_once("admin/config.php");, it works. I thought I had to go up a level, then go down to admin, then get config.php. So how come I just need to go into the admin folder then get config.php?

    Read the article

  • PHP+Apache as forward/reverse proxy: ¿how to process client requests and server responses in PHP?

    - by Lightworker
    Hi! I'm having a lot of troubles with the propper configuration of Apache mod_proxy.so to work as desired... The main idea, is to create a proxy on a local machine in a network wich will have the ability to proces a client request (client connected through this Apache prepared proxy) in PHP. And also, it will have the capacity to process the server responses on PHP too. Those are the 2 funcionalities, and they are independent one from each other. Let me present a little schema of what I need to achive: As you can see here, there're 2 ways: blue one and red one. For the blue one, I basically conected a client (Machine B - cell phone) on my local network (home) and configured it to go thorugh a proxy, wich is the Machine A (personal computer) on the exactly same network. So let's say (not DHCP): Machine A: 192.168.1.40 -- Apache is running on this machine, and configured to listen port 80. Machine B (cell phone): 192.168.1.75 -- configured to go throug a proxy, wich is IP 192.168.1.75 and port 80 (basically, Machine A). After configuring Apache properly, wich is basically to remove the "#" from httpd.conf on the lines for the mod_proxy.so (main worker), mod_proxy_connect.so (SSL, allowCONNECT, ...) and mod_proxy_http.so (needed for handle HTTP request/responses) and having in my case, lines like this: # Implements a proxy/gateway for Apache. Include "conf/extra/httpd-proxy.conf" # Various default settings Include "conf/extra/httpd-default.conf" # Secure (SSL/TLS) connections Include "conf/extra/httpd-ssl.conf" wich gives me the ability to configure the file httpd-proxy.conf to prepare the forward proxy or the reverse proxy. So I'm not sure, if what I need it's a forward proxy or a reverse one. For a forward proxy I've done this: <IfModule proxy_module> <IfModule proxy_http_module> # # FORWARD Proxy # #ProxyRequests Off ProxyRequests On ProxyVia On <Proxy *> Order deny,allow # Allow from all Deny from all Allow from 192.168.1 </Proxy> </IfModule> </IfModule> wich basically passes all the packets normally to the server and back to the client. I can trace it perfectly (and testing that works) looking at the "access.log" from Apache. Any request I make with the cell phone, appears then on the Apache log. So it works. But here come the problem: I need to process those client requests. And I need to do it, in PHP. I have read a lot about this. I've read in detail the oficial site from Apache about mod_proxy. And I've searched a lot on forums, but without luck. So I thought about a first aproximation: 1) Forward proxy in Apache, passes all the packets and it's not possible to process them. This seems to be true, so, what about a reverse proxy? So I envisioned something like: ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass http://www.google.com http://www.yahoo.com ProxyPassReverse http://www.google.com http://www.yahoo.com which is just a test, but this should cause on my cell phone that when trying to navigate to Google, I should be going to Yahoo, isn't it? But not. It doesn't work. So you really see, that ALL the examples on Apache reverse proxy, goes like: ProxyPass /foo http://foo.example.com/bar ProxyPassReverse /foo http://foo.example.com/bar wich means, that any kind of request in a local context, will be solved on a remote location. But what I needed is the inverse! It's that when asking for a remote site on my phone, I solve this request on my local server (the Apache one) to process it with a PHP module. So, if it's a forward proxy, I need to pass through PHP first. If it's a reverse proxy, I need to change the "going" direction to my local server one to process first on PHP. Then comes in mind second option: 2) I've seen something like: <Proxy http://example.com/foo/*> SetOutputFilter INCLUDES </Proxy> And I started to search for SetOutputFilter, SetInputFilter, AddOutputFilter and AddInputFilter. But I don't really know how can I use it. Seems to be good, or a solution to me, cause with somethin' like this, I should can add an Input filter to process on PHP the client requests and send back to the client what I programed/want (not the remote server response) wich is the BLUE path on schema, and I should have the ability to add an Output filter wich seems to give me the ability to process the remote server response befor sending it to the client, wich should be the RED path on the schema. Red path, it's just to read server responses and play with em. But nothing more. The Blue path, it's the important one. Cause I will send to the client whatever I want after procesing the requests. I so sorry for this amazingly big post, but I needed to explain it as well as I can. I hope someone will understand my problem, and will help me to solve it! Lot of thanks in advance!! :)

    Read the article

  • Problem making system calls with PHP scripts

    - by mazin k.
    I have the following PHP script: <?php $fortune = `fortune`; echo $fortune; ?> but the output is simply blank (no visible errors thrown). However, if I run php -a, it works: php > echo `fortune`; Be careful of reading health books, you might die of a misprint. -- Mark Twain php > Am I missing a config directive or something that would cause this? Edit: So, I tried running my script using $ php-cgi fortunetest.php and it worked as expected. Maybe the issue is with Apache2?

    Read the article

  • php doctrine last identifier issue

    - by mike
    I'm running in to the issue below when trying to run the following: $store = new Store(); $store->url =$this->form_validation->set_value('website'); $store->save(); $store_id = $store->identifier(); Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'Couldn't get last insert identifier.' in /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php:932 Stack trace: #0 /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php(632): Doctrine_Connection_UnitOfWork->_assignIdentifier(Object(Category_store_assn)) #1 /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php(562): Doctrine_Connection_UnitOfWork->processSingleInsert(Object(Category_store_assn)) #2 /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php(81): Doctrine_Connection_UnitOfWork->insert(Object(Category_store_assn)) #3 /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Record.php(1691): Doctrine_Connection_UnitOfWork->saveGraph(Object(Category_store_assn)) #4 /home/yummm/public_html/system/application/controllers/auth.php(375): Doctrine_Reco in /home/yummm/public_html/system/application/plugins/doctrine/lib/Doctrine/Connection/UnitOfWork.php on line 932 When I echo $store_id, it seems to be grabbing the last id without any issues. Any idea why this error keeps coming up even though the ID is passing correctly?

    Read the article

  • Error installing php extension OAuth via pecl

    - by hookedonwinter
    I'm trying to install the php extension OAuth in my local environment. php.net suggests it's super easy. You just run pecl install oauth. I tried this, and here is the output in terminal: downloading oauth-1.0.0.tgz ... Starting to download oauth-1.0.0.tgz (42,834 bytes) ............done: 42,834 bytes 6 source files, building running: phpize grep: /usr/include/php/main/php.h: No such file or directory grep: /usr/include/php/Zend/zend_modules.h: No such file or directory grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory Configuring for: PHP Api Version: Zend Module Api No: Zend Extension Api No: Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. ERROR: `phpize' failed Any tips on how to fix the errors and install OAuth succesfully? Thanks!

    Read the article

  • Problem with running php script using mysql on tomcat

    - by Jack
    I am using tomcat 6 with JavaBridge. I have stored my php script in the following location. C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\project\test.php In test.php I am using curl and mysql. The php.ini in JavaBridge is stored in the following location C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\cgi\php.ini and its contents are - extension_dir="C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\cgi\x86-windows\ext" include_path="C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\pear;." there is also a config file called mysql.ini whose contents are - extension = php_mysql.dll I had also installed wamp earlier so I copied all the dll's from C:\wamp\bin\php\php5.3.0\ext to C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\WEB-INF\cgi\x86-windows\ext When I start tomcat and run my script I get the following error - Fatal error: Call to undefined function mysqli_connect() in C:\Program Files\apache-tomcat-6.0.26\webapps\JavaBridge\project\test.php on line 534 Please help.

    Read the article

  • How to simplify this php switch statement?

    - by janoChen
    I would like to change this: // use appropiate lang.xx.php file according to the value of the $lang switch ($_SESSION['lang']) { case 'en': $lang_file = 'lang.en.php'; break; case 'es': $lang_file = 'lang.es.php'; break; case 'zh-tw': $lang_file = 'lang.zh-tw.php'; break; case 'zh-cn': $lang_file = 'lang.zh-cn.php'; break; default: $lang_file = 'lang.en.php'; } into something like this: //include file for final output include_once 'languages/lang.'.$_SESSION['lang'].'php; So that I can skip the whole switch part. I tried other combinations but they don't seem to work. Any suggestions?

    Read the article

  • [wordpress] Loop through a specific category on single.php

    - by petrescu
    I've created a custom page and it is set as my homepage, within this custom page I am pulling out the latest post from a specific category, I've also created a form of pagination which when clicked upon will take the user to single.php. My intention for the single.php is to have two custom loops. Custom loop one I want single.php to distinguish that it has came from the homepage and loop through all of the posts tagged with the same category as the one on the homepage. Some of these posts will have to be tagged with more than one category, so the loop will have to know to ignore the other categories and just pay attention to the category in question. Does that make sense? Custom loop two If the user hasn't arrived from the homepage, single.php will just act as it normally does i.e, if the user comes from index.php (the blog) they will be taken to this second loop (blog post) However I don't seem to be able to make the distinction between the two loops, I might be over complicating matters, as I've got a loop which wraps everything together and then I have a loop for my custom pagination. Here is the code below to show you what I'm talking about custompage.php (set to home) - This works just fine but I'll post it just incase anyone is able to tidy it up <?php query_posts('cat=1'); ?> <?php $myPosts = new WP_Query(); $myPosts->query('showposts=1'); if (have_posts()) : while ($myPosts->have_posts()) : $myPosts->the_post(); ?> <script type="text/javascript">$.backstretch("<?php $key="image"; echo get_post_meta($post->ID, $key, true);?>");</script> <div id="post-<?php the_ID(); ?>" class="info"> <h2><?php the_title(); ?></h2> <ul class="nav"> <?php query_posts('posts_per_page=1&offset=1'); the_post(); ?> <li class="prev"><a href="<?php the_permalink() ?>">Previous</a></li> <?php wp_reset_query(); ?> <li class="next"></li> </ul> </div> <!-- end .info --> <?php endwhile; endif; ?> <?php wp_reset_query(); ?> single.php - Currently broken <?php if( in_category('1') ) { ?> <!-- start --> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div id="post-<?php the_ID(); ?>" class="info"> <script type="text/javascript">$.backstretch("<?php $key="image"; echo get_post_meta($post->ID, $key, true);?>");</script> <h2><?php the_title(); ?></h2> <ul class="nav"> <li class="prev"><?php previous_post_link('%link', '&nbsp;', 'true', '1') ?></li> <li class="next"><?php next_post_link('%link', '&nbsp;', 'true', '1'); ?></li> <!--li class="prev"><?php //previous_post_link('%link', '%title;', 'true', '1') ?></li> <li class="next"><?php //next_post_link('%link', '%title;', 'true', '1'); ?></li--> </ul> </div> <!-- end .info --> <?php endwhile; else: ?> <?php endif; ?> <!-- end --> <?php }else{ ?> <div id="content" class="widecolumn" role="main"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h2><?php the_title(); ?></h2> <div class="entry"> <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?> </div> </div> <?php comments_template(); ?> <?php endwhile; else: ?> <p>Sorry, no posts matched your criteria.</p> <?php endif; ?> </div> <?php } ?> The problem I seem to be running into is when a post has been tagged with two categories, wordpress doesn't seem to be able to make the distinction between the two categories and instead of carrying on to the next category it breaks and defaults to the second loop.

    Read the article

  • Enabling PostgreSQL support in PHP on Mac OS X

    - by Jordan Scales
    I'm having a terribly difficult time getting the command "pg_connect()" to work properly on my Mac. I'm currently writing a PHP script (to be executed from console) to read a PostgreSQL database and email a report. I've gone into my php.ini file and added extension=pgsql.so But, I'm met with the following error. PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_pgsql.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_pgsql.so, 9): image not found in Unknown on line 0 PHP Fatal error: Call to undefined function pg_connect() in... (blah file here) When running phpinfo(), I see nothing about PostgreSQL, so what is my issue here?

    Read the article

  • A couple PHP/MySQL questions...

    - by Jeff
    I am a college student taking a course in php and mysql progamming and my first question is about the "$variable" variables in the following code: <?php ob_start(); ?> <?php session_start(); if ($_SESSION['auth'] != "true") { header("Location: login.php"); exit; } $uid = $_SESSION['user']; $connection = mysql_connect("localhost", "username", "password"); mysql_select_db("username", $connection); $result = mysql_query ( "SELECT * FROM users where user_id = '$uid'", $connection); $num = mysql_numrows($result); $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"firstname"); $f2=mysql_result($result,$i,"lastname"); ?> <html><body> <p> <td><center><font size = "18" face="Arial"><?php echo "Name: $f1 "; echo $f2; ?> </font></center></td> </p> </body></html> <?php $i++; } ?> <?php $result1 = mysql_query ( "SELECT * FROM phone where user_id = '$uid'", $connection); $num1 = mysql_numrows($result1); $j=0; while ($j < $num1) { $f3=mysql_result($result1,$j,"type"); $f4=mysql_result($result1,$j,"number"); ?> <html><body> <p> <br> <td><center><font size = "12" face="Arial"><?php echo "$f5: "; echo "($f3) "; echo "$f4 <br />"; ?> </font></center></td> </p> </body></html> <?php $j++; } ?> <?php $result2 = mysql_query ( "SELECT * FROM address where user_id = '$uid'", $connection); $num2 = mysql_numrows($result2); $h=0; while ($h < $num2) { $f6=mysql_result($result2,$h,"type"); $f7=mysql_result($result2,$h,"address"); $f8=mysql_result($result2,$h,"city"); $f9=mysql_result($result2,$h,"state"); $f10=mysql_result($result2,$h,"zip"); ?> <html><body> <p> <br> <td><center><font size = "12" face="Arial"><?php echo "$f10 Address: $f6, $f7, $f8 $f9"; ?></font></center></td> </p> </body></html> <?php $h++; } ?> <?php include 'navbar.php'; ob_end_flush(); ?> I just don't really understand the $variables at all. Are they user-generated or are they entities in the database? And how does the code know which $result is which? My second question is that, if this was someone else in my class's code and I wanted to modify it to make it my own and substitute my own variables, how would I go about doing that? Do the $variables need to be changed if they are not user-defined and if so, how? I apologize if these are dumb questions, but I am a beginner at this programming language. Thanks in advance for your help. -Jeff

    Read the article

  • BASH Install Of Wordpress, Without Visiting wp-admin/install.php

    - by user916825
    I wrote this little BASH script that creates a folder,unzips Wordpress and creates a database for a site. The final step is actually installing Wordpress, which usually involves pointing your browser to install.php and filling out a form in the GUI. I want to do this from the BASH shell, but can't figure out how to invoke wp_install() and pass it the parameters it needs: -admin_email -admin_password -weblog_title -user_name (line 85 in install.php) Here's a similar question, but in python #!/bin/bash #ask for the site name echo "Site Name:" read name # make site directory under splogs mkdir /var/www/splogs/$name dirname="/var/www/splogs/$name" #import wordpress from dropbox cp -r ~/Dropbox/Web/Resources/Wordpress/Core $dirname cd $dirname #unwrap the double wrap mv Core/* ./ rm -r Core mv wp-config-sample.php wp-config.php sed -i 's/database_name_here/'$name'/g' ./wp-config.php sed -i 's/username_here/root/g' ./wp-config.php sed -i 's/password_here/mypassword/g' ./wp-config.php cp -r ~/Dropbox/Web/Resources/Wordpress/Themes/responsive $dirname/wp-content/t$ cd $dirname CMD="create database $name" mysql -uroot -pmypass -e "$CMD" How do I alter the script to automatically run the installer without the need to open a browser?

    Read the article

  • How can I extend PHP DOMElement?

    - by Michael Tsang
    a.php #!/usr/bin/php <?php class HtmlTable extends DOMElement { public function __construct($height, $width) { parent::__construct("table"); for ($i = 0; $i < $height; ++$i) { $row = $this->appendChild(new DOMElement("tr")); for($j = 0; $j < $width; ++$j) { $row->appendChild(new DOMElement("td")); } } } } $document = new DOMDocument("1.0", "UTF-8"); $document->registerNodeClass("DOMElement", "HtmlTable"); $document->appendChild(new HtmlTable(3, 2)); $document->saveXML(); Running it gets Fatal error: Uncaught exception 'DOMException' with message 'No Modification Allowed Error' in /home/www/a.php:9 Stack trace: #0 /home/www/a.php(9): DOMNode->appendChild(Object(DOMElement)) #1 /home/www/a.php(19): HtmlTable->__construct(3, 2) #2 {main} thrown in /home/www/a.php on line 9

    Read the article

  • PHP won't parse MySQL statements

    - by Hussain
    I just installed Apache 2.2.15/PHP 5.3.2/MySQL 5.1.44 on Windows Vista. Apache is working fine, PHP is functional, and MySQL works on the CLI. However, when I try to access MySQL via PHP, I get an error (Fatal error: Call to undefined function mysql_connect()). extension=php_mysql.dll and extension=php_mbstring.dll are uncommented in the php.ini file, and PHP is in the system path. There is no libmysql.dll in either the top level PHP directory or the ext directory. There's a libmySQL.dll file in the MySQL bin directory (which is also in the system path); I tried renaming it, but that doesn't do anything Also, in case anyone wants to know, I originally installed PHP using the MSI installer, but it was missing some DLLs, so I installed from the zip file. I think I've exhausted all my options. Any help on this problem would be very appreciated. Thanks in advance.

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >