MSFN Forum: Help with PHP code to edit rows in MySQL - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Help with PHP code to edit rows in MySQL using XAMPP web server Rate Topic: -----

#1 User is offline   At0mic 

  • Enthusiast
  • PipPip
  • Group: Members
  • Posts: 288
  • Joined: 10-February 05

Posted 10 May 2007 - 05:16 AM

I've got website running happily using XAMPP 1.4.15

However, I desperately want to upgrade to the latest XAMP 1.6.1

The problem I'm having after the upgrade is with a php page that lets me edit users. I can add users ok but if I try to edit them, all the cells in that row end up empty. There's no error message which makes it difficult to diagnose.

At first, I thought the reason was due to the new XAMPP having MySQL 5.0.37. I upgraded XAMPP 1.4.15 to MySQL 5.0.37 and it still worked perfectly. There's something in XAMP 1.6.1 which isn't compatible with my php code. I even tried XAMP 1.6.1 with PHP 4.4.6 but I still had the same problem.

Please help

I've attached the PHP code + MySQL database in case anyone would be so kind as to take a look at it.

Attached File(s)




#2 User is offline   MtK 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 909
  • Joined: 02-December 03

Posted 10 May 2007 - 06:14 AM

Hi,
do you get the Not Updated notification?

#3 User is offline   At0mic 

  • Enthusiast
  • PipPip
  • Group: Members
  • Posts: 288
  • Joined: 10-February 05

Posted 10 May 2007 - 07:15 AM

No it says "Updated Information Ok". However, when I go back to the main page, the entry I edited has empty fields.

#4 User is offline   MtK 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 909
  • Joined: 02-December 03

Posted 10 May 2007 - 07:52 AM

Can u check please the entries on the DB itself?
I understand that the PHP isn't showing the enrtries, I want to know what the DB says about it...

#5 User is offline   mad_raven 

  • Group: Members
  • Posts: 8
  • Joined: 20-January 05

Posted 10 May 2007 - 09:01 AM

Try this in the file adminpage_staff_edit.php

 
	$staff_first_name = addslashes(trim($_POST['staff_first_name']));
	$staff_last_name = addslashes(trim($_POST['staff_last_name']));
	$dept_id = addslashes(trim($_POST['dept_id']));
	$staff_title = addslashes(trim($_POST['staff_title']));
	$staff_email = addslashes(trim($_POST['staff_email']));
	$staff_telephone = addslashes(trim($_POST['staff_telephone']));
	
	if ( !empty($_POST['staff_image']) )  


Let me know what happens.

#6 User is offline   At0mic 

  • Enthusiast
  • PipPip
  • Group: Members
  • Posts: 288
  • Joined: 10-February 05

Posted 10 May 2007 - 09:02 AM

the entries aren't in the DB either

#7 User is offline   MtK 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 909
  • Joined: 02-December 03

Posted 10 May 2007 - 09:06 AM

View PostAt0mic, on May 10 2007, 06:02 PM, said:

the entries aren't in the DB either

so they were deleted (assuming it was an EDIT & they existed before this process)


try mad_raven's suggestion, then will see...

#8 User is offline   At0mic 

  • Enthusiast
  • PipPip
  • Group: Members
  • Posts: 288
  • Joined: 10-February 05

Posted 10 May 2007 - 09:37 AM

Sorry mad_raven you posted while I was replying to MtK so I've only just read your reply.

I tried your code and it works :)

Thank you so much.

Quick question, why did it work before in my old version of XAMPP? Is it due to modifications with the PHP scripting language?

#9 User is offline   MtK 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 909
  • Joined: 02-December 03

Posted 10 May 2007 - 09:44 AM

View PostAt0mic, on May 10 2007, 06:37 PM, said:

Sorry mad_raven you posted while I was replying to MtK so I've only just read your reply.

I tried your code and it works :)

Thank you so much.

Quick question, why did it work before in my old version of XAMPP? Is it due to modifications with the PHP scripting language?

A wild guess would be: $_POST,
but wait for mad_raven's answer...

This post has been edited by MtK: 10 May 2007 - 09:45 AM


#10 User is offline   mad_raven 

  • Group: Members
  • Posts: 8
  • Joined: 20-January 05

Posted 10 May 2007 - 09:57 AM

View PostAt0mic, on May 10 2007, 09:37 AM, said:

Sorry mad_raven you posted while I was replying to MtK so I've only just read your reply.

I tried your code and it works :)

Thank you so much.

Quick question, why did it work before in my old version of XAMPP? Is it due to modifications with the PHP scripting language?


There are two possible explainations.

1: register_globals has been turned off in your php.ini file.

2: The new version of XAMP turns it off when it runs.

The register_globals feature automatically registers form field as variables. If the feature is turned off then you need to access the submitted form fields using the $_GET and $_POST super globals.

Register_globals is turned off by default in the latest versions of php as it is a security risk having it turned on.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy