Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-04-2004, 04:25 PM   #1
BSOD
 
pcmxkeith's Avatar
 
Join Date: Dec 2004
Posts: 842
Send a message via AIM to pcmxkeith Send a message via MSN to pcmxkeith Send a message via Yahoo to pcmxkeith
Default php

Hello im having an error in mysql and i keep getting some error..does anyone know php to help me?
__________________

pcmxkeith is offline   Reply With Quote
Old 12-04-2004, 06:27 PM   #2
In Runtime
 
Windwaker222's Avatar
 
Join Date: Nov 2004
Posts: 351
Default

could u show us the error its giving you..or give us some sort of explanation other then Error.
__________________

__________________
AMD Phenom 9600 / 4GB OCZ Gold / nVidia 8800GT / ASUS Crosshair 4xPCI-E
Windwaker222 is offline   Reply With Quote
Old 12-04-2004, 06:37 PM   #3
BSOD
 
pcmxkeith's Avatar
 
Join Date: Dec 2004
Posts: 842
Send a message via AIM to pcmxkeith Send a message via MSN to pcmxkeith Send a message via Yahoo to pcmxkeith
Default Re: php

good thinking... lol umm this is what i get when i try to login to my advertisement manager thingie..

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a5245987/public_html/phpadmentor/admin/inclogin.php on line 45




---------------------------this is what is on line 45

/**
* Your database information
**/
if (isset($down_one)){
include ('../database/mysql.php');
}elseif (isset($down_two)){
include ('../../database/mysql.php');
}else{
include ('database/mysql.php');
}
pcmxkeith is offline   Reply With Quote
Old 12-04-2004, 07:53 PM   #4
In Runtime
 
Windwaker222's Avatar
 
Join Date: Nov 2004
Posts: 351
Default

can you show us your code where it shows

mysql_fetch_array(arguement)
__________________
AMD Phenom 9600 / 4GB OCZ Gold / nVidia 8800GT / ASUS Crosshair 4xPCI-E
Windwaker222 is offline   Reply With Quote
Old 12-04-2004, 08:32 PM   #5
BSOD
 
pcmxkeith's Avatar
 
Join Date: Dec 2004
Posts: 842
Send a message via AIM to pcmxkeith Send a message via MSN to pcmxkeith Send a message via Yahoo to pcmxkeith
Default Re: php

Heres the total code.
<?

$g_sUser_Name = "";
$g_fUser_Admin = false;
$g_sUser_Fullname = "";
$g_sUser_FldAuto = 0;

function DBUserCheck2( $SessionId )
{
global $g_sUser_Name,$g_sUser_Password,$g_fUser_Admin,$g_ sUser_Fullname, $g_sUser_FldAuto;

mysql_query("DELETE FROM admin_session WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(lastused) > 43200");

$sSQL = "select * from admin_session where sessionid='$SessionId' ";
$oRS = mysql_query($sSQL);
if ( ! ($row = mysql_fetch_array($oRS)) )
{
LoginForm();
exit();
}
$fldAuto = $row["sessiondata"];
$sSQL = "select * from user where fldAuto='$fldAuto' ";
$oRS = mysql_query($sSQL);
if ( ! ($row = mysql_fetch_array($oRS)) )
{
LoginForm();
exit();
}
$g_sUser_Name = $username;
if ( $row["admin"] == 1 )
$g_fUser_Admin = true;
$g_sUser_Fullname = $row["fullname"];
$g_sUser_FldAuto = $row["fldAuto"];
}


//User management
function DBUserCheck( $username, $password )
{
global $g_sUser_Name,$g_sUser_Password,$g_fUser_Admin,$g_ sUser_Fullname, $g_sUser_FldAuto, $g_fUser_Admin;
mysql_query("DELETE FROM admin_session WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(lastused) > 43200");

$sSQL = "select * from user where name='$username' ";
$sSQL = $sSQL . " and pwd='$password'";
$oRS = mysql_query($sSQL);
if ( ! ($row = mysql_fetch_array($oRS)) )
{
LoginForm();
exit();
}
$g_sUser_Name = $username;
if ( $row["admin"] == 1 )
$g_fUser_Admin = true;
$g_sUser_Fullname = $row["fullname"];
$g_sUser_FldAuto = $row["fldAuto"];
}

function LoginForm()
{
global $sContent, $sHeader;

$sContent = $sContent. "<b>Login:</b><p>\n";
$sContent = $sContent. "<form action=index.php method=post><input type=hidden name=action value=login>\n";
$sContent = $sContent. "Username: <input type=text name=loginusername size=20><p>\n";
$sContent = $sContent. "Password: <input type=password name=loginuserpassword size=20><p>\n";
$sContent = $sContent. "<input type=submit value=Submit></form><p>\n";
PhpAdMentor_WriteContent( $sHeader, $sContent );
exit();
}

?>
pcmxkeith is offline   Reply With Quote
Old 12-05-2004, 09:09 AM   #6
In Runtime
 
Windwaker222's Avatar
 
Join Date: Nov 2004
Posts: 351
Default Re: php

Quote:
Originally Posted by pcmxkeith
$sSQL = "select * from user where name='$username' ";
$sSQL = $sSQL . " and pwd='$password'";
$oRS = mysql_query($sSQL);
if ( ! ($row = mysql_fetch_array($oRS)) )
im getting the exact same problem but no one replies.

anyway, u could try putting your $sSQL statement all in one :

$sSQL = "select * from user where name='$username' AND pwd='$password' ";
__________________
AMD Phenom 9600 / 4GB OCZ Gold / nVidia 8800GT / ASUS Crosshair 4xPCI-E
Windwaker222 is offline   Reply With Quote
Old 12-05-2004, 09:12 AM   #7
BSOD
 
pcmxkeith's Avatar
 
Join Date: Dec 2004
Posts: 842
Send a message via AIM to pcmxkeith Send a message via MSN to pcmxkeith Send a message via Yahoo to pcmxkeith
Default Re: php

yeah thanks, ill just have to call the my freind hes a programmer. So thanks.
__________________

pcmxkeith is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 06:07 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0