Author Topic: RAWK Web Development Circle  (Read 120073 times)

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #400 on: May 17, 2012, 10:21:56 pm »
I'll just replicate it locally and mess around until I fix it again.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #401 on: May 17, 2012, 10:25:09 pm »
I'll just replicate it locally and mess around until I fix it again.

You want me to PM you it again mate?

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #402 on: May 17, 2012, 10:30:08 pm »
Yeah probably for the best mate, I've just tried to run the update and it's worked for me so chuck me what you've got and I'll try to fix it for you.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #403 on: May 17, 2012, 10:34:25 pm »
Yeah probably for the best mate, I've just tried to run the update and it's worked for me so chuck me what you've got and I'll try to fix it for you.

Done mate

Offline smithy

  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,011
Re: RAWK Web Development Circle
« Reply #404 on: May 17, 2012, 11:02:49 pm »
$query="UPDATE admin SET adm_username='".$admin_username."', adm_password='".$adm_password."', adm_firstname='".$admin_firstname."', adm_surname='".$admin_surname."' WHERE adm_id='".$admin_id."'";

Try that^^

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #405 on: May 17, 2012, 11:07:57 pm »
$query="UPDATE admin SET adm_username='".$admin_username."', adm_password='".$adm_password."', adm_firstname='".$admin_firstname."', adm_surname='".$admin_surname."' WHERE adm_id='".$admin_id."'";

Try that^^

no errors with syntax and goes through however when I view the entity in question again data is not updated.

Thanks as always :)

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #406 on: May 17, 2012, 11:10:08 pm »
As far as I can see, it's a problem with your retrieval of the values that populate the variables. The query runs fine, and if you paste in a URL like this...

http://server/page.php?admin_username=haha&admin_password=haha&admin_firstname=haha&admin_lastname=haha&adm_id=1

That should confirm it.

Just a case of making sure, however the values are passed, that they are getting through. Comment out the majority of the code and echo the values of $_GET['admin_password'] etc etc to make sure the values are being retrieved correctly.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #407 on: May 17, 2012, 11:16:23 pm »
As far as I can see, it's a problem with your retrieval of the values that populate the variables. The query runs fine, and if you paste in a URL like this...

http://server/page.php?admin_username=haha&admin_password=haha&admin_firstname=haha&admin_lastname=haha&adm_id=1

That should confirm it.

Just a case of making sure, however the values are passed, that they are getting through. Comment out the majority of the code and echo the values of $_GET['admin_password'] etc etc to make sure the values are being retrieved correctly.

Right ok, URL is passing information through fine and values are being retrieved correctly because they are echoed on screen

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #408 on: May 17, 2012, 11:20:19 pm »
Have you done the echoing whilst using a URL as above? That will work because that is definitely populating the $_GET values correctly, that URL was just an example to show you that the query works as it should. Try just submitting the form normally with the echos in the code.

You'll have a form, prior to this one, (the one we worked on earlier?) which sends the data to the current page we're working on. Somewhere between sending the data from that page to the current one, the values are being lost/not populated correctly.

Offline smithy

  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,011
Re: RAWK Web Development Circle
« Reply #409 on: May 17, 2012, 11:20:23 pm »
Only thing I can see from here is that the variable $adm_password is inconsistent to the others which all start $admin_....

Possibly confused with the header name in mysql?

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #410 on: May 17, 2012, 11:30:38 pm »
Checked the form values on last page there correct and method is set to GET on both the form and process page for now.

updateadminprocesssuccess.php?admin_username=jcorry&admin_firstname=Jay&admin_lastname=Corry&admin_password=password&Update=Update

That's my URL output

and I've correct the variable adm password to admin password for consistency

still nothing on UPDATED SQL though looking at the UPDATED sql statement the variable names are lighting up in a different colour to SQL statement if that makes sense  E.g. SET adm_username='" is blue
.
$admin_username."' is different colour
« Last Edit: May 17, 2012, 11:34:15 pm by JLFC »

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #411 on: May 17, 2012, 11:32:40 pm »
That doesn't seem to have an ID in, which means the update query doesn't know which record to update, as the where clause is based on the ID.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #412 on: May 17, 2012, 11:38:16 pm »
That doesn't seem to have an ID in, which means the update query doesn't know which record to update, as the where clause is based on the ID.

I know what I've done I've not created a attribute for the ID in the form...Stupid mistakes I shouldn't be making these schoolboy errors. Cheers lads!


Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #413 on: May 17, 2012, 11:41:12 pm »
Yeah just a hidden form value to be passed to the update page at the time of submitting the form will do it, just so the value of the record to be updated makes its way to the update query.

