Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Help with PHP code to edit rows in MySQL

- - - - -

  • Please log in to reply
9 replies to this topic

#1
At0mic

At0mic

    Enthusiast

  • Member
  • PipPip
  • 288 posts
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 Files


You can enter max 4 lines of text in signature or signature image.


How to remove advertisement from MSFN

#2
MtK

MtK

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 909 posts
Hi,
do you get the Not Updated notification?
Posted Image
"Know Your Limits And Ignore Them..."

#3
At0mic

At0mic

    Enthusiast

  • Member
  • PipPip
  • 288 posts
No it says "Updated Information Ok". However, when I go back to the main page, the entry I edited has empty fields.
You can enter max 4 lines of text in signature or signature image.

#4
MtK

MtK

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 909 posts
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...
Posted Image
"Know Your Limits And Ignore Them..."

#5
mad_raven

mad_raven
  • Member
  • 8 posts
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
At0mic

At0mic

    Enthusiast

  • Member
  • PipPip
  • 288 posts
the entries aren't in the DB either
You can enter max 4 lines of text in signature or signature image.

#7
MtK

MtK

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 909 posts

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...
Posted Image
"Know Your Limits And Ignore Them..."

#8
At0mic

At0mic

    Enthusiast

  • Member
  • PipPip
  • 288 posts
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?
You can enter max 4 lines of text in signature or signature image.

#9
MtK

MtK

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 909 posts

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...

Edited by MtK, 10 May 2007 - 09:45 AM.

Posted Image
"Know Your Limits And Ignore Them..."

#10
mad_raven

mad_raven
  • Member
  • 8 posts

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN