FreePgs.com Forum
September 20, 2021, 03:42:25 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: The "Support Requests" forum is now viewable by guests.
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: DEMONIC SQL problems!  (Read 3381 times)
sixthcrusifix
Sage
Verified Account
Sr. Member
*

Karma: +0/-3
Offline Offline

Posts: 445


http://sixthcrusifix.com/home/

Blog entries (0)

View Profile WWW
« on: May 18, 2006, 09:13:36 AM »

Okay can anyone help me, When ever I do this:

Code:
$SQL = "select * from USER_characters where username = \"$username\" and character = \"$chara\"";

I get this horrible "not a valid MySQL Resource" Error.



But if I leave off : and character = \"$chara\"

and just use this:
Code:
$SQL = "select * from USER_characters where username = \"$username\" ";

Everything works just fine. Now this works now because I only have a single row of Data for testing, but I NEED to select my data by BOTH of those. Why the hell is it giving me the error just for trying to add a requisite? I KNOW that the value of the second one perfectly matches the value in the DB, the Character name is correct, I've checked it many times.
Logged

Visite me website at http://www.sixthcrusifix.com
neosquared
Coding until my eyes bleed..
Verified Account
Jr. Member
*

Karma: +1/-0
Offline Offline

Posts: 51

Blog entries (0)

View Profile WWW
« Reply #1 on: May 19, 2006, 03:54:17 AM »

When ever I do this:

Code:
$SQL = "select * from USER_characters where username = \"$username\" and character = \"$chara\"";

I get this horrible "not a valid MySQL Resource" Error.

Could it be that character is a reserved word?  I've had issues with those before, and I dare say I would have described them as demonic, too.
Try this, see if it works:

Code:
$SQL = "select * from USER_characters where `username` = \"$username\" and `character` = \"$chara\"";
Quoted (if you could call those quotes, can't remember what they're called in any case) both column names, just in case.

Aside from that, I can't see anything wrong with your query - it all looks good to me.
Logged

Don't take servers for granted.
Everything is flammable, if you get it hot enough.
Visit my website!  It'll make you cooler!
FreePgs.com Forum
« Reply #1 on: May 19, 2006, 03:54:17 AM »

 Logged
sixthcrusifix
Sage
Verified Account
Sr. Member
*

Karma: +0/-3
Offline Offline

Posts: 445


http://sixthcrusifix.com/home/

Blog entries (0)

View Profile WWW
« Reply #2 on: May 21, 2006, 04:10:08 PM »

Yes it ended up just being that Character is a reserved name :C I chanegd it to "charname" and it works fine. Thanks Cheesy
Logged

Visite me website at http://www.sixthcrusifix.com
garyr_h
Verified Account
Full Member
*

Karma: +0/-0
Offline Offline

Posts: 110

Blog entries (0)

View Profile
« Reply #3 on: May 21, 2006, 11:36:13 PM »

You could have just tried using slanted quotes ` around the column name.
Logged
FreePgs.com Forum
« Reply #3 on: May 21, 2006, 11:36:13 PM »

 Logged
sixthcrusifix
Sage
Verified Account
Sr. Member
*

Karma: +0/-3
Offline Offline

Posts: 445


http://sixthcrusifix.com/home/

Blog entries (0)

View Profile WWW
« Reply #4 on: May 22, 2006, 11:16:29 PM »

You could have just tried using slanted quotes ` around the column name.

I really think that I did and it still didn't work, I tried it like 6 different ways I can't imagine I forgot that one...
Logged

Visite me website at http://www.sixthcrusifix.com
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!