Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Closed Thread
 
Thread Tools Display Modes
Share |
  #1  
Old 12-31-2013, 12:07 PM
Old School Old School is offline
Junior Member
 
Join Date: 12-31-13
Posts: 1
iTrader: 0 / 0%
PHP/Mysqli Sum Problem

Good evening

I'm trying to determine the amount of winnings achieved by an individual horse in my database. I've recently changed over to Mysqli and am experiencing problems with finding the SUM. I'm getting a plain white page when I view the page.

Code:
<?php $result = mysqli_query($con,"SELECT SUM(prize) AS prizewinnings FROM runners WHERE h_link = '01335.php'"); while($row = mysqli_fetch_array($result)) { echo " <b>Career Winnings:</b>"; echo $row['SUM(prizewinnings)']; } ?>
I have two questions:
  1. The tutorials I've tried using for Mysqli haven't shown how to produce error messages for debugging - is this the same procedure as for mysql.
  2. What am I doing wrong with the code above?

Any advice gratefully received.

Last edited by Old School; 12-31-2013 at 12:08 PM. Reason: Include code!
 

Advertisement

Advertisement

  #2  
Old 06-23-2014, 12:14 AM
onlineworld onlineworld is offline
Junior Member
 
Join Date: 06-21-14
Posts: 33
iTrader: 0 / 0%
You should change:

Quote:
echo $row['SUM(prizewinnings)'];
to

Quote:
echo $row['prizewinnings'];

To show error messages generated by PHP, you can try to put "ini_set('display_errors', 1);" at the beginning of your script.

Last edited by onlineworld; 06-23-2014 at 12:16 AM. Reason: show errors
 
  #3  
Old 11-23-2014, 09:07 AM
saaek saaek is offline
Junior Member
 
Join Date: 11-23-14
Posts: 23
iTrader: 0 / 0%
it had the same problem try to set name of column in the select query.
 
  #4  
Old 11-23-2014, 10:59 AM
ScriptMan's Avatar
ScriptMan ScriptMan is offline
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,016
iTrader: 4 / 100%
Don't the ' ' change the value of the integer to a string? I've been there and screwed that up before.
 
Go Back   Webmaster Forum > Web Development > Coding Forum

Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQLi not showing an error? splap Coding Forum 9 04-14-2011 08:53 PM
Google's China Problem (and China's Google Problem) - NYTimes Sunday Mag (4/23/06) Julie Google Forum 4 10-26-2009 02:54 PM
Problem in my website or problem in browser? speedo1234 Coding Forum 7 12-23-2008 01:41 PM
Problem with text looking funky on windows… maybe an anti aliasing problem? jpf566 Web Design Lobby 2 07-09-2008 06:40 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 10:11 PM.
Powered by vBulletin
Copyright © 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC