0

Hi I keep getting Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in and dont know how to fix.

I have 1 table and need to display two colums awnser here is the code can any one olease point me in the right direction.

<?php

$result = mysql_query("SELECT contact_financial_invoiceamount-contact_financial_payment AS outstanding FROM contacts WHERE contact_id = ".$_GET['id']."");
while($row = mysql_fetch_row($result)

echo $row['outstanding'];

    ?>
5
Contributors
5
Replies
7
Views
5 Years
Discussion Span
Last Post by jmichae3
0

There is an error in your query. Use $result = mysql_query("...") or die(mysql_error()); to find out more.

0

SELECT contact_financial_invoiceamount-contact_financial_payment AS outstanding

You must be missing comma between each field names which was bold. You should separate the query string and function. Here is readable format and less errors.

$sql = "SELECT contact_financial_invoice, amount-contact, financial_payment AS outstanding FROM contacts WHERE contact_id = ".$_GET['id'];
$result = mysql_query($sql);

0

In this line:

$result = mysql_query("SELECT contact_financial_invoiceamount-contact_financial_payment AS outstanding FROM contacts WHERE contact_id = ".$_GET['id']."");

I think you should write:

$result = mysql_query("SELECT contact_financial_invoiceamount-contact_financial_payment AS outstanding FROM contacts WHERE contact_id = '{$_GET['id']}'");

instead. Cause generally you are not allowed to use two double quotation marks together.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.