Search Results

Search found 316 results on 13 pages for 'mysqli'.

Page 9/13 | < Previous Page | 5 6 7 8 9 10 11 12 13  | Next Page >

  • Set default MySQL connect charset for PHP (in RHEL)?

    - by Martijn Heemels
    We're running a hundred or so legacy PHP websites on an older server which runs Gentoo Linux. When these sites were built latin1 was still the common charset, both in PHP and MySQL. To make sure those older sites used latin1 by default, while still allowing newer sites to use utf8 (our current standard), we set the default connect charset in php.ini: mysql.connect_charset = latin1 mysqli.connect_charset = latin1 pdo_mysql.connect_charset = latin1 Specific more modern sites could override this in their bootstrapping code with: <?php mysql_set_charset("utf8", $dsn ); ...and all was well. Now the server is overloaded and we're no longer with that hoster, so we're moving all these sites to a faster server at our standard hoster, which uses RHEL 5 as their OS of choice. In setting up this new server I discover to my surprise that the *.connect_charset directives are a Gentoo specific patch to PHP, and RHEL's version of PHP doesn't recognize them! Now how do I set PHP to connect to MySQL with the latin1 charset? I thought about setting a default in my.cnf but would prefer not to force every app and client to default to latin1. Our policy is to use utf8, and we'd like to restrict the exception to PHP only. Also, converting every legacy site to properly use utf8 is not doable since many are of the touch 'm and you break 'm kind. We simply don't have the time to go fix them all. How would I set a default mysql/mysqli/pdo_mysql connection charset to latin1 for PHP, while still allowing individual scripts to override this to utf8 with mysql_set_charset()?

    Read the article

  • Does the mysql Client API Library version have to match the installed MySQL/Percona server version?

    - by William Jamieson
    I'm running Scientific Linux 6.3 (binary compaible with Redhat/CentOS/etc..) as a LAMP stack. I've installed Percona server and client v5.5 from the Percona yum repository. However when I run phpinfo() I notice that under the MySQL and mysqli sections, it lists the Client API Library version as 5.1.66, and not 5.5x. I'm guessing these need to match, at least to major versions, and I have no idea what the possible consequences of such a mismatch could be. Do I need to revert to Percona server and client v5.1? This is for a production environment so it needs to be right. I'd appreciate any input or experience people could offer. I'm running Scientific Linux 6.3 (binary compaible with Redhat/CentOS/etc..) as a LAMP stack. I've installed Percona server and client v5.5 from the Percona yum repository. However when I run phpinfo() I notice that under the MySQL and mysqli sections, it lists the Client API Library version as 5.1.66, and not 5.5x. I'm guessing these need to match, at least to major versions, and I have no idea what the possible consequences of such a mismatch could be. Do I need to revert to Percona server and client v5.1? This is for a production environment so it needs to be right. I'd appreciate any input or experience people could offer. (Note I will also be cross posting this on the Percona forums)

    Read the article

  • "unrecognized options" while installing php

    - by user1692333
    I want to compile php 5.4.8 on my mac 10.8.2, but get some errors which cant solve by my self, so need your help. Firstly i get default php options with php -i | head, after it do this command ./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --sysconfdir=/private/etc --with-apxs2=/usr/sbin/apxs --enable-cli --with-config-file-path=/etc --with-libxml-dir=/usr --with-openssl=/usr --with-kerberos=/usr --with-zlib=/usr --enable-bcmath --with-bz2=/usr --enable-calendar --disable-cgi --with-curl=/usr --enable-dba --enable-ndbm=/usr --enable-exif --enable-fpm --enable-ftp --with-gd --with-freetype-dir=/BinaryCache/apache_mod_php/apache_mod_php-79~4/Root/usr/local --with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-79~4/Root/usr/local --with-png-dir=/BinaryCache/apache_mod_php/apache_mod_php-79~4/Root/usr/local --enable-gd-native-ttf --with-icu-dir=/usr --with-iodbc=/usr --with-ldap=/usr --with-ldap-sasl=/usr --with-libedit=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-mysqli=mysqlnd --without-pear --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock --with-readline=/usr --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets --enable-sqlite-utf8 --enable-suhosin --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --enable-wddx --with-xmlrpc --with-iconv-dir=/usr --with-xsl=/usr --enable-zend-multibyte --enable-zip --with-pcre-regex --with-pgsql=/usr --with-pdo-pgsql=/usr But get this error config.status: creating Makefile config.status: creating jconfig.h config.status: jconfig.h is unchanged config.status: executing depfiles commands config.status: executing libtool commands configure: WARNING: unrecognized options: --enable-cli, --with-config-file-path, --with-libxml-dir, --with-openssl, --with-kerberos, --with-zlib, --enable-bcmath, --with-bz2, --enable-calendar, --disable-cgi, --with-curl, --enable-dba, --enable-ndbm, --enable-exif, --enable-fpm, --enable-ftp, --with-gd, --with-freetype-dir, --with-jpeg-dir, --with-png-dir, --enable-gd-native-ttf, --with-icu-dir, --with-iodbc, --with-ldap, --with-ldap-sasl, --with-libedit, --enable-mbstring, --enable-mbregex, --with-mysql, --with-mysqli, --without-pear, --with-pdo-mysql, --with-mysql-sock, --with-readline, --enable-shmop, --with-snmp, --enable-soap, --enable-sockets, --enable-sqlite-utf8, --enable-suhosin, --enable-sysvmsg, --enable-sysvsem, --enable-sysvshm, --with-tidy, --enable-wddx, --with-xmlrpc, --with-iconv-dir, --with-xsl, --enable-zend-multibyte, --enable-zip, --with-pcre-regex, --with-pgsql, --with-pdo-pgsql Maybe someone have some suggestions on this?

    Read the article

  • Flex : providing data with a PHP Class

    - by Tristan
    Hello, i'm a very new user to flex (never use flex, nor flashbuilder, nor action script before), but i want to learn this langage because of the beautiful RIA and chart it can do. I watched the video on adobe : 1 hour to build your first program but i'm stuck : On the video it says that we have to provide a PHP class for accessing data and i used the example that flash builder gave (with zend framework and mysqli). I never used those ones and it makes a lot to learn if i count zen + mysqli. My question is : can i use a PHP class like this one ? What does flash builder except in return ? i hear that was automatic. example it may be wrong, i'm not very familiar with classes when acessing to database : <?php class DBConnection { protected $server = "localhost"; protected $username = "root"; protected $password = "root"; protected $dbname = "something"; protected $connection; function __construct() { $this->connection = mysql_connect($this->server, $this->username, $this->password); mysql_select_db($this->dbname,$this->connection); mysql_query("SET NAMES 'utf8'", $this->connection); } function query($query) { $result = mysql_query($query, $this->connection); if (!$result) { echo 'request error ' . mysql_error($this->connection); exit; } return $result; } function getAll() { $req = "select * from servers"; $result = query($req) return $result } function num_rows() { return mysql_num_rows($result); } function end() { mysql_close($this->connection); } } ?> Thank you,

    Read the article

  • PHP and MySQL validating problem

    - by IPADvsSLATE
    I'm trying to check if a color is already entered into the database if it is the color should not be entered and stored into the database and the following error code <p>This color has already been entered!</p> should be displayed. But for some reason I cant get this to work, can someone please help me? The color names are entered into $_POST['color'] which is an array entered by the user. Here is the html code that collects the colors. <input type="text" name="color[]" /> <input type="text" name="color[]" /> <input type="text" name="color[]" /> <input type="text" name="color[]" /> <input type="text" name="color[]" /> <input type="text" name="color[]" /> <input type="text" name="color[]" /> <input type="text" name="color[]" /> <input type="text" name="color[]" /> Here is the PHP & MySQL code. for($i=0; $i < count($_POST['color']); $i++) { $color = "'" . $_POST['color'][$i] . "'"; } $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli,"SELECT * FROM colors WHERE color = '$color' AND user = '$user_id' "); if(mysqli_num_rows($dbc) == TRUE) { echo '<p>This color has already been entered!</p>'; } else if(mysqli_num_rows($dbc) == 0) { // enter the color into the database }

    Read the article

  • Logging in with sha1() encryption.

    - by Samir Ghobril
    Hey guys, I added this to my sign up code : $password=mysql_real_escape_string(sha1($_POST['password'])); and now it inserts the password into the database while its encrypted. But signing in doesn't seem to work anymore. Here is the login code. function checklogin($username, $password){ global $mysqli; $password=sha1($password); $result = $mysqli->prepare("SELECT * FROM users WHERE username = ? and password=?"); $result->bind_param("ss", $username, $password); $result->execute(); if($result != false){ $dbArray=$result->fetch(); if(!$dbArray){ echo '<p class="statusmsg">The username or password you entered is incorrect, or you haven\'t yet activated your account. Please try again.</p><br/><input class="submitButton" type="button" value="Retry" onClick="location.href='."'login.php'\">"; return; } $_SESSION['username']=$username; if(isset($_POST['remember'])){ setcookie("jmuser",$username,time()+60*60*24*356); setcookie("jmpass",$password ,time()+60*60*24*356); } redirect(); }

    Read the article

  • PHP & MySQL delete image link problem

    - by IMAGE
    I'm trying to create a delete image link if the image is present and when the user clicks the delete image link it should delete the image. But for some reason this is not working can someone help me fix the delete image link problem? Thanks! Here is the PHP code. if (isset($_POST['delete_image'])) { $img_dir = "../members/" . $user_id . "/images/thumbs/"; $img_thmb = "../members/" . $user_id . "/images/"; $image_name = $row['image']; if(file_exists($img_dir . $image_name)){ if(unlink($img_dir.$image_name) && unlink($img_thmb.$image_name)){ $mysqli = mysqli_connect("localhost", "root", "", "sitename"); $dbc = mysqli_query($mysqli, "DELETE FROM users* WHERE image_id = '.$image_id.' AND user_id = '$user_id'"); }else{ echo '<p class="error">Sorry unable to delete image file!</p>'; } } } if(isset($_POST['image']) || !empty($image)) { echo '<a href="'. $_POST['delete_image'] .'">Delete Image</a>'; }

    Read the article

  • After compiling PHP, I get mod_fcgid: error reading data from FastCGI server

    - by user34295
    I'm trying to add multiple PHP version in Plesk 12. Switching my domain to the new version PHP 5.4.29 result in this error: (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server Here is phpinfo() of the complied PHP version, obtained running php54-cgi index.php from the terminal. The same script placed under document root doesn't work in FastCGI. How can I debug/try to figure out what's the error? Currently running CentOS 6.5 x64, Plesk v12.0.18_build1200140529.2, PHP 5.5.13. I've downloaded PHP 5.4.29: cd /usr/local/src curl -O http://it1.php.net/distributions/php-5.4.29.tar.gz cd php-5.4.29 And configured with: ./configure \ --prefix=/usr/local/php54 \ --with-bz2 \ --with-config-file-path=/usr/local/php54/etc \ --with-config-file-scan-dir=/usr/local/php54/etc/php.d \ --with-curl \ --with-gd \ --with-gettext \ --with-iconv \ --with-layout=PHP \ --with-libxml-dir=/usr/local/php54 \ --with-mhash \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-openssl \ --with-pdo-mysql=mysqlnd \ --with-readline \ --with-xsl \ --with-zlib \ --enable-calendar \ --enable-cgi \ --enable-exif \ --enable-ftp \ --enable-intl \ --enable-mbstring \ --enable-pcntl \ --enable-shmop \ --enable-sockets \ --enable-sockets \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-wddx \ --enable-zip Then: make && make install Installing PHP CLI binary: /usr/local/php54/bin/ Installing PHP CLI man page: /usr/local/php54/php/man/man1/ Installing PHP CGI binary: /usr/local/php54/bin/ Installing PHP CGI man page: /usr/local/php54/php/man/man1/ Installing build environment: /usr/local/php54/lib/php/build/ Installing header files: /usr/local/php54/include/php/ Installing helper programs: /usr/local/php54/bin/ program: phpize program: php-config Installing man pages: /usr/local/php54/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php54/lib/php/ [PEAR] Archive_Tar - installed: 1.3.11 [PEAR] Console_Getopt - installed: 1.3.1 warning: pear/PEAR requires package "pear/Structures_Graph" (recommended version 1.0.4) warning: pear/PEAR requires package "pear/XML_Util" (recommended version 1.2.1) [PEAR] PEAR - installed: 1.9.4 Wrote PEAR system config file at: /usr/local/php54/etc/pear.conf You may want to add: /usr/local/php54/lib/php to your php.ini include_path [PEAR] Structures_Graph- installed: 1.0.4 [PEAR] XML_Util - installed: 1.2.1 /usr/local/src/php-5.4.29/build/shtool install -c ext/phar/phar.phar /usr/local/php54/bin ln -s -f /usr/local/php54/bin/phar.phar /usr/local/php54/bin/phar Installing PDO headers: /usr/local/php54/include/php/ext/pdo/ Copied php.ini-production to /usr/local/php54/etc/php.ini and added a new handler in Plesk: /usr/local/psa/bin/php_handler --add -displayname 5.4.29 -path /usr/local/php54/bin/php-cgi -phpini /usr/local/php54/etc/php.ini -type fastcgi -id php54 Symbolic linking: ln -s /usr/local/php54/bin/php /usr/local/bin/php54 ln -s /usr/local/php54/bin/php-cgi /usr/local/bin/php54-cgi New installed version: php54-cgi -m [PHP Modules] bz2 calendar cgi-fcgi Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext hash iconv intl json libxml mbstring mhash mysql mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar posix readline Reflection session shmop SimpleXML sockets SPL sqlite3 standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter xsl zip zlib [Zend Modules]

    Read the article

  • I recompiled dozens of times, why is my OpenSSL Library and Header still not the same?

    - by Doug
    openssl OpenSSL support enabled OpenSSL Library Version OpenSSL 0.9.8o 01 Jun 2010 OpenSSL Header Version OpenSSL 1.0.1 14 Mar 2012 From PHP (5.4.4) info, this is the problem I have. I am dry out of ideas, and I cannot understand why it ins't working. This was my configure: ./configure '--with-apxs2=/etc/apache24/bin/apxs' '--with-mysql' '--prefix=/etc/apache24/php' '--with-config-file-path=/etc/apache24/php' '--enable-force-cgi-redirect' '--disable-cgi' '--with-zlib' '--with-gettext' '--with-curl' '--with-mcrypt' '--with-gd' '--with-pdo' '--with-pdo-mysql' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-libdir=lib32' '--with-openssl=shared,/usr' '--with-mysqli'

    Read the article

  • Building a database class in PHP

    - by Sprottenwels
    I wonder if I should write a database class for my application, and if so, how to accomplish it? Over there on SO, a guy mentioned it should be written as an abstract class. However, I can't understand why this would be a benefit. Do I understand correctly, that if I would write an abstract class, every other class that methods will need a database connection, could simply extend this abstract class and have it's own database object? If so, how is this different from a "normal" class where I could instantiate an database object? Another method would be to completely forget about my own class and to instantiate a mysqli object on demand. What do you recommend?

    Read the article

  • No databases showing in phpMyAdmin

    - by Thein Hla Maw
    My website is hosted in shared hosting service and is working fine with updated news stored in MySQL database. To manage the database of website, I install phpMyAdmin in a sub-folder with the same username and password used in website. When I login to phpMyAdmin, I don't see my database. phpMyAdmin is showing "No databases" in left pane. Is there any thing I need to configure in phpMyAdmin? Edited: This is the settings in config.inc.php. I can login to phpMyAdmin successfully. $cfg['Servers'][$i]['host'] = 'hostname'; $cfg['Servers'][$i]['port'] = ''; $cfg['Servers'][$i]['socket'] = ''; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['extension'] = 'mysqli'; $cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['user'] = 'dbuser'; $cfg['Servers'][$i]['password'] = 'password';

    Read the article

  • What php programmer should know?

    - by emchinee
    I've dig the database here and didn't found any answer for my question. What is a standard for a php programmer to know? I mean, literally, what group of language functions, mechanisms, variables should person know to consider oneself a (good) php programmer? (I know 'being good' is beyond language syntax, still I'm considering syntax of plain php only) To give an example what I mean: functions to control http sessions, cookies functions to control connection with databases functions to control file handling functions to control xml etc.. I omit phrases like 'security' or 'patterns' or 'framework' intentionally as it applies to every programming language. Hope I made myself clear, any input appreciated :) Note: Michael J.V. is right claiming that databases are independent from language, so to put my question more precisely and emphasise differences: Practises or security, are some ideas to implement (there is no 'Pattern' object with 'Decorator()' method, is there?) while using databases means knowing a mysqli and a set of its methods.

    Read the article

  • When do I bite the bullet and hire a developer? [closed]

    - by Paul Seattle
    I have an awesome URL, I've had it since the mid 90's, and up until around 2002 I was having an awesome time writing music reviews and features into static pages and adding their URL to static index pages and everything was just great. Then things got complicated really fast, and for one reason or another I handed the site over to a very talented friend who turned it into a db based site run by cf. Now, here I am around twelve years later putting it all back together using mysql, php and css on a need-to-learn basis and even though I'm sooo close to where I want it to be I realize, erm, it should have been written using mysqli etc etc ad infinitum. So I'm wondering at what point do I just give in and hire a developer to take over, how much does it even cost, and how do I know I'm working with someone who is better than I am?

    Read the article

  • stored procedure in MYsql access in PHP

    - by xcodemaddy
    Hi.. I am creating stored procedure ,here code : CREATE PROCEDURE `dbnm`.`getlogin` ( IN uid INT, IN upass VARCHAR(45) ) BEGIN if exists(select uphno,pass from user_master where uphno=uid and pass=upass)then ***true else ***false end if; END $$ DELIMITER ; i want return value(**true or **false) in stored procedure from PHP by calling sp PHP code: $res = $mysqli->query('call getlogin("1","rashmi")'); how to acesss boolean value in PHP from sp? Thanks

    Read the article

  • PHP email validation question?

    - by GeNx
    Will this email validation allow foreign email address like russian, hebrew and so on? And how can I just check for the @ sign? Here is the php code. if (preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $_POST['email'])) { $email = mysqli_real_escape_string($mysqli, strip_tags($_POST['email'])); } else { echo '<p class="error">Please enter a valid email address!</p>'; }

    Read the article

  • Should you do validation checks that go outside the possiblility of normal user activity?

    - by Scarface
    Hey guys I have been thinking about form security a lot lately. I have been told time and time again to check if form input is a number if you are expecting a number or escape it in case (unless you use proper mysqli formatting) to avoid injection. 1.After the safety checks are done, should I do additional logic checks? For example, if the user is sending a friend request to them-self for example even if my user interface will not show the form if the user is looking at their own page.

    Read the article

  • zend framework 2 autentification using DbTable failure

    - by josepmra
    I have followed the zend instructions for implement my web Authentication using a database table. It's exactly the same code, but when render the page, the following exceptions appears: Zend\Authentication\Adapter\Exception\RuntimeException File: C:\xampp\htdocs\pfc\vendor\ZF2\library\Zend\Authentication\Adapter\DbTable.php Mensaje: The supplied parameters to DbTable failed to produce a valid sql statement, please check table and column names for validity. produced by this other: Zend\Db\Adapter\Exception\InvalidQueryException File: C:\xampp\htdocs\pfc\vendor\ZF2\library\Zend\Db\Adapter\Driver\Mysqli\Statement.php Mensaje: Statement couldn't be produced with sql: SELECT `users`.*, (CASE WHEN `password` = ? THEN 1 ELSE 0 END) AS `zend_auth_credential_match` FROM `users` WHERE `mail` = ? Seems to be that Statement.php can not execute the sql of above, but I send the sql by phpmyadmin replacing the ? for strings and work ok. I am sure that $dbAdapter works ok also because I have tested it and the columns name are "mail" and "password". This in my code, also I put the $dbAdapter test code. $dbAdapter = new DbAdapter(array( //This DbAdapter Work ok sure!! 'driver' => 'Mysqli', 'database' => 'securedraw', 'username' => 'root', 'password' => '' )); $fp = function($name) use ($dbAdapter) { return $dbAdapter->driver->formatParameterName($name);}; $sql = 'SELECT * FROM ' . $qi('users') . ' WHERE id = ' . $fp('id'); $statement = $dbAdapter->query($sql); $parameters = array('id' => 1); $sqlResult = $statement->execute($parameters); $row = $sqlResult->current(); $mail = $row['mail']; $password = $row['password']; //until here test $dbAdapter exitly!! //Start the auth proccess!! $authAdapter = new AuthDbTableAdapter($dbAdapter); $authAdapter->setTableName('users') ->setIdentityColumn('mail') ->setCredentialColumn('password'); $authAdapter->setIdentity('josep') ->setCredential('josep'); $authResult = $authAdapter->authenticate(); //This is the fail method!!!

    Read the article

  • How do I write a prepared statement with an update?

    - by Chris
    I am using mysqli prepared statments and I am trying to write a prepared statement with an UPDATE, but I think I am off somewhere. Here's my code: $upload_folder = 'Some String'; $sql = 'UPDATE orders (upload_location) SET (?) WHERE order_id = 160'; $stmt = $conn->stmt_init(); if($stmt->prepare($sql)){ $stmt->bind_param('s', $upload_folder); $location_inserted = $stmt->execute(); } What am I doing wrong?

    Read the article

  • PHP URL Security Question

    - by TaG
    I want to have users store the url in my database I'm using php mysql and htmlpurifier I was wondering if the following code was good way to filter out bad data? Here is the Partial PHP code. $url = mysqli_real_escape_string($mysqli, $purifier->purify(htmlspecialchars(strip_tags($_POST['url'])));

    Read the article

  • Mysql through PHP gives a "Can't create/write to file" error

    - by Peter
    The full error is: Message: Mysqli statement execute error : Can't create/write to file '/var/www/zendApp/backup/mysql/1268733580_name.sql' (Errcode: 13) I have tried several things already with the /var/www/ZendApp/backup/mysql directory $chmod 777 mysql $chmod 1777 mysql $chown root:root mysql $chown mysql:mysql mysql But nothing helps. What am I doing wrong here? Do I have to tell mysql somewhere that I can write to that directory?

    Read the article

  • Ajax, php, mysql not working mysql limit

    - by Hofmeister Ákos
    I have 3 files. list.php $articles = $mysqli->query("SELECT mainPictureBig, title, writer, writeDate, link FROM articles WHERE category=$this->category ORDER BY writeDate DESC LIMIT 0,10"); while($article = mysqli_fetch_row($articles)) { echo "<a href=\"".$this->url."/".$article[3]."/".$article[4]."\"><div id=\"listElement\"> <div id=\"listElementWallpaper\" style=\"background-image: url('category/img.jpg');\"></div> <div id=\"listElementContent\"><div id=\"listElementTitle\">".$article[1]."</div>".$this->giveWriter($article[2]).", ".$this->giveDate($article[3])."</div> </div></a>"; } $maximumElements=ceil($numberOfContent / 10) * 10; It's working, so there is no problem, it lists the first 10 elements from the sql table, and i got the $numberOfCOntent part also. Than i have a button: echo "<div id=\"listMore\"><div id=\"buttonOne\" onclick=\"listMore($this->category,$maximumElements)\">Load more</div></div>"; There is also no problem, i load the .js file, and it looks like: var from = 10; function listMore(categoryId, maximum) { $( "#listMore" ).slideUp( 200, function() { $( "#listMore" ).html("<center>Loading..</center>"); $( "#listMore" ).slideDown( 500, function() { $.post( "http://localhost/ajax.php", {type: "listMore", id: categoryId, sqlFrom: from} ) .done(function( elements ) { $("#listBody").append( elements ); if(maximum > from+10) { from = from+10; $( "#listMore" ).slideUp(200, function() { $( "#listMore" ).html("<div id=\"buttonOne\" onclick=\"listMore("+categoryId+","+maximum+")\">Load more</div>"); $( "#listMore" ).slideDown(200); }); } else $( "#listMore" ).slideUp(200); }); }); }); } And it's also working, and the problem is in the PHP file. As you can see, i'm sending an integer the "from" variable, the PHP file: $articles = $mysqli->query("SELECT mainPictureBig, title, writer, writeDate, link FROM articles WHERE category=$id ORDER BY writeDate DESC LIMIT $from,10"); It's also working, but not loading the next 10, only the next 9. So it skips the very next row and loads the rows only after the very first, so only 9. I tried to write here only the important part of the code, so i skipped some echo part etc. Any idea?

    Read the article

  • query wordpress database

    - by vick
    I have a table in the same database as my wordpress install. What is the correct way of querying it the "wordpress way" ? I know I can use mysqli and that is what I usually do. But I am sure wordpress has it's own standard and perhaps classes to do this. thanks

    Read the article

  • PHP & MySQL - saving and looping problems.

    - by R.I.P.coalMINERS
    I'm new to PHP and MySQL I want a user to be able to store multiple names and there meanings in a MySQL database tables named names using PHP I will dynamically create form fields with JQuery every time a user clicks on a link so a user can enter 1 to 1,000,000 different names and there meanings which will be stored in a table called names. Since I asked my last question I figured out how to store my values from my form using the for loop but every time I loop my values when I add one or more dynamic fields the second form field named meaning will not save the value entered also my dynamic form fields keep looping doubling, tripling and so on the entered values into the database it all depends on how many form fields are added dynamically. I was wondering how can I fix these problems? On a side note I replaced the query with echo's to see the values that are being entered. Here is the PHP code. <?php if(isset($_POST['submit'])) { $mysqli = mysqli_connect("localhost", "root", "", "site"); $dbc = mysqli_query($mysqli,"SELECT * FROM names WHERE userID='$userID'"); $name = $_POST['name']; $meaning = $_POST['meaning']; if(isset($name['0']) && mysqli_num_rows($dbc) == 0 && trim($name['0'])!=='' && trim($meaning['0'])!=='') { for($n = 0; $n < count($name); $n++) { for($m = 0; $m < count($meaning); $m++) { echo $name[$n] . '<br />'; echo $meaning[$m] . '<br /><br />'; break; } } } } ?> And here is the HTML code. <form method="post" action="index.php"> <ul> <li><label for="name">Name: </label><input type="text" name="name[]" id="name" /></li> <li><label for="meaning">Meaning: </label><input type="text" name="meaning[]" id="meaning" /></li> <li><input type="submit" name="submit" value="Save" /></li> </ul> </form> If needed I will place the JQuery code.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13  | Next Page >