Like you said, you've been looking at this for hours, it's easy to not notice something small like that. You just need to step away for a bit (or ask someone with fresh eyes to have a look) and it'll become clear quite quickly. Just wish my interview questions had been this kinda thing ha.

Can I ask what this is for? Is it work related or an assignment type thing?

Offline smithy

  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,011
Re: RAWK Web Development Circle
« Reply #414 on: May 17, 2012, 11:43:20 pm »
I know what I've done I've not created a attribute for the ID in the form...Stupid mistakes I shouldn't be making these schoolboy errors. Cheers lads!

;D  :butt Glad you solved it. Not sure I was much help! Back to coding my blatant copy of mafiadeath now!

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #415 on: May 17, 2012, 11:45:09 pm »
Mafiadeath lol?

And in response to AJ its just for a hobby mate

Offline smithy

  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,011
Re: RAWK Web Development Circle
« Reply #416 on: May 17, 2012, 11:54:55 pm »
http://www.redandwhitekop.com/forum/index.php?topic=201669.0

Browser based mafia game. Was better a few years back when we had around 40 off here on it. Down to 4 or 5 regulars now.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #417 on: May 18, 2012, 12:02:29 am »
http://www.redandwhitekop.com/forum/index.php?topic=201669.0

Browser based mafia game. Was better a few years back when we had around 40 off here on it. Down to 4 or 5 regulars now.

Looks very addictive just researching how to populate dynamic drop down lists in php and MySQL  :)

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #418 on: May 18, 2012, 12:10:22 am »
You probably don't want to hear this now, given I imagine all your queries are done the same way, but you need to be wary of allowing user input straight in to SQL queries, as this is exactly how SQL injection attacks take place.

The process I'm most familiar with - though there are others - is parametrised queries, which utilise placeholders within the query, meaning that the user input isn't built straight in to the query.

Have a look here: http://us.php.net/manual/en/mysqli.prepare.php

Offline smithy

  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,011
Re: RAWK Web Development Circle
« Reply #419 on: May 18, 2012, 12:10:52 am »
A problem I have in my PHP is that I usually store user information in $_SESSION['user'] and then echo it in the header. I also usually write module based sites which call the module from a get variable. The problem is that when I need to update a session variable from a post it doesn't refresh the session variable echoed in the header until I refresh the page. Ideally I'd like the session variable to update in the header as soon as post is clicked and the table is updated. I don't want to directly link the header to the module.

Any thoughts on this?

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #420 on: May 18, 2012, 12:21:08 am »
You probably don't want to hear this now, given I imagine all your queries are done the same way, but you need to be wary of allowing user input straight in to SQL queries, as this is exactly how SQL injection attacks take place.

The process I'm most familiar with - though there are others - is parametrised queries, which utilise placeholders within the query, meaning that the user input isn't built straight in to the query.

Have a look here: http://us.php.net/manual/en/mysqli.prepare.php

I've seen a lot about prepared statements mate and have taken precautions for SQL attacks already. However this would be another form of security that I could implement at a later stage.

To be honest with you mate your knowledge of php sounds a bit advanced for my level just yet but I will get there. Im using $_SESSION variables at the moment which are global and replace the session_registrar methods correct?

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #421 on: May 18, 2012, 12:30:02 am »
I'd say you're completely wrong in saying my PHP knowledge is more than yours. I've never really programmed anything in PHP, that's just a sort-of general rule that applies to any language in which database queries are done.

I've got no idea about session variables because the only large-scale application I've written used active directory for user-validation so didn't require the use of sessions.

I am looking to advance in PHP ASAP really, because there a lot of jobs out there for PHP developers, I just need find something that I can use as a subject for my learning.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #422 on: May 18, 2012, 04:01:33 pm »
I'd say you're completely wrong in saying my PHP knowledge is more than yours. I've never really programmed anything in PHP, that's just a sort-of general rule that applies to any language in which database queries are done.

I've got no idea about session variables because the only large-scale application I've written used active directory for user-validation so didn't require the use of sessions.

I am looking to advance in PHP ASAP really, because there a lot of jobs out there for PHP developers, I just need find something that I can use as a subject for my learning.

