Jump to content

Search the Community

Showing results for tags 'pdo'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 9 results

  1. Hi All, I am new to php and I don't about following error. So I request you to give me solution for this and also please explain something about this error. Here I am working on User's profile page. I able to fetch data and displaying in profile's form, but data is not updating and I got the following error when I clicked for "Updation". " Uncaught Error: Call to a member function bindParam() on boolean in C:\xampp\htdocs\VS\components\update-profile.php:16 Stack trace: #0 {main} thrown in C:\xampp\htdocs\VS\components\update-profile.php on line 16 " And my code is: <?php include '../_database/database.php'; ini_set("display_errors",1); session_start(); $msg=""; $temp=(isset($_SESSION['Username']) ? $_SESSION['Username'] : ''); $id=(isset($_SESSION['Id']) ? $_SESSION['Id'] : ''); if($_SERVER["REQUEST_METHOD"] == "POST") { $username = $_POST['Username']; $email = $_POST['Email']; $employee = $_POST['EmployeeID']; $designation = $_POST['Designation']; $password = $_POST['Password']; $sql=$database->prepare("update set Username=:name,Email=:email,EmployeeID=:employee,Designation=:designation,Password=:password where Id='$id'"); $sql->bindParam(':Username',$name,PDO::PARAM_STR, 50); $sql->bindParam(':Email',$email,PDO::PARAM_STR, 50); $sql->bindParam(':EmployeeID',$employee,PDO::PARAM_INT, 11); $sql->bindParam(':Designation',$designation,PDO::PARAM_STR, 50); $sql->bindParam(':Password',$password,PDO::PARAM_STR, 50); if($sql->execute()){ echo "<font face='Verdana' size='2' color=green>You have successfully updated your profile<br></font>"; } else{ print_r($sql->errorInfo()); $msg=" <font face='Verdana' size='2' color=red>There is some problem in updating your profile. Please contact site admin<br></font>"; } } ?> If this is wrong kindly give me a solution. Thank You,
  2. Database Connection Issue

    <?php $serv = "localhost:81"; $user = "root"; $password = ""; try { $con = new PDO("mysql:host=$serv;dbname=test", $user, $password); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Successfully connected."; } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?> Here I'm trying to use PDO to connect to my SQL database "test". However, I receive this error each time I connect: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. Am I connecting with the wrong server, user or password? Because I fail to see here the mistake.
  3. To PDO or not to PDO

    I currently am doing a little work on a seasonal website for our golf league and wanted to improve the content with some databases. Going online and reading some articles regarding doing this I came across the issue of whether to write my code using SQL object oriented, SQL procedural or I guess what is the latest and greatest scripting, PDO. What I have read is that if I have any thought of changing over to another database type other than SQL, PDO would be the way to go. But my thought is that I most likely would not because I not only may never deal with other types of databases but I do not think that all these Hosting sites which SQL is most likely ingrained in would change and make their thousands of customers recode all their scripts. “Am I wrong” When I was taught PHP/SQL, I believe it was using the Procedural method, which appears not to be far from the object oriented script. PDO seems to be a little more involved in learning its syntax. What would your recommendations be for me? I would learn the PDO method if you think it would be beneficial. But if not necessary, I will stick to what I already feel comfortable with. All comments greatly appreciated. P
  4. PHP > MySQLi > Is it depreciated?

    Hello all. I have come here to the source of web standards to understand PHP and the API's it uses to access databases. From my reading (why yes, I do know how to use google ) it seems both MySQLi and PDO are acceptable methods. Other than the boatload of "experts" on various forums and blogs shouting that MySQLi is depreciated, is there any real indication that it is? Now I don't want to start a MySQLi Vs PDO thread. I just want to know if MySQLi is still an acceptable API to use
  5. plus one ("+1") "like button"-voting system I just want to have non-authorization (non-voting "system" at all - just for like button). I want to click "Like"-button key and want to have other users which visit this webpage to see this. Like-button with no additional things (no dislike) just: 1. Press - HTML/Javascript 2. Send PHP (PDO!) 3. Receive Textfile (may be.. mysql) *it has to be as simple as it could be* 4. Show +1, which would be visible to other visitors (ajax/js - optional). That example to be working. I have mysql and apache and php PDO (php5.5.6)! This is with no PDO and I don't think It could work (php5.5.6) and in any case.... The upperscript is not very much comprehensible though, because the only thing I done in PDO was: Considering the upper borrowed example ,I have some speculations: I don't need Ajax for my first steps (at all) - because it's long and lots of unknowns and after all it's increasing complexity. Might it be not a bad idea to refuse to use mysql. I had had a two-week (or so) searching(examination/looking) before js tryings when searching (in English) how to do PDO. (I should say it's a great effort to fight for your little desirable piece of code over an inet). Reminder for myself: 1. Launch mysql: /etc/init.d/mysql start just for likes: 1a) Make a db, make users, grant rights OR 1b) After mysql launch with the help of PHP/PDO: grant mysql rights admin, make a db, make db users & grant them rights to db, make tables and INSERT data INTO tables (may be a single like-table). OR even 1c) Make a textfile - and forget this brain pain and append to it (like I do it in bash >>). 2. Make HTML 2a) <form><input type=button id="likebutton" onClick="databaseinsertevent()"> 2b) ......onClick=Database insert without any functions - just because it is very many text 3. Make JavaScript 3a) something+=something+1 >>like 3b) show like on page 4. Make PHP/PDO or PHP/txt-file 4a) read last line of txt txt 1 2 3 4b) a database (much more complex variant) $db=new PDO('mysql:host=localhost;dbname=test;charset=utf8', 'root', 'hyuiuik'); foreach($db->query('SELECT like FROM TABBL') as $value) { echo $value['nn']; foreach($db->query('INSERT like TO TABBL') as $something <-- #comment//* Repeat the 1st output 5. Link all modules 5a) HTML + Javascript 5b) html/js + PHP 5c) PHP/PDO + mysql (or a textfile) 5d) run /etc/init.d/apache2 start *5d1 Link apache2+mysql+php(+pdo) (emerge -av php/pdo etc...,config..) if needed ------------------------------------------------- I am in my first steps of a difficult winding climb towards ⬘
  6. how do i convert this to PDO....HELP

    hello everyone..how do i code PDO for this script...please help me <?php if (isset($_POST['Login'])){ $UserName=$_POST['UserName']; $Password=$_POST['Password']; $hostname = 'localhost'; $username = 'root'; $password = ''; $database_name = 'ovs'; $mysqli = new mysqli($hostname, $username,$password, $database_name); $login_query=mysqli_query($mysqli,"select * from voters where Username='$UserName' and Password='$Password' and Status='Unvoted' and Year='1st year'") or die(mysqli_error()); $login_query1=mysqli_query($mysqli,"select * from voters where Username='$UserName' and Password='$Password' and Status='Voted'"); $count=mysqli_num_rows($login_query); $count1=mysqli_num_rows($login_query1); $row=mysqli_fetch_assoc($login_query); $id=$row['VoterID']; ?>index.php
  7. Can you tell me what the function of PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ?I've read the php manual, but i still dont understand that...If i remove the setattributte method, it looks alright too... What's the function of that actually ?
  8. PDO SQLSTATE[HY000]: General error

    hey guys, I'm trying to switch my mysql connections over to PDO but I'm having a hard time. I've read a section on it in the php book I'm reading, I watched the phpacademy,org tutorial on it, I've read the section on it here at w3schools and I can't get it working. I've also posted it on 2 other forums and no one has yet to figure out where the problem is and it's eaten up 2 days of my time as well. If I can't get it figured out today I'm seriously thinking of going back to using the old mysql functions because they worked right the first time and have never given me an ounce of trouble. It's just very frustrating that my registration/login system was working perfect and then I upgrade and nothing works and no one can figure it out. . . It says the error is on line 142, which is the fetchAll() function line. Thanks for any help you guys can offer! Here is the connection script <?php// Connects to Our Database$db_host = "localhost";$db_user = "root";$db_password = "";$db_database = "game_db";try{ $conn = new PDO ('mysql:host=localhost;dbname=game_db', $db_user, $db_password);$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);} catch (PDOException $e) { echo 'ERROR: ' . $e->getMessage();}?> And the query thats giving me the trouble $sql = "INSERT INTO `player_data` (`username`, `empire_name`, `ruler_name`, `founding_group`, `government`, `population`, `currency`, `p_currency`, `scrap`, `food`, `fuel`, `salvage_wpn`, `scrap_wpn`, `morale`, `initiative`, `influence`, `farms`, `housing`, `scrap_yards`, `barracks`, `taverns`, `scouts`, `militia`, `infantry`, `heavy_infantry`, `technicals`, `tanks`, `gate`, `tower`, `wall`, `tunnels`, `dogs`) VALUES (:user, :empire_name, :ruler_name, :founding_group, :government, 25, 1000, 100, 1000, 1000, 0, 0, 5, 10, 100, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"; $query = $conn->prepare($sql); $query->bindValue(':user', $user, PDO::PARAM_STR); $query->bindValue(':empire_name', $empire_name, PDO::PARAM_STR); $query->bindValue(':ruler_name', $ruler_name, PDO::PARAM_STR); $query->bindValue(':founding_group', $founding_group, PDO::PARAM_STR); $query->bindValue(':government', $government, PDO::PARAM_STR); try { $query->execute(); } catch (Exception $e) { exit($e); } $row_count = $query->fetchAll(PDO::FETCH_ASSOC);
  9. I have read the documentation on php.net about installing the module php-pdo with MySQL support and it seems that it says to use the option--with-pdo-mysql however it does not show me any context on how or where to use it. I have been installing php-pdo on my server with yum -y install php-pdo however that only installs the module with SQLite support. I need to know how to install the module on CentOS 6 with support for MySQL. It seems there are drivers for this. I found know documentation that could explain this to me. Does anyone know how to do this?
×