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

Offline damian

  • Gregory Peck's scared of me. So is cling film. Too inept to swallow a tiddly (wink) ;) Likes the idea of straps.
  • Legacy Fan
  • ******
  • Posts: 4,948
Re: RAWK Web Development Circle
« Reply #360 on: November 10, 2011, 05:59:41 pm »
I have used (1=1) on a production system - but it was building SQL filters on the fly - it meant AND was always valid to append to the relevant query. And negated the need to parse the base query which on this system was messy and would have been time consuming and unreliable. 

To be fair most times I've seen it its a similar thing, but there are occasions where its not actually a dynamic sql statement, its just .net code.

The curse of cut and paste coding. Some developers need to have their cut and paste keys disabled. It would probably increase productivity and code clarity.

Indeed. I think thats what happened with the huge if else block mentioned above, there were probably a couple of conditions to start with, another had to be bolted on later so copy/paste, then another had to be added, and soon it just got out of hand.


I shouldn't really go on too much about it anyway after my failure a couple of days ago. Spent a good 2 hours trying to fix a "error converting varchar to datetime" sql error. Tried passing the date in the usual format I use (yyyy-mm-dd hh:mm:ss), wouldn't accept it, tried UK format, wouldn't accept it, tried US format, wouldn't accept it, tried first format above but with T before hh, which is international standard, still wouldn't work. Getting increasingly frustrated, I then realised I'd mixed 2 fields up, and was actually trying to put a string into a datetime field.
« Last Edit: November 10, 2011, 06:01:35 pm by damian »
RIP 97 - You'll Never Be Forgotten, You'll Never Walk Alone.

JUSTICE FOR THE 97 - Don't Buy The S*n

Offline Chakan

  • Chaka Chaka.....is in love with Aristotle but only for votes. The proud owner of some very private piles and an inflatable harem! Winner of RAWK's Carabao Cup captian contest.
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 91,079
  • Internet Terrorist lvl VI
Re: RAWK Web Development Circle
« Reply #361 on: November 10, 2011, 06:06:51 pm »
I have used (1=1) on a production system - but it was building SQL filters on the fly - it meant AND was always valid to append to the relevant query. And negated the need to parse the base query which on this system was messy and would have been time consuming and unreliable. 

I've seen it used before, but generally not more than once if anywhere in a program.

Offline redbyrdz

  • No to sub-optimal passing! Not content with one century, this girl does two together. Oh, and FUCK THE TORIES deh-deh-deh-deh!
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 24,263
Re: RAWK Web Development Circle
« Reply #362 on: November 15, 2011, 03:23:38 pm »
So, thinking about a career change... whats life like as a web developer?

I've always enjoyed arseing about on the computer, but feel like I'm stuck at least 10 years in the past... there seems to be a bewildering amount of things to learn now. I've recently played about with the stuff here, and while nothing seems to be too hard to learn, I can't work out what is worth really going into. What would you consider the core skills to learn, and for what type of projects?

Already know that I want to stay away from anything microsoft. Can do basic HTML and CSS and some non-web scripting in Perl.

Sorry for the confused post, but any suggestions/input/pisstakes welcome! :wave
"I want to build a team that's invincible, so that they have to send a team from bloody Mars to beat us." - Bill Shankly

Offline Surprise me.

  • Is 2" bigger than fordy87.....
  • Legacy Fan
  • ******
  • Posts: 11,703
  • Formerly El Torres.
Re: RAWK Web Development Circle
« Reply #363 on: February 22, 2012, 01:16:44 am »
Gotta bump this.

Doing the whole self-host Apache thing to learn how to use it. Going to chuck Wordpress on it and see what it's like. Anyway so i installed PHP & MySQL with Apache on an old laptop.

So now i've tried to install phpmyadmin and i've come across an error. Nothing that google can help with either. Going to my url localhost.com/phpmyadmin/ gives this error: "the mysqli extension is missing". I've uncommented the extension in php.ini and checked the dll is in the php/ext folder so i have no idea what is wrong now.

Anyone have any idea?

Offline ♠Dirty Harry♠

  • Michael Pain the tittie-fixated inflatable doll salesman
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 19,031
Re: RAWK Web Development Circle
« Reply #364 on: February 22, 2012, 08:52:26 am »
Gotta bump this.

Doing the whole self-host Apache thing to learn how to use it. Going to chuck Wordpress on it and see what it's like. Anyway so i installed PHP & MySQL with Apache on an old laptop.

So now i've tried to install phpmyadmin and i've come across an error. Nothing that google can help with either. Going to my url localhost.com/phpmyadmin/ gives this error: "the mysqli extension is missing". I've uncommented the extension in php.ini and checked the dll is in the php/ext folder so i have no idea what is wrong now.

Anyone have any idea?

I'd go for Drupal to be fair, a far better platform in every way. The flexibility it offers is second to none plus the community support and module range is fantastic and I've never yet had to pay for one.

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 #365 on: February 22, 2012, 09:53:06 am »
Gotta bump this.

Doing the whole self-host Apache thing to learn how to use it. Going to chuck Wordpress on it and see what it's like. Anyway so i installed PHP & MySQL with Apache on an old laptop.

So now i've tried to install phpmyadmin and i've come across an error. Nothing that google can help with either. Going to my url localhost.com/phpmyadmin/ gives this error: "the mysqli extension is missing". I've uncommented the extension in php.ini and checked the dll is in the php/ext folder so i have no idea what is wrong now.

Anyone have any idea?

Is it a windows laptop or Linux?

If windows did you used a prerolled WAMP? XAMPP should run phpmyadmin out of the box...

Offline Surprise me.

  • Is 2" bigger than fordy87.....
  • Legacy Fan
  • ******
  • Posts: 11,703
  • Formerly El Torres.
Re: RAWK Web Development Circle
« Reply #366 on: February 22, 2012, 02:08:03 pm »
I'd go for Drupal to be fair, a far better platform in every way. The flexibility it offers is second to none plus the community support and module range is fantastic and I've never yet had to pay for one.

I'm going to try both, I've heard Drupal is miles better for a proper website so i'll definitely be trying both.

Is it a windows laptop or Linux?

If windows did you used a prerolled WAMP? XAMPP should run phpmyadmin out of the box...

It's Windows7, i did everything manually and separately. Apache, then PHP then MySQL. Now trying to add phpmyadmin and im getting this error. I'm hoping i don't have to go back and do everything with one of those all-in-one things. I think i'll learn more this way around.

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 #367 on: February 22, 2012, 03:16:09 pm »
Have you discovered phpinfo() yet?

Offline Surprise me.

  • Is 2" bigger than fordy87.....
  • Legacy Fan
  • ******
  • Posts: 11,703
  • Formerly El Torres.
Re: RAWK Web Development Circle
« Reply #368 on: February 22, 2012, 03:51:11 pm »
Yup but no idea how to navigate it to see if the extension is activated or not. I did a search for "mysqli" on that page and it shows that mysqli.dll is uncommented amongst the other extensions and this: 

Spoiler
[MySQLi]

; Maximum number of persistent links.  -1 means no limit.
; http://php.net/mysqli.max-persistent
mysqli.max_persistent = -1

; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
; http://php.net/mysqli.allow_local_infile
;mysqli.allow_local_infile = On

; Allow or prevent persistent links.
; http://php.net/mysqli.allow-persistent
mysqli.allow_persistent = On

; Maximum number of links.  -1 means no limit.
; http://php.net/mysqli.max-links
mysqli.max_links = -1

; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/mysqli.cache_size
mysqli.cache_size = 2000

; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
; http://php.net/mysqli.default-port
mysqli.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysqli.default-socket
mysqli.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-host
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-user
mysqli.default_user =

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
; http://php.net/mysqli.default-pw
mysqli.default_pw =

; Allow or prevent reconnect
mysqli.reconnect = Off
[close]

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 #369 on: February 22, 2012, 05:01:31 pm »
Code: [Select]
<?php phpinfo(); ?>


Just put the above in a page in the htdocs directory,

Then point a web browser at it. The page is massive, you are looking for the mysqli section. If there is not one, your php install does not have the mysqli libraries linked. You kind of want them.

I really would use XAMPP. Piddling about with PHP module configuration is probably a joy that is best delayed until you are comfortable with regular configuration.

Offline ♠Dirty Harry♠

  • Michael Pain the tittie-fixated inflatable doll salesman
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 19,031
Re: RAWK Web Development Circle
« Reply #370 on: February 22, 2012, 05:20:10 pm »
I'm going to try both, I've heard Drupal is miles better for a proper website so i'll definitely be trying both.

It's Windows7, i did everything manually and separately. Apache, then PHP then MySQL. Now trying to add phpmyadmin and im getting this error. I'm hoping i don't have to go back and do everything with one of those all-in-one things. I think i'll learn more this way around.

Definitely do, I'm training a new guy in our office up on Drupal, two weeks in and he's flying, in his last Job WP was all he used, he can't believe the difference.

If you are going to look at Drupal, use the Acquia Dev Desktop, it handles everything from the database install to PHP and Apache setup.

http://www.acquia.com/downloads-b


Offline Surprise me.

  • Is 2" bigger than fordy87.....
  • Legacy Fan
  • ******
  • Posts: 11,703
  • Formerly El Torres.
Re: RAWK Web Development Circle
« Reply #371 on: February 22, 2012, 08:01:01 pm »
Ok screw it i'm going to try it all again with XAMPP. The PHP info page was where I did the mysqli search and the section wasn't there so I presume that it's a bitch to fix.

Definitely do, I'm training a new guy in our office up on Drupal, two weeks in and he's flying, in his last Job WP was all he used, he can't believe the difference.

If you are going to look at Drupal, use the Acquia Dev Desktop, it handles everything from the database install to PHP and Apache setup.

http://www.acquia.com/downloads-b



Interesting i'll look into that, cheers.

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 #372 on: February 22, 2012, 08:40:57 pm »
Yup but no idea how to navigate it to see if the extension is activated or not. I did a search for "mysqli" on that page and it shows that mysqli.dll is uncommented amongst the other extensions and this: 

Spoiler
[MySQLi]

; Maximum number of persistent links.  -1 means no limit.
; http://php.net/mysqli.max-persistent
mysqli.max_persistent = -1

; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
; http://php.net/mysqli.allow_local_infile
;mysqli.allow_local_infile = On

; Allow or prevent persistent links.
; http://php.net/mysqli.allow-persistent
mysqli.allow_persistent = On

; Maximum number of links.  -1 means no limit.
; http://php.net/mysqli.max-links
mysqli.max_links = -1

; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/mysqli.cache_size
mysqli.cache_size = 2000

; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
; http://php.net/mysqli.default-port
mysqli.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysqli.default-socket
mysqli.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-host
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-user
mysqli.default_user =

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
; http://php.net/mysqli.default-pw
mysqli.default_pw =

; Allow or prevent reconnect
mysqli.reconnect = Off
[close]

Sounds like you're on Windows.