Use http://php.net/ to gain further understanding in PHP

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #423 on: May 18, 2012, 04:16:49 pm »
My need to develop my PHP skills has sort of diminished, because I got the job that I was telling you about yesterday ;D. I'll still do bits of it in my spare time I imagine, but I'll have to become a fully-fledged .NET head now.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #424 on: May 18, 2012, 04:24:40 pm »
My need to develop my PHP skills has sort of diminished, because I got the job that I was telling you about yesterday ;D. I'll still do bits of it in my spare time I imagine, but I'll have to become a fully-fledged .NET head now.

Congratulations mate all the very best with that!

Offline smithy

  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,011
Re: RAWK Web Development Circle
« Reply #425 on: May 18, 2012, 09:15:26 pm »
You figure out the JS problem? ;D

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #426 on: May 18, 2012, 09:40:41 pm »
Yer it was getting confused on the document.formname for two different form variables in one function. Now I've put one of them into another file they're both happy ;D

Offline wacko

  • Keepsh a shecret gottle of Shcotch in hish top drawer. Cunning linguist and ical genius
  • Legacy Fan
  • ******
  • Posts: 5,205
Re: RAWK Web Development Circle
« Reply #427 on: May 24, 2012, 09:38:03 pm »
A problem I have in my PHP is that I usually store user information in $_SESSION['user'] and then echo it in the header. I also usually write module based sites which call the module from a get variable. The problem is that when I need to update a session variable from a post it doesn't refresh the session variable echoed in the header until I refresh the page. Ideally I'd like the session variable to update in the header as soon as post is clicked and the table is updated. I don't want to directly link the header to the module.

Any thoughts on this?

What do you mean by "header"? The header of the body of the HTML page? In that case, you have to use JavaScript.
Quidquid latine dictum sit, altum sonatur.

Offline smithy

  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,011
Re: RAWK Web Development Circle
« Reply #428 on: May 24, 2012, 11:04:29 pm »
What do you mean by "header"? The header of the body of the HTML page? In that case, you have to use JavaScript.
Yeah figured that. Just wondered if anyone had a cleaner way of doing it. Was thinking along the lines of
Code: [Select]
if(isset($_POST['whatever'])) {echo $_POST['whatever'];} else {echo $_SESSION['user']['whatever'];}

but maybe in a function so I don't need to do this for every session variable in the header (in the body).

Offline wacko

  • Keepsh a shecret gottle of Shcotch in hish top drawer. Cunning linguist and ical genius
  • Legacy Fan
  • ******
  • Posts: 5,205
Re: RAWK Web Development Circle
« Reply #429 on: May 27, 2012, 06:38:05 am »
If you're just repopulating form fields in the HTML, you don't need to check if the variables are set; just echo them straight into the attribute value or tag:

Code: [Select]
<input type="text" value="<?=$_POST['username']?>" name="username"/>
Quidquid latine dictum sit, altum sonatur.

Offline choi

  • of sex.
  • Legacy Fan
  • ******
  • Posts: 5,782
  • Toto
Re: RAWK Web Development Circle
« Reply #430 on: June 1, 2012, 01:25:41 am »
Okay, decided to get into this for a little home project during summer. Done standard object oriented programming (Java, C) in my uni courses but now i wanna try and build a football statistics website. At the moment i'm using a Java program i wrote which produces HTML that i upload to a wordpress based site (http://www.adamchoi.co.uk). Apart from expanding the statistics available i want to be able to run querys etc. Aside from PHP and MySQL what do you think i'll need? Also any pointers to any recommended books? Cheers lads.

Offline Claire.

  • RAWK Staff.
  • Legacy Fan
  • ******
  • Posts: 21,864
Re: RAWK Web Development Circle
« Reply #431 on: June 1, 2012, 10:10:23 am »
My need to develop my PHP skills has sort of diminished, because I got the job that I was telling you about yesterday ;D. I'll still do bits of it in my spare time I imagine, but I'll have to become a fully-fledged .NET head now.

Congrats mate, and all the devs I've ever worked with reckon PHP is for kids and people who can't code, so it might be for the best! :P

Offline SP

  • Thor ain't got shit on this dude! Alpheus. SPoogle. The Equusfluminis Of RAWK. Straight in at the deep end with a tube of Vagisil. Needs to get a half-life. Needs a damned good de-frag.
  • RAWK Staff.
  • Legacy Fan
  • ******
  • Posts: 36,042
  • .
  • Super Title: Southern Pansy
Re: RAWK Web Development Circle
« Reply #432 on: June 1, 2012, 01:09:26 pm »
Congrats mate, and all the devs I've ever worked with reckon PHP is for kids and people who can't code, so it might be for the best! :P

