We help IT Professionals succeed at work.
Get Started

mysql table field types

313 Views
Last Modified: 2014-08-20
I want to run a bandwidth test on occasion from one of my test scripts. This will simply help me get some really basic info on how some of our networks are doing.

Script side;

function band_test()
{
        echo "Doing bandwidth Test"
        BAND_TIME="$(date +"%F %T")"
        CSTATS=`curl -w '%{speed_download}\t%{time_namelookup}\t%{time_total}\n' -o /dev/null -s http://server.com/file`
        SPEED=`echo $CSTATS | awk '{print $1}' | sed 's/\..*//'`
        DNS_TIME=`echo $CSTATS | awk '{print $2}'`
        TOTAL_TIME=`echo $CSTATS | awk '{print $3}'`
        $CURL -F function=band_test -F band_time="$BAND_TIME" -F speed="$SPEED" -F dns_time="$DNS_TIME" -F total_time="$TOTAL_TIME"

}


Php Side;

                        elseif ($_POST['function'] === 'bandwidth_monitor') {
                                mysql_query('INSERT INTO band_logs ( band_time, speed, dns_time, total_time, client_id ) VALUES ("' . $_POST['band_time'] . '","' . $_POST
['speed'] . '","' . $_POST['dns_time'] . '","' . $_POST['total_time'] . '","' . $clientid . '")' )
                or die('Query failed: ' . mysql_error());
                        }
                }

Mysql;

  	Field name    	Type    	Allow nulls?    	Key    	Default value    	Extras   
	id 	int(10) unsigned 	No 	Primary 	NULL 	auto_increment
	speed 	int(10) unsigned 	No 	None 	NULL 	
	dns_time 	float(10,4) 	No 	None 	NULL 	
	total_time 	float(10,4) 	No 	None 	NULL 	
	band_time 	datetime 	No 	None 	NULL

Open in new window


When I wasn't using these field types, I was testing using varchar and everything worked fine.
Now, nothing is being entered into the db but I've been starring at it so long that I am probably not seeing the obvious.

I also want to change 'speed' to 'bps' for bytes per second

Help!
Comment
Watch Question
CERTIFIED EXPERT
Expert of the Year 2014
Top Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 20 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE