Solved

PHP/MYSQL - Query is empty error. =/

Posted on 2007-03-27
7
1,620 Views
Last Modified: 2013-12-13
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
Comment
Question by:enyceexdanny
  • 4
  • 3
7 Comments
 
LVL 24

Accepted Solution

by:
glcummins earned 50 total points
ID: 18802669
$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
 
LVL 24

Expert Comment

by:glcummins
ID: 18802680
The eyes get a little blurry after too many hours of coding and debugging, no? :)
0
 

Author Comment

by:enyceexdanny
ID: 18802700
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:enyceexdanny
ID: 18802715
Yeah. It actually looks identical.. I had to copy and paste that "1" into google. =)
0
 

Author Comment

by:enyceexdanny
ID: 18802746
maybe it's time to change the code font in zend.. lowercase L and 1 look exactly identical!.=O
0
 
LVL 24

Expert Comment

by:glcummins
ID: 18802767
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
 

Author Comment

by:enyceexdanny
ID: 18802981
Proggy clean seems pretty decent.
http://www.tactile3d.com/tristan/
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now