PHP is a proper language, but suffers from VB-itis. It does nothing to make you write proper code, so you get people writing code vomit. If you can code, PHP has lots of nice possibilities. If you can't code, be very careful about whose code you learn from, because there is some really god-awful PHP out there.

Offline WorldChampions

  • Charlie uniform november tango fan...
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 23,621
Re: RAWK Web Development Circle
« Reply #433 on: June 6, 2012, 10:50:41 pm »
Speaking of VB-itis...I have just switched from C# to VB for a project I'm working on. I find C# so much more readable, maybe it's because I have worked in C# and C++ before but no semicolons seems wrong!!

Offline Degs

  • sy's midnight runners.
  • Legacy Fan
  • ******
  • Posts: 13,444
Re: RAWK Web Development Circle
« Reply #434 on: June 7, 2012, 10:13:28 am »
Whatever you can do wrong in VB you can also do in C#

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #435 on: July 8, 2012, 09:09:25 pm »
Right, this is probably noddy stuff, but I haven't done it before and I'm struggling to find anything helpful.

I'm trying to set up an SMTP server locally so I can test some PHP stuff I've been doing before uploading it. I've downloaded Pegasus and got it set up correctly for sending email but I'm not sure how to get it linked to PHP via php.ini.

Any advice would be great. Ta.

Edit: Nevermind, got something called smtp4dev working now. Cheers.
« Last Edit: July 8, 2012, 09:46:04 pm by AJ »

Offline Claire.

  • RAWK Staff.
  • Legacy Fan
  • ******
  • Posts: 21,864
Re: RAWK Web Development Circle
« Reply #436 on: July 9, 2012, 09:11:54 am »
Not web, but didn't wanna ask in the general iOS threads. So, yeah, does anyone develop iOS apps?

I'm learning and looking out for good resources, the apple one is good but it's a bit 'dry' for noobs like me. Done some tutorials on there and now I have a basic understanding of XCode (as in, the app and how to use it) and a very basic understanding of the makeup of an app. Plan to work through the rest of their tutorials and do lots of reading and experimenting, but if anyone has any good resources to share that'd be aces :wave

Offline SP

  • Thor ain't got shit on this dude! Alpheus. SPoogle. The Equusfluminis Of RAWK. Straight in at the deep end with a tube of Vagisil. Needs to get a half-life. Needs a damned good de-frag.
  • RAWK Staff.
  • Legacy Fan
  • ******
  • Posts: 36,042
  • .
  • Super Title: Southern Pansy
Re: RAWK Web Development Circle
« Reply #437 on: July 9, 2012, 09:24:46 am »
Not web, but didn't wanna ask in the general iOS threads. So, yeah, does anyone develop iOS apps?

I'm learning and looking out for good resources, the apple one is good but it's a bit 'dry' for noobs like me. Done some tutorials on there and now I have a basic understanding of XCode (as in, the app and how to use it) and a very basic understanding of the makeup of an app. Plan to work through the rest of their tutorials and do lots of reading and experimenting, but if anyone has any good resources to share that'd be aces :wave

Not what you asked for, but take a look at phonegap. http://phonegap.com/

It's a nice way of deploying HTML 5 as an App. It's a nice route for a web developer to deploy apps with minimal learning curve - and it does lots of lovely cross platform stuff. Of course, the learning curve may be the whole point, in which case, as you were.

The other cross platform route that may be of interest if Flex, but the end app may be a little heavy for your needs.

Offline Claire.

  • RAWK Staff.
  • Legacy Fan
  • ******
  • Posts: 21,864
Re: RAWK Web Development Circle
« Reply #438 on: July 9, 2012, 09:30:11 am »
Deffo wanting the learning curve, SP, have something specific in mind that I want to do and I like the challenge of it :)

Liking this one: http://designthencode.com/scratch/
« Last Edit: July 9, 2012, 05:31:12 pm by Claire. »

Offline Slick_Beef

  • RAWK's Master Baker
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 9,088
Re: RAWK Web Development Circle
« Reply #439 on: September 17, 2012, 06:03:20 pm »
bump. I've spent the summer learning how to develop java web apps (I'm using jsf + glassfish server) and have developed an information management system. What I need next is a nice low latency way to do server-side push (i.e. not using ajax polling from the client) but there seems to be a lot of new technologies floating about (websockets, sse, comet, atmosphere) with varying levels of compatibility and documentation. I'm feeling a little lost... if anyone has any experience with these technologies i'd be interested to here your thoughts on how well it works.