News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SQL Query Help: What is usually a strong suit of mine is now...

Started by MoreBloodWine, March 19, 2015, 06:10:58 PM

Previous topic - Next topic

MoreBloodWine

Queries like the one troubling me right now usually come pretty simple but this head cold I have is messin with me or something lol.

Anyway, the query on line 41 that is "displayed" on line 107 doesn't seem to be working. With that said I was wondering if someone could please help me out in where I went wrong. I can usually get queries to work that are simple counts but I'm brain farting big time on this one.

Ty in advance.

Edit: All I'm trying to do is get the total number of items found in table unconfirmed_entries, which right now should display 1.

Code removed...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


ziycon

Line 41 will only return a resource and not an integer value, you will need to 'fetch' the data from the resource or use a function like 'mysql_num_rows' to get the row count in the returned resource.

On a side note I would suggest to start using mysqli or PDO as mysql is deprecated.

MoreBloodWine

Quote from: ziycon on March 19, 2015, 06:41:22 PM
Line 41 will only return a resource and not an integer value, you will need to 'fetch' the data from the resource or use a function like 'mysql_num_rows' to get the row count in the returned resource.

On a side note I would suggest to start using mysqli or PDO as mysql is deprecated.
Got it... Ty.

   $curr_players_unconfirmed = mysql_query("SELECT COUNT(*) FROM unconfirmed_entries");
   list($current_unconfirmed) = mysql_fetch_row($curr_players_unconfirmed);
   mysql_free_result($curr_players_unconfirmed);


As for SQLi, I think that's enabled on my server along with SQL if I looked at the php_info file right. That being said, do all SQL ref's just get changed to SQLi ? Not really sure how one would "make the switch". For a non SMF site like spend-ur-bits.com
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Advertisement: