yes i will learn but cant we all make this now to work better and i will learn on something else :P
@Acnathon
not sure. but ajax is prettier tho =p
Okay thx ;) ill try it and post if i get it work ^^
Edit:
Just tryed with this method:
1. Made the class with your example changed to connect via mssql_pconnect.
2. Included the file in my index.php and caled the class by:PHP Code:class database
{
public static $connected = false;
static function connect_db()
{
if(!self::$connected)
{
$link = mssql_pconnect('127.0.0.1', 'sa','mypassword');
if($link)
self::$connected = true;
}
echo self::$connected;
}
}
class use_db extends database
{
function __construct()
{
if(!parent::$connected)
{
echo "database not connected, connecting...";
parent::connect_db();
echo "database methods";
}
else
{
echo "database connected, methods here";
}
}
}
It works on the index but if i call in another page with ajax it cant connect. so i need to include the file (with the class) in all my subpages (that needs sql connection).PHP Code:$connect = new use_db;
Correct me if im wrong or missing something. ><
Last edited by Acnathon; 20-11-11 at 02:45 AM.
just include the class database and inherit it in your the class that will execute sql queries. you can actually remove the if case, since everytime it will be triggered.
I was mixing C# with PHP when I did this.
Every time your script ends, its like everything is flushered, if you execute your page again, it'll be like you're executing it for the very first time.
Just the persistent connection will solve your problem of connecting everytime to the database.
this example I gave about inheritance is for those who want to start programmimg with php.
Class inheritance and POO are very cool feature which will make database connections very easy with a friendly interface.
This class example I gave, its not to be used with this site. Its just an example of how I would make a script to connect to the database.
Okay. got it :) and yesss! me i want to learn phpso thanks for the info.
I have a quick question.How can we make when adding an banner and we insert no link for the banner make it unclickable?
Quick answer for quick question: (although I didnt understand what you want)
Let me google that for you
I'm not liking your behavior here. I suggest you to start doing thins on your own.
using google will not kill you. I've seen here that you like things ready in your hands.. You wont get'em from me.
Ye i know i am a lazy ars :P/I was talking about the thing that when you add a banner and you dont give him a link when you click the banner in the site it opens the site again.I want to make the banner unclickable if i dont add a link when i add the banner.What you shown me on google its easy.That i would had done if it was.
Thanks for the palmface :)
an image is only clickable if you put it inside a <a href> tag.
It could be easily done setting the onclick event to execute a void(0); command.
Search in index.php this:
and change it to this:PHP Code:<div class="jqb_slides">
<div class="jqb_slide" title="'.$rbanner['TituloBan'].'" >
<a href="'.$rbanner['LinkBan'].'" target="_blank">
<img src="'.$rbanner['ImgBan'].'" height="179" width="522"/>
</a>
</div>
This will completely remove link function from the slider.PHP Code:<div class="jqb_slides">
<div class="jqb_slide" title="'.$rbanner['TituloBan'].'" >
<img src="'.$rbanner['ImgBan'].'" height="179" width="522"/>
</div>
i have more 3 errors in usercp.
i will try to fix them asap ,but sure if some1 solved already them ill be glad to hear how ?tyWarning: mssql_query() [function.mssql-query]: message: Invalid object name 'CabalCash.dbo.Bank'. (severity 16) in C:\xampp\htdocs\cabalonline\sisGeral.php on line 123
Warning: mssql_query() [function.mssql-query]: Query failed in C:\xampp\htdocs\cabalonline\sisGeral.php on line 123
Warning: mssql_fetch_row(): supplied argument is not a valid MS SQL-result resource in C:\xampp\htdocs\cabalonline\sisGeral.php on line 124
Last edited by Yamachi; 21-11-11 at 10:23 PM.
Edit: I didnt checked enough close for first time. So theres a missconfiguration in your config file.
That db should be CashShop.
I think on your config the DB_CSH is defined as CabalCash instead of CashShop.PHP Code:define('DB_CCA','CABALCASH');
define('DB_CSH','CASHSHOP');
![]()
Last edited by Yamachi; 24-11-11 at 06:16 PM.
$ck_cash = mssql_query("SELECT Alz FROM ".DB_csh.".dbo.Bank WHERE UserNum='".$IdxAcc."'");
to replace DB_CSH with ?
thanks in advice
EDIT : I CHANGED AS YOU SAID AND STILL THE SAME ERROR ,look :
Warning: mssql_query() [function.mssql-query]: message: Invalid object name 'CASHSHOP.dbo.Bank'. (severity 16) in C:\xampp\htdocs\cabalonline\sisGeral.php on line 123