Web Development Questions That Don't Need Their Own Thread v2
3,079 replies, posted
[QUOTE=Pocoyo;30161199]what happens if there are multiple lines after it?[/QUOTE]They aren't considered part of the if statement
[QUOTE=TehWhale;30161352]They aren't considered part of the if statement[/QUOTE]
This is why it's inconsistent because at a glance it could look like part of it when it isn't
[QUOTE=Dorkslayz;30160416]Why dont you stop being so stereotypical? Not all 14 year-olds are idiot's.[/QUOTE]
Saying "idiot's" doesn't help your cause much
[QUOTE=parket;30160169]oh right that's why you like that idiot lucky you're 14[/QUOTE]
I was 14 last year and I would say I wasn't an idiot, but that doesn't really work for web dev. maybe other things. :buddy:
[QUOTE=zzlawlzz;30164312]I was 14 last year and I would say I wasn't an idiot, but that doesn't really work for web dev. maybe other things. :buddy:[/QUOTE]i know some pretty cool 14 year olds (tdoyle)
[QUOTE=TehWhale;30164576]i know some pretty cool 14 year olds (tdoyle)[/QUOTE]
I was 14 almost two years ago
I have an account on lithiumhosting, but I can't find anywhere the information about the address of my database. Where is that?
[QUOTE=TerabyteS;30165086]I have an account on lithiumhosting, but I can't find anywhere the information about the address of my database. Where is that?[/QUOTE]
Wondered the same thing
[QUOTE=TerabyteS;30165086]I have an account on lithiumhosting, but I can't find anywhere the information about the address of my database. Where is that?[/QUOTE]
It's localhost
always localhost
[QUOTE=TerabyteS;30165086]I have an account on lithiumhosting, but I can't find anywhere the information about the address of my database. Where is that?[/QUOTE]
what address? the ip address?
I was thinking about the information to remotely connect to databases on lithium.
-snip- remote.
open a ticket
[QUOTE=alphaspida;30165532]I was thinking about the information to remotely connect to databases on lithium.[/QUOTE]
If they're using cPanel the IP will be on the left hand side somewhere(or you can just ping your site), assuming MySQL is hosted on the same as server.
Then all you need is an account, connect through the IP, port is 3306.
They might have external MySQL connections disabled for security reasons (i.e people purchasing the service simply to run a heavy-load database while keeping their other hosting location free of the load). If they have it disabled, they should be able to enable it on a per-account basis (no idea if cPanel can do this, but I would assume it can).
[QUOTE=Sc00by22;30165748]If they're using cPanel the IP will be on the left hand side somewhere(or you can just ping your site), assuming MySQL is hosted on the same as server.
Then all you need is an account, connect through the IP, port is 3306.[/QUOTE]
it comes out as your shared ip unless ur uisng dedicated ip.
Is it on localhost for pages hosted on the server?
[QUOTE=zzlawlzz;30165873]it comes out as your shared ip unless ur uisng dedicated ip.[/QUOTE]
Still works though.
You can just connect to the domain if you want though, example.com:3306 or other non-default port.
[QUOTE=TerabyteS;30165890]Is it on localhost for pages hosted on the server?[/QUOTE]yes
[QUOTE=TerabyteS;30165890]Is it on localhost for pages hosted on the server?[/QUOTE]
Yes. @damn you TehWhale.
Also, I wouldn't advise people use external MySQL databases except for very few/non-important/slow requests, because it's slow as fuck.
[QUOTE=Pocoyo;30161145]i meant something like
[php]
if ($fp == 'down') echo 'fp is down';
else if ($fp == 'up') echo 'fp is up';
else echo 'not up or down';
[/php]
where {}s are not used, sorry if i didnt phrase my question correctly.[/QUOTE]
You know PHP has this cool thing called documentation you should read it some time
[QUOTE=compwhizii;30167934]You know PHP has this cool thing called documentation you should read it some time[/QUOTE]
Facepunch is quantum physics in forum form. It is neither online nor offline.
Hey Guy,
Recently I've been looking at old libraries I've made and come across something that has stumped me, nearly all my class are tightly coupled to a database class. From what I understand about coupling it's to remove as many dependencies has possible, so I was wounding is it possible to make a database class with near to no dependencies as possible because if the database class brakes or goes missing I'm in the shitter?
[QUOTE=Sc00by22;30165748]If they're using cPanel the IP will be on the left hand side somewhere(or you can just ping your site), assuming MySQL is hosted on the same as server.
Then all you need is an account, connect through the IP, port is 3306.[/QUOTE]
Holy shit it works. I can connect to my databases on my host in my localhost environment.
[QUOTE=JimTools;30169309]Hey Guy,
Recently I've been looking at old libraries I've made and come across something that has stumped me, nearly all my class are tightly coupled to a database class. From what I understand about coupling it's to remove as many dependencies has possible, so I was wounding is it possible to make a database class with near to no dependencies as possible because if the database class brakes or goes missing I'm in the shitter?[/QUOTE]
Usually what you want to do is have a base interface class, which your code works with, and then 'driver' classes that you plug in the back of this interface class at will. When you're dealing with SQL, this means abstracting as much of/all the actual SQL as possible to interface methods.
A rough idea of how you'd do this could be the following:
[php]<?php
class FrontClass
{
private static $driver;
public static function setDriver( $driver )
{
static::$driver = $driver;
}
public static function get($thing)
{
return static::$driver->get($thing);
}
public static function put($thing)
{
return static::$driver->put($thing);
}
}[/php]
So the interface works exactly as that - an interface, and the underlying driver implements the required methods to work with it.
snip-
@StinkyJoe
Ok so your saying that I should sent SQL to the "interface" class which in turn sends it to my database classes which is the back end... Because I pretty your not talking about Interface/Abstract template/classes. but this still have a dependency on The database class I guess now it's more like a core class and just one of the only things your should be dependent on?
[QUOTE=Pocoyo;30161145]i meant something like
[php]
if ($fp == 'down') echo 'fp is down';
else if ($fp == 'up') echo 'fp is up';
else echo 'not up or down';
[/php]
where {}s are not used, sorry if i didnt phrase my question correctly.[/QUOTE]
[php]echo "fp is " . ($fp == "up" : "up" : "down");[/php]
[editline]1st June 2011[/editline]
Wait, what?
[php]echo "fp is " . $fp;[/php]
Snip Wrong Thread
What is the best way to go about this:
I have a website hosted on one server, but I want all my images to be fetched from somewhere else. For example I want a web page to be able to have this inside example.com:
[html]<img src="img/file.png" />[/html]
But for the server to translate that image url to: someothersite.com/img/file.png
I could just write the second site in full but then if I ever want to change it it's a hassle. I could do it easily with php but I was wondering if there is a nicer way, like maybe .htaccess files let you reroute all files inside /img/* to yourdomain.com/img/*
[editline]1st June 2011[/editline]
Hmmm... is it as simple as this in the .htaccess file?
[code]RedirectMatch 301 img/(.*) othersite.com/img//$1[/code]
Sorry, you need to Log In to post a reply to this thread.