faisalchaos Posted April 17, 2009 Share Posted April 17, 2009 hi my name is faisal i not know any thing about php i have one web which show error the error is Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/uncchatc/public_html/config.php on line 30 ================================================== config.php this is php file ================================================== <?php $dusername = "uncchatc_Chat"; $dpwd = "5233125"; $dhost = "localhost"; $dbname = "uncchatc_unc"; $chatip = "209.9.238.166"; $conn = mysql_connect("$dhost","$dusername","$dpwd") or die ("<br><b><div align='center'><font face='Tahoma' size='2'>UNC Chat Communications</b><br> There is a problem with our database at the moment, please try again later.</font></div>"); $db=mysql_select_db($dbname,$conn) or die("Unable to connect to database!"); //Global Variables $sitetitle = 'ENT Chat'; $version = '4.0'; $mintimewait = '30'; $years = '2008'; $sitename = 'ENT Chat'; $colour = array( // key => "file:name", 0 => "red_night:Red Night", 1 => "blue_night:Blue Night", 2 => "emerald_night:Emerald Night", ); $admin_username = 'Admin'; $updateadmin = mysql_query("UPDATE users SET user_level = '2' WHERE username = '$admin_username'"); $adminemail = mysql_query("SELECT * FROM users WHERE username = '$admin_username'"); $email = mysql_fetch_array($adminemail); $admin_email = $email[email_address]; ?> plz how i clear this Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/ Share on other sites More sharing options...
MasterACE14 Posted April 17, 2009 Share Posted April 17, 2009 please use [ code ] [ /code ] tags when posting your code. change... $updateadmin = mysql_query("UPDATE users SET user_level = '2' WHERE username = '$admin_username'"); $adminemail = mysql_query("SELECT * FROM users WHERE username = '$admin_username'"); to... $updateadmin = mysql_query("UPDATE users SET user_level = '2' WHERE username = '$admin_username'"); $adminemail = mysql_query("SELECT * FROM users WHERE username = '$admin_username'"); and see what error comes up then. Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/#findComment-812182 Share on other sites More sharing options...
faisalchaos Posted April 17, 2009 Author Share Posted April 17, 2009 same problem u can check www.unc-chat.com/index.php Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/#findComment-812185 Share on other sites More sharing options...
jackpf Posted April 17, 2009 Share Posted April 17, 2009 Put or die(mysql_error()); after every query. I don't know how many times I say this to people. But yeah, that'll probably shed some light on the problem. Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/#findComment-812202 Share on other sites More sharing options...
MasterACE14 Posted April 17, 2009 Share Posted April 17, 2009 Put or die(mysql_error()); after every query. ah yeah, I didn't add that to the second code I gave lol. Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/#findComment-812205 Share on other sites More sharing options...
jackpf Posted April 17, 2009 Share Posted April 17, 2009 Always helps lol. Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/#findComment-812207 Share on other sites More sharing options...
faisalchaos Posted April 17, 2009 Author Share Posted April 17, 2009 sorry friend i never understand i told me not know any thing about php plz tell me where i put this line in config.php Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/#findComment-812209 Share on other sites More sharing options...
jackpf Posted April 17, 2009 Share Posted April 17, 2009 Hmm...in that case, I'd strongly recommend looking up a php/mysql tutorial. If you're using php on your site, you should at least have some knowledge of the mechanics. After each query, mysql_query();, change it so that it looks like this mysql_query() or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/#findComment-812211 Share on other sites More sharing options...
faisalchaos Posted April 17, 2009 Author Share Posted April 17, 2009 u are very bored to tech me i know coz not know any thing can u tell me in which line i read this proper way i mean to say sorry for distrube u again Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/#findComment-812221 Share on other sites More sharing options...
jackpf Posted April 17, 2009 Share Posted April 17, 2009 Ok... replace this $updateadmin = mysql_query("UPDATE users SET user_level = '2' WHERE username = '$admin_username'"); $adminemail = mysql_query("SELECT * FROM users WHERE username = '$admin_username'"); with this $updateadmin = mysql_query("UPDATE users SET user_level = '2' WHERE username = '$admin_username'") or die(mysql_error().' in q.1'); $adminemail = mysql_query("SELECT * FROM users WHERE username = '$admin_username'") or die(mysql_error().' in q.2'); Link to comment https://forums.phpfreaks.com/topic/154470-plz-solve-this-problem/#findComment-812232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.