Jump to content

Search the Community

Showing results for tags 'php problem boolean value'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi i am new to this forum and to the whole php ,wanted a hand at this code error : PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\Inetpub\hello\tugapay.com\httpdocs\account\methods.php on line 37 I have been looking everywhere but nothing has pointed me to the right direction Please if someone could help me would be appreciated thanks My code is below <?php // If user submits login form if(isset($_POST['login_submit'])){ $results = mysql_query("SELECT `login_email` FROM `users` A WHERE `email` = 'login_email' AND `pass` = 'login_password'"); if(empty($_POST['login_email']) || empty($_POST['login_password'])){ $loginMessage = "<div style=\"padding-bottom: 15px;\"> <a href=\"#\" class=\"notification error\">Please fill in all the fields below.</a> </div>"; } elseif(mysql_num_rows($results) > 0){ $row = mysql_fetch_array($results); $_SESSION[‘users’] = $row['id']; header("Location: /account/dashboard.php"); } else { $loginMessage = "<div style=\"padding-bottom: 15px;\"> <a href=\"#\" class=\"notification error\">The information you entered was incorrect.</a> </div>"; } } // If user submits login form if(isset($_POST['transfer_submit'])){ $results = mysql_query("SELECT `id`, CONCAT(`first_name`, ' ',`lastname`) AS `name`, `balance` FROM `accounts` A WHERE `login_email` = '". $_POST['transfer_email'] ."'"); $row = mysql_fetch_array($results); if(empty($_POST['transfer_email']) || empty($_POST['transfer_amount']) || empty($_POST['transfer_description'])){ $transferMessage = "<div style=\"padding-bottom: 15px;\"> <a href=\"#\" class=\"notification error\">Please fill in all the fields below.</a> </div>"; } elseif(empty($row)) { $transferMessage = "<div style=\"padding-bottom: 15px;\"> <a href=\"#\" class=\"notification error\">Email address not found.</a> </div>"; } elseif($row['id'] == $_SESSION['account_id']){ $transferMessage = "<div style=\"padding-bottom: 15px;\"> <a href=\"#\" class=\"notification error\">You cannot send money to yourself.</a> </div>"; } elseif($_POST['transfer_amount'] > $account['balance']){ $transferMessage = "<div style=\"padding-bottom: 15px;\"> <a href=\"#\" class=\"notification error\">You have insufficient funds.</a> </div>"; } else { mysql_query("INSERT INTO transactions (account_id, from_id, amount, description, date, status) VALUES ('". $row['id'] ."', '". $_SESSION['account_id'] ."', '". $_POST['transfer_amount'] ."', '". $_POST['transfer_description'] ."', CURRENT_TIMESTAMP, '1')") OR die(mysql_error()); $balance = $account['balance'] - $_POST['transfer_amount']; mysql_query("UPDATE accounts SET balance = '". $balance ."' WHERE id = '". $_SESSION['account_id'] ."'"); $balance = $row['balance'] + $_POST['transfer_amount']; mysql_query("UPDATE accounts SET balance = '". $balance ."' WHERE id = '". $row['id'] ."'"); $transferMessage = "<div style=\"padding-bottom: 15px;\"> <a href=\"#\" class=\"notification success\">You have successfully sent <strong>£". number_format($_POST['transfer_amount'], 2) ."</strong> to <strong>". $row['name'] ."</strong></a> </div>"; unset($_POST); } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.