TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-09-2008, 04:18 AM   #1 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default Query Debugging

MySQL hates me.
query:
HTML Code:
SELECT * FROM `aaron_eglast`.`egle_post` WHERE `slug`=`html` AND `category`=`HTML` LIMIT 1
Error:
Code:
MySQL said:
#1054 - Unknown column 'html' in 'where clause'
Table XML:
<aaron_eglast>
<!-- Table egle_post -->
<egle_post>
<id>1</id>
<author>Aaron</author>
<last_updated>1</last_updated>
<content>*snip*</content>
<title>Html</title>
<slug>html</slug>
<meta_title>Beginner HTML Tutorial Series</meta_title>
<order>1</order>
<category>HTML</category>
<next>na</next>
<previous>na</previous>
</egle_post>
</aaron_eglast>

so... what is going on here?
__________________
Signatures are nothing but incriminating.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 08-09-2008, 05:07 AM   #2 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

You're using backticks. Use single quotes.

Code:
SELECT *
FROM `aaron_eglast`.`egle_post`
WHERE `slug`='html' AND `category`='HTML'
LIMIT 1
delayedinsanity is offline  
Reply With Quote
Old 08-09-2008, 06:18 PM   #3 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

Mysql Still hates me:
Code:
	$query = "
		SELECT `slug` , `title`
		FROM `aaron_eglast`.`egle_post`
		WHERE `category` = 'HTML'
		ORDER BY `order` ASC";
	$query = mysql_query($query);
	$q = mysql_fetch_array($query);
			if (mysql_num_rows($q) == 0)
			throw new exception('For some reason, the other tutorials in this category could not be found.
			 They will not be displayed at the side of this page.');
The query returns properly in PHPmyAdmin, yet it throws an error on the page.
__________________
Signatures are nothing but incriminating.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Old 08-09-2008, 06:46 PM   #4 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
Kalle is on a distinguished road
Default

Its because the if conditional should be:

PHP Code:
if(!mysql_num_rows($query)) 
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 08-09-2008, 11:47 PM   #5 (permalink)
The Frequenter
 
Join Date: Dec 2007
Location: In my basement
Posts: 386
Thanks: 47
Aaron is on a distinguished road
Default

This is why you are my idol O.o
__________________
Signatures are nothing but incriminating.
Send a message via MSN to Aaron
Aaron is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:23 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design