Jump to content

plz solve this problem


faisalchaos

Recommended Posts

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

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.

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());

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');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.