Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Select/query problem [newbie]
// check first to see if the entry is _in_ the database
// Get record (SELECT).

$query ="SELECT * FROM testschedule WHERE (personid='$personid') AND
(day='$HTTP_POST_VARS[day]') AND (startt='$HTTP_POST_VARS[startt]')
AND (endt='$HTTP_POST_VARS[endt]')";
$result = mysql_query($query);
or die ("Couldn't execute query." . mysql_errno() .
mysql_error());

I'm getting a parse error ([error] PHP Parse error:  parse error in
/externalweb/RCF/cgi-bin/MonitorScripts/calSub.php on line 159).

Line 159 is the 'or die' portion.

I've noticed parse errors point to a line or two after the real
problem. My best guess is that the query is actually "wrong" in some
way. Maybe I can't use three AND conditionals in the same select?

Gwen


Report this thread to moderator Post Follow-up to this message
Old Post
Gwen Morse
11-15-04 01:55 PM


Re: Select/query problem [newbie]
> $result = mysql_query($query);
> or die ("Couldn't execute query." . mysql_errno() .
> mysql_error());

compare

$query = mysql_query("$sql")
or exit ("Ongeldige query " . mysql_error());

Floortje



Report this thread to moderator Post Follow-up to this message
Old Post
Floortje
11-15-04 01:55 PM


Re: Select/query problem [newbie]
On Mon, 15 Nov 2004 03:24:32 -0500, Gwen Morse <goldmooneachna@yahoo.com>
wrote:

>$result = mysql_query($query);
^^^

>	or die ("Couldn't execute query." . mysql_errno() .
>mysql_error());

This is supposed to be a single statement; but you've terminated it after th
e
mysql_query(). Remove the first semicolon.

--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool

Report this thread to moderator Post Follow-up to this message
Old Post
Andy Hassall
11-16-04 01:55 AM


Re: Select/query problem [newbie]
On Mon, 15 Nov 2004 21:28:03 +0000, Andy Hassall <andy@andyh.co.uk>
wrote:

> This is supposed to be a single statement; but you've terminated it after 
the
>mysql_query(). Remove the first semicolon.

Putting semi-colons in the wrong places (and leaving them off where
they're needed) is still the most common mistake I make. You'd think
I'd check things more carefully!

That said, is there an IDE that helps improve debugging? Right now, I
only get error messages from grep-ing the web server logs. It's an
awkward way to track down syntax errors/typos.

In my two programming classes at school (Java and Visual Basic), both
languages had a GUI-based IDE which caught syntax errors on the fly.
They also had debuggers that allowed me to step through the processing
of the code to see where I made logical errors. I tried a couple IDEs
mentioned at php.net, and the ones I d/led were simply glorified text
editors. I get syntax highlighting with Kate. I'm not sure if I picked
the wrong packages, or, if what I'm looking for is only available in
commercial apps.

I'm a linux user (FC2), if that matters.

Gwen


Report this thread to moderator Post Follow-up to this message
Old Post
Gwen Morse
11-16-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP SQL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:46 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.