Hack Forums
5$ to whoever fixes this! - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hack Forums Official Information (https://hackforums.net/forumdisplay.php?fid=1)
+--- Forum: Site News (https://hackforums.net/forumdisplay.php?fid=2)
+--- Thread: 5$ to whoever fixes this! (/showthread.php?tid=2667093)



5$ to whoever fixes this! - FantaŠec - Jul 11, 2012

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.


* - Able™ - Jul 11, 2012

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


* - FantaŠec - Jul 11, 2012

Parse error: syntax error, unexpected ')' in /home/hxrprodu/public_html/cost.php on line 7


* - Phizo - Jul 11, 2012

(Jul 11, 2012 02:55 AM)Fanta‍ 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.


* - imAnoobLOL - Jul 11, 2012

$sql = mysql_query("SELECT SUM(`at`) FROM `User`") or die(mysql_error());
Change the '9 to the snippet code ("


* - Able™ - Jul 11, 2012

(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


* - FantaŠec - Jul 11, 2012

It says Error now, nothing else, any ideas?


* - Phizo - Jul 11, 2012

(Jul 11, 2012 03:02 AM)Fanta‍ 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.


* - FantaŠec - Jul 11, 2012

Everything is correct though, thats the problem :/


* - Able™ - Jul 11, 2012

I am working in this now, I will get back to you when I have found it :D


* - BadGame - Jul 11, 2012

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🤝


* - FantaŠec - Jul 11, 2012

It still wont work 😧 does anyone have Skype or TV?


* - BadGame - Jul 11, 2012

(Jul 11, 2012 09:24 AM)Fanta‍ 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 :)


* - FantaŠec - Jul 11, 2012

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


* - BadGame - Jul 11, 2012

(Jul 11, 2012 10:19 AM)Fanta‍ 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 😁