Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

5$ to whoever fixes this!

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/hxrprodu/public_html/cost.php on line 9


Code
<?php
$con = mysql_connect("localhost","username","password");
if (!$con)
{
 die('error');
}
$sql = mysql_query("SELECT SUM(`at`) FROM `User`");
$r = mysql_fetch_array($sql);
$total=$r[0];
echo $total;
?>
Skype - Frostin8897 if you are a good coder, 2 have tried all have failed.
Change $sql to this:
Code
$sql = mysql_query("SELECT SUM(`at`) FROM `User`") or trigger_error(mysql_error));
Then tell me what it says afterwards :D
Parse error: syntax error, unexpected ')' in /home/hxrprodu/public_html/cost.php on line 7
(Jul 11, 2012 02:55 AM)FantaŠec Wrote:  Parse error: syntax error, unexpected ')' in /home/hxrprodu/public_html/cost.php on line 3

He made a mistake in the code.

PHP Code

<?php 
$sql 
= mysql_query("SELECT SUM(`at`) FROM `User`") or die(mysql_error()); 

The reason for the aforementioned snippet is that the error will contain a boolean when triggered, this way we will be able to determine what the error is and resolve the issue.
[Image: 8Yoto.png]
$sql = mysql_query("SELECT SUM(`at`) FROM `User`") or die(mysql_error());
Change the '9 to the snippet code ("
(Jul 11, 2012 02:57 AM)Phizo Wrote:  He made a mistake in the code.

PHP Code

<?php 
$sql 
= mysql_query("SELECT SUM(`at`) FROM `User`") or die(mysql_error()); 

The reason for the aforementioned snippet is that the error will contain a boolean when triggered, this way we will be able to determine what the error is and resolve the issue.

Oh sorry, I did make a mistake :(

Yeah that is what I was trying to do, it makes it easier to determine the error I'm pretty sure :D
It says Error now, nothing else, any ideas?
(Jul 11, 2012 03:02 AM)FantaŠec Wrote:  It says Error now, nothing else, any ideas?

There's obviously a mistake in your query, most likely to do with the table and/or column. It should say more than just "Error" though.
[Image: 8Yoto.png]
Everything is correct though, thats the problem :/
I am working in this now, I will get back to you when I have found it :D
put ds b4 the the sql query
PHP Code

<?php 
mysql_select_db
("DATABASE_NAME"); 

btw, the php errors lets you know where to correct,
Warning:
PHP Code

<?php 
mysql_fetch_array
() 

expects parameter 1 to be resource, boolean given in
Means $sql is returing

PHP Code

<?php 
FALSE 


~BadGame🤝
It still wont work 😧 does anyone have Skype or TV?
(Jul 11, 2012 09:24 AM)FantaŠec Wrote:  It still wont work 😧 does anyone have Skype or TV?

are u using hostzilla ???
in the free version the mysql installed in buggy 🤮
when they was migrating :)
No I am not :( I am using a host I am not sure of XD

I DID IT, I DO NOT KNOW WHAT I DID BUT I DID IT :)))) I just fixed something that looked bad and its fixed. But who gets 5$ 😧 lol
(Jul 11, 2012 10:19 AM)FantaŠec Wrote:  No I am not :( I am using a host I am not sure of XD

I DID IT, I DO NOT KNOW WHAT I DID BUT I DID IT :)))) I just fixed something that looked bad and its fixed. But who gets 5$ 😧 lol

save it in the pocket or Have an icecream of it 😁


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Official] by OmniscientDec 23, 2018 05:25 PM 10 404 Dec 23, 2018 05:25 PM
Last Post: Xerotic
by OmniscientNov 12, 2017 12:06 AM 244 9,420 Nov 12, 2017 12:06 AM
Last Post: Omniscient
by I'm GoneJun 14, 2011 10:50 PM 16 173 Jun 14, 2011 10:50 PM
Last Post: Omniscient