Help with MAMP please? Php & mySQL problems

Please use this forum to ask our resident IT geeks advice.
Post Reply
Virt
Posts: 6793
Joined: Wed Dec 12, 2012 12:35 pm
Location: Leicestershire

Help with MAMP please? Php & mySQL problems

Post by Virt »

Anyone have any experience at using MAMP or connecting to a mySQL server with php? I can't get it to work for the life of me, and I've been googling my heart out.

Connection code to the database is ;

Code: Select all

$db = mysql_connect("127.0.0.1:8889","root", "root");

    if (!$db){
        echo "Could not connect to database";
        exit();
    }
    
    $db_name = "SPP Local";
	if (!mysql_select_db($db_name, $db)){
    	die ("Could not select database." . mysql_error());
	}
I don't get any errors saying the database cannot be connected to, but after running a query to stick into the output (as shown below)

Code: Select all

 $json = '{ "class": "go.GraphLinksModel",
  "nodeDataArray": ' .$json  .',
  "linkDataArray": [
{"from":"Products", "to":"Categories"},
{"from":"Products", "to":"Suppliers"},
{"from":"Order Details", "to":"Products"}
 ]}';

		echo $json ;
I get the following output.

{ "class": "go.GraphLinksModel",
"nodeDataArray": [],
"linkDataArray": [
{"from":"Products", "to":"Categories"},
{"from":"Products", "to":"Suppliers"},
{"from":"Order Details", "to":"Products"}
]}

Which means my query isn't returning anything... I've ran the query within the MAMP page and directly on the server and it works fine, I just can't connect to the server remotely and use the results from the query. Anyone have any ideas? My php is limited and it's not my favourite language, by far :lol:
Last edited by Virt on Tue Sep 17, 2013 9:48 am, edited 1 time in total.
Slowly approaching the more bikes than birthdays achievement
tony.mon
Posts: 15943
Joined: Wed Jul 25, 2007 10:46 pm
Location: Norf Kent

Re: Help with MAMP please? Php & mySQL problems

Post by tony.mon »

Have you tried Google Translator?
It's not falling off, it's an upgrade opportunity.
Virt
Posts: 6793
Joined: Wed Dec 12, 2012 12:35 pm
Location: Leicestershire

Re: Help with MAMP please? Php & mySQL problems

Post by Virt »

:lol: :lol:
Slowly approaching the more bikes than birthdays achievement
User avatar
MacV2
Posts: 17418
Joined: Sun Jan 21, 2007 12:07 pm
Location: Grain

Re: Help with MAMP please? Php & mySQL problems

Post by MacV2 »

Have you tried INTGAL or the shorter version GAL 0.2 ?
Making up since 2007, sometimes it's true...Honest...
User avatar
VTRDark
Posts: 20010
Joined: Sun Mar 18, 2012 9:24 pm

Re: Help with MAMP please? Php & mySQL problems

Post by VTRDark »

Tried it once as I wanted to work locally but never got on with it. :thumbdown:

(:-})
==============================Enter the Darkside
Virt
Posts: 6793
Joined: Wed Dec 12, 2012 12:35 pm
Location: Leicestershire

Re: Help with MAMP please? Php & mySQL problems

Post by Virt »

MacV2 wrote:Have you tried INTGAL or the shorter version GAL 0.2 ?
I have no idea what you're talking about. :lol:
cybercarl wrote:Tried it once as I wanted to work locally but never got on with it. :thumbdown:

(:-})
Yeah, I'm not getting on brilliantly with it. But I have no choice :lol:

I've fixed that part, some stupid settings within MAMP didn't allow access from php files.. Pissed me off to no end because why the hell else would I want a database on my local server?! Idiots :(

Now I'm just having problems with another query.. That's returning the query as a result. And then the expected result. Why is this happening to meeee? :( :lol: :lol:

Image
Image

Image
Slowly approaching the more bikes than birthdays achievement
User avatar
MacV2
Posts: 17418
Joined: Sun Jan 21, 2007 12:07 pm
Location: Grain

Re: Help with MAMP please? Php & mySQL problems

Post by MacV2 »

Virt wrote:
MacV2 wrote:Have you tried INTGAL or the shorter version GAL 0.2 ?
I have no idea what you're talking about. :lol: INTGAL...I Need To Get A Life...Get A Life 0.2 :lol:
cybercarl wrote:Tried it once as I wanted to work locally but never got on with it. :thumbdown:

(:-})
Yeah, I'm not getting on brilliantly with it. But I have no choice :lol:

I've fixed that part, some stupid settings within MAMP didn't allow access from php files.. Pissed me off to no end because why the hell else would I want a database on my local server?! Idiots :(

Now I'm just having problems with another query.. That's returning the query as a result. And then the expected result. Why is this happening to meeee? :( :lol: :lol:
Everything else you have written may as well have been written in Mongolian...I cant understand that either... I'm OK-ish with Onglish like what I was tawt as a children... :lol:
Making up since 2007, sometimes it's true...Honest...
Virt
Posts: 6793
Joined: Wed Dec 12, 2012 12:35 pm
Location: Leicestershire

Re: Help with MAMP please? Php & mySQL problems

Post by Virt »

MacV2 wrote:
INTGAL...I Need To Get A Life...Get A Life 0.2 :lol:
Everything else you have written may as well have been written in Mongolian...I cant understand that either... I'm OK-ish with Onglish like what I was tawt as a children... :lol:
Only version 0.2? It's not even on full release yet, I'll wait until the bugs are patched :thumbup: :lol:

Okay then, in English;

My code doesn't work. I'm going to go cry in a corner.

Better?
Slowly approaching the more bikes than birthdays achievement
User avatar
VTRDark
Posts: 20010
Joined: Sun Mar 18, 2012 9:24 pm

Re: Help with MAMP please? Php & mySQL problems

Post by VTRDark »

This is the problem with the computer industry, sometimes to achieve something or make it easier to work with one has to go off on a tangent and learn something else to achieve whatever it is. Does that make sense :think: It just overcomplicates things. One ends up spending more time learning than being productive and then once you have learnt it the industry changes things again and the whole process starts again.

There's nothing worse than spending a few years learning something for it all to be made irrelevant a few years down the line. Feels like a total waste of time and is disheartening. For example take the old table based web design, one masters that and then they brought out CSS and the whole learning process starts again. Oh and then chuck Jquery in for good measure :lol: So it's like getting to the top and then being kicked back down to the bottom. The industry is not like learning something less academic, a more hands on trade like Building or Driving where any upgrades or changes are based on what was previously learnt and changes are not made on a such a quick basis. The complete thing changes where anything previously learnt is scrapped/wasted. :(

The only other option is to let someone else do all the hard work and use templates or web based stuff where your constrained to the way they want things to go and everything looks the same with no real creative input. 9 times out of ten this does not work as well, is not compliant with industry standards, and comes at a cost. It also makes things easier for joe bloggs member of the public to do things for themselves taking business away from the pro's. Who needs to employ a graphic designer these days when you can just get an app on your phone or whatever to do it for you with the push of a button with no real learning curve. It kills the quality and creative input. It's a bit like exams, and comparing an A level today compared to an A level 30 years ago.

Sorry I went off on a bit of a rant there. It just pisses me off and I have grown to really dislike the industry.

I tried MAMP because I was working wth PHP based web stuff and wanted to see what the layout looked like while working locally without having to upload to a live server to check things. In the end I gave up and went back to using straight HTML/XHTML

(:-})
==============================Enter the Darkside
Virt
Posts: 6793
Joined: Wed Dec 12, 2012 12:35 pm
Location: Leicestershire

Re: Help with MAMP please? Php & mySQL problems

Post by Virt »

cybercarl wrote:This is the problem with the computer industry, sometimes to achieve something or make it easier to work with one has to go off on a tangent and learn something else to achieve whatever it is. Does that make sense :think: It just overcomplicates things. One ends up spending more time learning than being productive and then once you have learnt it the industry changes things again and the whole process starts again.
Yep. We're using an MVC (Model-View-Controller) framework. I learnt MVC using Microsoft Razor, we're doing this in PHP. Saddens me, because PHP reminds me of Perl. And Perl is my favourite least-favourite language :lol: But I agree completely, there is no industry standard for any long period of time (except Javascript it seems. But don't get me started on that). Everyone used to use ASP.NET but then that kinda... died :lol: Quite badly too.

cybercarl wrote:There's nothing worse than spending a few years learning something for it all to be made irrelevant a few years down the line. Feels like a total waste of time and is disheartening. For example take the old table based web design, one masters that and then they brought out CSS and the whole learning process starts again. Oh and then chuck Jquery in for good measure :lol: So it's like getting to the top and then being kicked back down to the bottom. The industry is not like learning something less academic, a more hands on trade like Building or Driving where any upgrades or changes are based on what was previously learnt and changes are not made on a such a quick basis. The complete thing changes where anything previously learnt is scrapped/wasted. :(
Yep. Referring, once again to the WONDERFUL, Perl. Perl 5 and Perl 6 are so different to use. I can use 5, but every time I try to use 6 I just die because nothing works. It's madness, and that's just the wanting to use Perl part. At work we use VB6, language is almost as old as me. My first language was VB.Net using the .Net 3.0 (I think?) framework. Back tracking through these versions and finding out how things change is horrifying at times, so many things change willy-nilly and it really catches me out if I'm not paying attention. I've had all sorts of funny bugs as a result of this. :lol:
cybercarl wrote:The only other option is to let someone else do all the hard work and use templates or web based stuff where your constrained to the way they want things to go and everything looks the same with no real creative input. 9 times out of ten this does not work as well, is not compliant with industry standards, and comes at a cost. It also makes things easier for joe bloggs member of the public to do things for themselves taking business away from the pro's. Who needs to employ a graphic designer these days when you can just get an app on your phone or whatever to do it for you with the push of a button with no real learning curve. It kills the quality and creative input. It's a bit like exams, And comparing an A level today compared to an A level 30 years ago.
// No comments to add
cybercarl wrote: Sorry I went off on a bit of a rant there. It just pisses me off and I have grown to really dislike the industry.

I tried MAMP because I was working wth PHP based web stuff and wanted to see what the layout looked like while working locally without having to upload to a live server to check things. In the end I gave up and went back to using straight HTML/XHTML

(:-})
I still prefer HTML/XHTML and using the Razor MVC engine to provide me with CSHTML. I hate this PHP sh1t. Even worse as we have no IDE for it, so mistakes do go unnoticed and they really piss me off. The problem with languages that use Scalar variables is it feels so much harder to control the flow of the program, and unless you have the Hungarian naming convention (which is now looked down upon) you don't know what that variable may or may not contain.

I love the industry as much as I hate it, the industry is decent. It's just the people who have an effect on the industry that are b8stard. And technology. I hate technology. :lol:
Slowly approaching the more bikes than birthdays achievement
User avatar
VTRDark
Posts: 20010
Joined: Sun Mar 18, 2012 9:24 pm

Re: Help with MAMP please? Php & mySQL problems

Post by VTRDark »

love the industry as much as I hate it, the industry is decent. It's just the people who have an effect on the industry that are b8stard. And technology. I hate technology
Yep that kinda of makes sense. And it's ironic that one that works in the industry also hates it. It a love hate relationship. :lol:

As for the people having an effect yes your right as the companies will just make things that sell whether it's the right or wrong way to go about things. A couple of weeks back a friend of mine had to throw out a perfectly good working eMac, you couldn't give it away as it is now redundant and worth sh1t even though it cost a small fortune back in the day. What a waste....it will end up on either a landfill or on a beach somewhere in India or something for the scavengers to pick parts off or whatever. Or maybe the Hard Drive data is useful for the scammers :roll: NOT.... I zeroed it! It may as well be turned into a MacAquarium.

She could have kept it just for the Internet and as a basic office machine and it would have been perfectly fine for that except for the use of Flash. Flash can longer be updated to the later version on older machines so the industry forces one to spend their money and upgrade their machines. It would not be so bad if web designers done their job properly and catered for those with disabilities or using older machines. Websites should be backwards compatible, but people are lazy or want a faster turnover to make money and it means more work/coding.

It really pisses me off when a site requires the latest technology to work properly. Why people even use Flash for web design in the first place is wrong, it's not what it was designed for. It was made by Macromedia as an animation software not for web design. It's just that people started to find a work around to use it as a web design tool even though it's not accessible to everyone and leaves back doors into ones machine for hackers/scammers. Macromedia and even more so Adobe when they purchased it from Macromedia started bending it towards a web design tool. Hence the people having an effect on the industry and the industry run on greed and making money out of the people.

On that note Flash is now dying , being deprecated on the web accept for being used for the odd advertisement banners and video. Hello HTML5.... bring it on. :lol: All those poor b8stard that have uploaded loads of video to online resource's like Youtube or whatever will eventually have to re-encode all their footage to work within a HTML5 Player. Not to mention being able to use it on Tablets, phones or whatever is next.

(:-})
==============================Enter the Darkside
Virt
Posts: 6793
Joined: Wed Dec 12, 2012 12:35 pm
Location: Leicestershire

Re: Help with MAMP please? Php & mySQL problems

Post by Virt »

Eh, it's a difficult industry to love. Customers/Clients are asshats. Constantly trying to break my code despite the fact I have outlined, in several places, what can and cannot be done. I'm constantly improving stuff but they need to give me time damnit :lol: I have a social life (it's called this forum).

The one that annoys me the most currently is Microsoft TFS. You need Visual Studio 2012 to use it, so everyone can work on the code at the same time. We tried upgrading VB6 to VB.NET 2008 as a starting point, so we could slowly get it ready for multi-user coding but the auto-upgrader Microsoft provided finished with more errors than I ever want to deal with in my life. (i'll edit this post with the picture proof once I get home)

Image

It's about what makes design easier for the developer these days I guess. Who cares about anyone else? The amount of programs I've gone through, as an example, using single letter variable names is pointless. It makes it easier for the developer because they don't have to think of a meaningful name, but if they come back to it after a few weeks or another developer (usually me) takes a look at it then it just makes them want to murder the original developer. Same thing applies to Flash web developers, they don't care about the users or anyone else. :thumbdown:

Either way, we love HTML5 :wink:


EDIT : On the plus side I've finally sorted out all of my problems, YAY! And now I've been given another set. I hate being a developer sometimes :lol: :lol: Especially with this one being Javascript based. I don't mean to belittle the people who created Js. But if you're language requires several 'extensions' from third-parties before it's even considered useable for client-side scripting then I don't think you've made a very good language.. :(
Slowly approaching the more bikes than birthdays achievement
Virt
Posts: 6793
Joined: Wed Dec 12, 2012 12:35 pm
Location: Leicestershire

Re: Help with MAMP please? Php & mySQL problems

Post by Virt »

Carl, you said you worked with PHP before on MAMP. Are you any good at PHP? I've got a massive memory leak in my code and I can't find it, my php knowledge isn't brilliant :lol: :oops:
Slowly approaching the more bikes than birthdays achievement
User avatar
VTRDark
Posts: 20010
Joined: Sun Mar 18, 2012 9:24 pm

Re: Help with MAMP please? Php & mySQL problems

Post by VTRDark »

Are you any good at PHP?
Sorry Virt, no I'm useless, it was just for formail scripts. Not even my code but sometimes things need dissecting and customising a little with the help of the web and a little research.

(:-})
==============================Enter the Darkside
Virt
Posts: 6793
Joined: Wed Dec 12, 2012 12:35 pm
Location: Leicestershire

Re: Help with MAMP please? Php & mySQL problems

Post by Virt »

cybercarl wrote:
Are you any good at PHP?
Sorry Virt, no I'm useless, it was just for formail scripts. Not even my code but sometimes things need dissecting and customising a little with the help of the web and a little research.

(:-})
Oh okay, I've fixed it now anyway. Finally got the correct results from this script for the first time (it's taken me since Friday :lol:) Thanks anyway. I feel like a god for getting this right :lol: wombles php
Slowly approaching the more bikes than birthdays achievement
Post Reply