to be honest, you don't want to be worrying about PHP errors on your Windows dev machine. It won't be running on a Windows server (unless you're bonkers). Get the all-in-one package and test your code often on the target *nix server.
Quidquid latine dictum sit, altum sonatur.

Offline Surprise me.

  • Is 2" bigger than fordy87.....
  • Legacy Fan
  • ******
  • Posts: 11,703
  • Formerly El Torres.
Re: RAWK Web Development Circle
« Reply #373 on: February 24, 2012, 12:57:39 am »
Right, set it all up with XAMPP, very easy. One or two errors but that was just me playing around with the system. Got Wordpress installed and set up a site, found a decent theme, set up some basic pages, learnt how to use backend menus. Anyway i have to say, it's very easy to use. The biggest thing is the theme, and if i ever do start my own business, i'd pay someone to sort me out with a theme, after that it's just filling it with content. Managing a website through this system would be piss easy.

Only used one plugin and barely touched the editor so only a little play with the code but maybe that's where i'll get the most benefits.

I'll stick with this for a week or so and then try Drupal.

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 #374 on: February 24, 2012, 11:58:26 pm »
Now would be a really good time to learn how to use git. When you're tinkering with something like a website, it's invaluable to be able to undo any changes you made when you realise you've broken something.
Quidquid latine dictum sit, altum sonatur.

Offline smithy

  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,011
Re: RAWK Web Development Circle
« Reply #375 on: February 25, 2012, 01:23:29 pm »
Gotta bump this.

Doing the whole self-host Apache thing to learn how to use it. Going to chuck Wordpress on it and see what it's like. Anyway so i installed PHP & MySQL with Apache on an old laptop.

So now i've tried to install phpmyadmin and i've come across an error. Nothing that google can help with either. Going to my url localhost.com/phpmyadmin/ gives this error: "the mysqli extension is missing". I've uncommented the extension in php.ini and checked the dll is in the php/ext folder so i have no idea what is wrong now.

Anyone have any idea?
I realise its a bit late now but heres how I fixed it!

Download the "VC9 x86 Thread Safe" zip file.
Go to the "ext" folder within the zip file.
Copy all dlls from this folder into your own PHP/ext directory, overwriting all.
Restart windows.

It seems that both the php_mysql and php_mysqli dlls that are installed with the .msi package are insufficient or incompatable. No idea why. Its a real ball ache for setting up on Windows though. Linux is a breeze!

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 #376 on: February 26, 2012, 09:49:52 am »
It would be: your whole stack there was written for *nix systems.
Quidquid latine dictum sit, altum sonatur.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #377 on: May 17, 2012, 12:19:13 pm »
Hi Lads,

Been directed to this this thread. Im having a update problem when I try to populate html text fields with PHP from a MySQL database. Be trying to solve this for 2 hours and got no idea what is going wrong

Here's the code I'm having problems with. When I try to run this script in the browser everything shows up apart from the form

Code: [Select]
// Retrieves next record from general health record set until all records are retrieved-->
while($updateadminrow= mysql_fetch_array( $updateadminRs))
{?>
<!--Create form create admin form to create admin for the content management system. Submit clicked form redirects to
"updateadminprocesssuccess.php"-->
<form name="createadmin" method="get" action="updateadminprocesssuccess.php">
<!--create table for form structuring-->
<table>
<tr>
<td>
<!--create admin username label-->
<label for="admin_username"> Admin Username</label>

</td>
<td>
<!--create admin username text box for admin username populated data-->
<input type="text" name="admin_username"
value=<?php echo
$updateadminrow['adm_username'];?>
>
</td>
</tr>
<tr>
<td>
<!--create admin firstname label-->
<label for="admin_firstname"> Admin Firstname</label>

</td>
<td>
<!--create admin first name textbox populated with admin firstname data from MySQL fetch array-->
<input type="text" name="admin_firstname"
value=<?php echo
$updateadminrow['adm_firstname'];?>
>
</td>
</tr>
<tr>
<td>
<!--create admin lastname label-->
<label for="admin_lastname"> Admin Lastname</label>

</td>
<td>
<!--create admin last name textbox populated with admin lastname data from MySQL fetch array-->
<input type="text" name="admin_lastname"
value=<?php echo
$updateadminrow['adm_surname'];?>
>
</td>
</tr>
<tr>
<td>
<!--create admin password label-->
<label for="admin_password"> Admin Password</label>

</td>
<td>
<!--create admin last name password input populated with admin lastname data from MySQL fetch
array-->
<input type="password" name="admin_password"
value=<?php echo
$updateadminrow['adm_password'];?>
>
</td>
</tr>
<tr>
<td>
<!--create submit button to submit information entered by user once clicked. Redirects to
"updateadminprocesssuccess.php"-->
<input type="submit" name="Update" value="Update">
</td>
<td>
<!--create reset button to reset information entered by user once clicked.-->
<input type="reset" name="Reset form">
</td>
<td>
<!--create "redirect to admin mainmenu" button
to redirect user to "adminlogin_sucessful.php" once clicked-->
<input type="button" name="Redirect to admin main menu"
value="Redirect to admin main menu" OnClick="top.location='adminlogin_sucessful.php'">
<!--create "redirect to existing admin accounts" button to redirect user to
"existingadminaccounts.php" once clicked-->
<input type="button" name="Redirect to existing admin accounts"
value="Redirect to existing admin accounts" OnClick="top.location='existingadminaccounts.php'">
</td>
</tr>

</table><!--close form structuring table tag-->

</form><!--end tag for insert content form-->
<?php
//end of MySQL fetch array while loop
}
?>

If anyone as any help I would much appreciate it...Thanks!
« Last Edit: May 17, 2012, 12:22:14 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 #378 on: May 17, 2012, 12:27:35 pm »
I'm far from an expert, but does this line:

Code: [Select]
while($updateadminrow= mysql_fetch_array( $updateadminRs))

Not need to have a double equals, as it's a comparison as opposed to an assignment?

I.e.

Code: [Select]
while($updateadminrow == mysql_fetch_array( $updateadminRs))

No idea if that's right, just throwing it out there.
« Last Edit: May 17, 2012, 12:29:36 pm by AJ »

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #379 on: May 17, 2012, 12:31:59 pm »
I'm far from an expert, but does this line:

Code: [Select]
while($updateadminrow= mysql_fetch_array( $updateadminRs))

Not need to have a double equals, as it's a comparison as opposed to an assignment?

I.e.

Code: [Select]
while($updateadminrow == mysql_fetch_array( $updateadminRs))

No idea if that's right, just throwing it out there.

Got no idea mate but I assuming it doesn't because I'm using the mysql_fetch_array method on other scripts on my site and it is retrieving fine

I think it is also needs to pass data and not comparison. I have already done the comparison bit in the SQL WHERE statement

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 #380 on: May 17, 2012, 12:41:39 pm »
So what's actually happening when the script is run? Do the fields show up but with no data inside them? Does nothing show up at all?

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #381 on: May 17, 2012, 12:43:59 pm »
So what's actually happening when the script is run? Do the fields show up but with no data inside them? Does nothing show up at all?

The script loads up with CSS etc but no form fields or populated data show. E.g. Everything shows but the "main" part of the section

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 #382 on: May 17, 2012, 12:52:57 pm »
Well if the form fields don't show at all I'd say it's a problem with the condition of the loop, because it seems like the code within the loop is never being executed (otherwise the fields would be there in some form).

I'm gonna play about with it now and see if I can get it going.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #383 on: May 17, 2012, 12:54:26 pm »
Well if the form fields don't show at all I'd say it's a problem with the condition of the loop, because it seems like the code within the loop is never being executed (otherwise the fields would be there in some form).

I'm gonna play about with it now and see if I can get it going.

sound mate do you want me to PM you the whole code?

Got every part of CRUD working apart from this
« Last Edit: May 17, 2012, 12:56:59 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 #384 on: May 17, 2012, 01:20:02 pm »
Right, I think it's a problem with the SQL query.

Instead of passing $updateadminRs straight to mysql_fetch_array(), do something like this:

$result = mysql_query($updateadminRs) or die(mysql_error());

And pass the $result variable to mysql_fetch_array(). That'll tell you the exact problem with the query.

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 #385 on: May 17, 2012, 01:23:32 pm »
If no errors show up, the query is returning no results.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #386 on: May 17, 2012, 01:29:44 pm »
If no errors show up, the query is returning no results.

Yes correct I now have a "query is empty" message. So it is SQL related. Here's the section on the SQL
Code: [Select]
// Create update admin recordset to retrive all the data from the "admin" entity where admin id matches admin id requested from "existingadminaccounts.php"
mysql_query("SELECT * FROM `admin` WHERE `adm_id` LIKE '$_GET[adm_id]'")
or die(mysql_error());
$result = mysql_query($updateadminRs) or die(mysql_error());
« Last Edit: May 17, 2012, 01:31:48 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 #387 on: May 17, 2012, 01:32:06 pm »
Yeah, the problem lies in the query stored in $updateadminRs.

Obviously I haven't seen that, but whatever it is isn't returning any results so play with that a bit.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #388 on: May 17, 2012, 01:35:22 pm »
I'm totally confused as to which part in my SQL is wrong. The SELECT and WHERE statement seem right to me....I've posted it above if you can offer any advice

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 #389 on: May 17, 2012, 01:40:08 pm »
I don't think you need the quotes around the $_GET[abm_id], rather they should be around the abm_id.

So, either:

Code: [Select]
mysql_query("SELECT * FROM `admin` WHERE `adm_id` LIKE $_GET['adm_id']")

Or:

Code: [Select]
$adm_id = $_GET['adm_id']
mysql_query("SELECT * FROM `admin` WHERE `adm_id` LIKE $adm_id")


Should do it (though I'm not sure whether the $_GET can go straight in so it may have to be assigned to a variable first - the second option).
« Last Edit: May 17, 2012, 01:47:20 pm by AJ »

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #390 on: May 17, 2012, 01:52:32 pm »
Two problems I've now encountered with that.
Code: [Select]
$adm_id = $_GET['adm_id']
mysql_query("SELECT * FROM `admin` WHERE `adm_id` LIKE $adm_id")
I still get the query is empty message although there is definetely data from the ID passed in the URL.

Code: [Select]
mysql_query("SELECT * FROM `admin` WHERE `adm_id` LIKE $_GET['adm_id']")Which delivers: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING line 18

The other I know is syntax and possibly the '' in the adm_id $_GET request.

Any solutions?



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 #391 on: May 17, 2012, 01:55:33 pm »
My working syntax is:

Code: [Select]
$num = $_GET['num'];
$sql = "SELECT * FROM joke WHERE id = $num";


The first method, without the variable, doesn't work so scratch that.

As far as the other one goes, it works for me as above, so other than there being no result I'm really at a loss.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #392 on: May 17, 2012, 02:00:41 pm »
I'm at loss here too for some reason the query result is always empty.
Code: [Select]
$num = $_GET['adm_id'];
$sql = mysql_query("SELECT * FROM `admin` WHERE adm_id = $num")
or die(mysql_error());
$result = mysql_query($updateadminRs) or die(mysql_error());

Just ran the query through php my admin and it runs fine too
« Last Edit: May 17, 2012, 02:04:32 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 #393 on: May 17, 2012, 02:06:36 pm »
Is the value being passed properly?

In the example I've given, the URL is as such:

http://localhost/rawk/test.php?num=2

I.e. If you are using adm_id, the link should be something like:

www.url.com/page.php?adm_id=

With the number being 'got' by the $_GET following the equals.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #394 on: May 17, 2012, 02:08:09 pm »
Is the value being passed properly?

In the example I've given, the URL is as such:

http://localhost/rawk/test.php?num=2

I.e. If you are using adm_id, the link should be something like:

www.url.com/page.php?adm_id=

With the number being 'got' by the $_GET following the equals.

Yep it is mate

www.test.com/updateadminprocess.php?adm_id= 1
« Last Edit: May 17, 2012, 02:11:31 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 #395 on: May 17, 2012, 02:16:59 pm »
Right just send me the whole lot in a PM like you suggested before. I'll set up the admin table the same as yours and see if I can get it working.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #396 on: May 17, 2012, 02:21:55 pm »
Right just send me the whole lot in a PM like you suggested before. I'll set up the admin table the same as yours and see if I can get it working.

PM'd you now mate
« Last Edit: May 17, 2012, 09:30:31 pm by JLFC »

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #397 on: May 17, 2012, 09:31:11 pm »
Hi lads,

Sorry for double post on this thread but struggling with final update process for my update protocol.

Code: [Select]
//My SQL query to UPDATE all admin data WHERE admin id EQUALS admin id request from
//"existingadminaccounts.php"
$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'";
mysql_query($query);

The error that is being displayed is: Parse error: syntax error, unexpected T_VARIABLE ,  Line 72

Line 72 points to my UPDATE SQL query.

Any advice on what is going on would be great.

Thanks for any advice given,

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 #398 on: May 17, 2012, 10:08:05 pm »
I think you should be able to leave the quotes out around $admin_id, because it's a numeric value.

Offline JLFC

  • Legacy Fan
  • ******
  • Posts: 1,449
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #399 on: May 17, 2012, 10:14:59 pm »
I think you should be able to leave the quotes out around $admin_id, because it's a numeric value.

Still the same error message coming back at the SQL statement.

Thanks again for your advice!