Jump to content

Recommended Posts

would this help you?

<?php
include('connect.php');
$result = mysql_query("SELECT itemQty SUM(itemQty) FROM transactions Where itemDescription= 'raffle'") or die mysql_error());
$row = mysql_fetch_array( $result );

echo $row['sum(itemQty)'];
?>

 

: ) i added $result = before you mysql_query();

would this help you?

<?php
include('connect.php');
$result = mysql_query("SELECT itemQty SUM(itemQty) FROM transactions Where itemDescription= 'raffle'") or die mysql_error());
$row = mysql_fetch_array( $result );

echo $row['sum(itemQty)'];
?>

 

: ) i added $result = before you mysql_query();

 

Nope. Thanks for trying though:-)

Hmm I have closed my sql to test it, but arent you missing a loop at the bottom to run through the array of results?

 

does maybe this work for you?

 

<?php
include('connect.php');
$result = mysql_query("SELECT itemQty SUM(itemQty) FROM transactions Where itemDescription= 'raffle'") or die mysql_error());

while ($row = mysql_fetch_array( $result )){
echo $row['sum(itemQty)'];
}
?>

 

if this doesnt work It might be the ['sum(itemQty)'] that is weird. But i hope this works :)

Hmm I have closed my sql to test it, but arent you missing a loop at the bottom to run through the array of results?

 

does maybe this work for you?

 

<?php
include('connect.php');
$result = mysql_query("SELECT itemQty SUM(itemQty) FROM transactions Where itemDescription= 'raffle'") or die mysql_error());

while ($row = mysql_fetch_array( $result )){
echo $row['sum(itemQty)'];
}
?>

 

if this doesnt work It might be the ['sum(itemQty)'] that is weird. But i hope this works :)

 

Nope. Still nothing. I have tried $row['itemQty']; 

This could be nothing but i just googled for http://www.parse-error-unexpected-t-string.com/ and if i look at your code Maybe a ( is missing right after the or die clause

 or die mysql_error());

instead of

 or die (mysql_error());

 

So maybe this is correct now:

<?php
include('connect.php');
$result = mysql_query("SELECT itemQty SUM(itemQty) FROM transactions Where itemDescription= 'raffle'") or die (mysql_error());

while ($row = mysql_fetch_array( $result )){
echo $row['sum(itemQty)'];
}
?>

This could be nothing but i just googled for http://www.parse-error-unexpected-t-string.com/ and if i look at your code Maybe a ( is missing right after the or die clause

 or die mysql_error());

instead of

 or die (mysql_error());

 

So maybe this is correct now:

<?php
include('connect.php');
$result = mysql_query("SELECT itemQty SUM(itemQty) FROM transactions Where itemDescription= 'raffle'") or die (mysql_error());

while ($row = mysql_fetch_array( $result )){
echo $row['sum(itemQty)'];
}
?>

 

Yep. That eliminated the error. Thank you. Although it still returns 0 results i at least know what u pointed out:-)

Can't fix it?

 

<?php
include('connect.php');
mysql_query("SELECT itemQty SUM(itemQty) FROM transactions Where itemDescription= 'raffle'") or die mysql_error());
$row = mysql_fetch_array( $result );

echo $row['sum(itemQty)'];
?>

 

you are missing a , after itemQty... your select should read

mysql_query("SELECT itemQty, SUM(itemQty) AS TitemQty FROM transactions Where itemDescription= 'raffle'") or die (mysql_error());

notice that I also added an alias for the aggregate function... it will allow you to change this line

echo $row['sum(itemQty)'];

for the more simple

echo $row['TitemQty'];

Can't fix it?

 

<?php
include('connect.php');
mysql_query("SELECT itemQty SUM(itemQty) FROM transactions Where itemDescription= 'raffle'") or die mysql_error());
$row = mysql_fetch_array( $result );

echo $row['sum(itemQty)'];
?>

 

you are missing a , after itemQty... your select should read

mysql_query("SELECT itemQty, SUM(itemQty) AS TitemQty FROM transactions Where itemDescription= 'raffle'") or die (mysql_error());

notice that I also added an alias for the aggregate function... it will allow you to change this line

echo $row['sum(itemQty)'];

for the more simple

echo $row['TitemQty'];

 

Ahhhh.. Absolutely. That works.. Thanks Guys for the tutorial!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.