• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1650
  • Last Modified:

PHP/MYSQL - Query is empty error. =/

Hello everyone. I'm having a bit of a dumbfounded moment here. For some reason, this script below which simply inserts 2 fields to the mysql db is giving a "query is empty" error.

$_SESSION['auth']="yes";
$logname = $_POST['fusername'];
$_SESSION['logname'] = $logname;
$today = date("Y-m-d h:m:s");
$sql = "INSERT INTO Member (loginName, loginTime) VALUES ('$logname', '$today')";
echo "$logname, $today"; // to see if there's a variable issue both variables echo correctly.
mysql_query($sq1) or die(mysql_error());

I've looked over this short code many dozens of times, but I just can't seem to figure it out.
I've used this same code, to directly insert them via phpmyadmin and it works fine.

Thanks in advance.
0
enyceexdanny
Asked:
enyceexdanny
  • 4
  • 3
1 Solution
 
glcumminsCommented:
$sql = "INSERT INTO Member (loginName, loginTime) VALUES ('$logname', '$today')";
echo "$logname, $today"; // to see if there's a variable issue both variables echo correctly.
mysql_query($sq1) or die(mysql_error());

Looks like the query is stored in '$sql' (ESS-QUE-ELL), but mysql_query is trying to call '$sq1' (ESS-QUE-ONE)
0
 
glcumminsCommented:
The eyes get a little blurry after too many hours of coding and debugging, no? :)
0
 
enyceexdannyAuthor Commented:
oh my.... You're right!
Haha, I feel extremely silly at the moment.

Anyways, thanks for the awesome quick response as always from ee. ^_^
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
enyceexdannyAuthor Commented:
Yeah. It actually looks identical.. I had to copy and paste that "1" into google. =)
0
 
enyceexdannyAuthor Commented:
maybe it's time to change the code font in zend.. lowercase L and 1 look exactly identical!.=O
0
 
glcumminsCommented:
I've tried fiddling on my end with other fonts that would differentiate better, but I always end up back at a monospace fixed font, because I think I can read the rest of the code better. If you find a font that works well for you, let me know! :)
0
 
enyceexdannyAuthor Commented:
Proggy clean seems pretty decent.
http://www.tactile3d.com/tristan/
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now