Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
Does anyone have a sample .php file for use with editurl?
09/11/2010
19:11
Avatar
mblack24
New Member
Members
Forum Posts: 1
Member Since:
09/11/2010
sp_UserOfflineSmall Offline

I'm using php to pull from a mysql table. Everything is working except for the adding new data and editing data part. I have the options available, I just don't know what the someurl.php page is supposed to look like in order to add the new or edited data to my table.

Does anyone have a .php page they've created that they can share with me?Cry

10/11/2010
04:45
Avatar
BenRivera
Member
Members
Forum Posts: 11
Member Since:
08/06/2010
sp_UserOfflineSmall Offline

Here is an example:

<?php
... create your database connection here...

include_once('functions.php');

if (isset($_POST["oper"])) {
    if ($_POST["oper"] == "add") {
        $insertSQL = sprintf("INSERT INTO users (login, pword, fname, lname,
            email, wphone, hphone, mphone, idlocations, idaccess, idorgunits,
            status, last_update_id, last_update_dt, expiration_dt)
            VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, ifnull(%s,1000),
            current_timestamp(), DATE_ADD(current_timestamp(), INTERVAL 90 DAY))",
                        GetSQLValueString($_POST['login'], "text"),
                        GetSQLValueString($_POST['pword'], "password"),
                        GetSQLValueString($_POST['fname'], "text"),
                        GetSQLValueString($_POST['lname'], "text"),
                        GetSQLValueString($_POST['email'], "text"),
                        GetSQLValueString($_POST['wphone'], "text"),
                        GetSQLValueString($_POST['hphone'], "text"),
                        GetSQLValueString($_POST['mphone'], "text"),
                        GetSQLValueString($_POST['idlocations'], "int"),
                        GetSQLValueString($_POST['idaccess'], "int"),
                        GetSQLValueString($_POST['idorgunits'], "int"),
                        GetSQLValueString($_POST['status'], "text"),
                        GetSQLValueString($_SESSION['MM_UserID'], "int"));
        $Result = mysql_query($insertSQL, $metrics) or die(mysql_error());
    } elseif ($_POST["oper"] == "edit") {
        $editSQL = sprintf("update users set login = %s, pword = %s, fname = %s,
            lname = %s, email =  %s, wphone = %s, hphone = %s, mphone = %s,
            idlocations =  %s, idaccess = %s, idorgunits = %s, status = %s,
            last_update_id = %s, last_update_dt = current_timestamp(),
            expiration_dt = DATE_ADD(current_timestamp(), INTERVAL 90 DAY)
            where idusers = %s",
                        GetSQLValueString($_POST['login'], "text"),
                        GetSQLValueString($_POST['pword'], "password"),
                        GetSQLValueString($_POST['fname'], "text"),
                        GetSQLValueString($_POST['lname'], "text"),
                        GetSQLValueString($_POST['email'], "text"),
                        GetSQLValueString($_POST['wphone'], "text"),
                        GetSQLValueString($_POST['hphone'], "text"),
                        GetSQLValueString($_POST['mphone'], "text"),
                        GetSQLValueString($_POST['idlocations'], "int"),
                        GetSQLValueString($_POST['idaccess'], "int"),
                        GetSQLValueString($_POST['idorgunits'], "int"),
                        GetSQLValueString($_POST['status'], "text"),
                        GetSQLValueString($_SESSION['MM_UserID'], "int"),
                        GetSQLValueString($_POST['id'], "int"));
        $Result = mysql_query($editSQL, $metrics) or die(mysql_error());
    } elseif ($_POST["oper"] == "del") {
        $deleteSQL = sprintf("delete from users where idusers = %s",
                        GetSQLValueString($_POST['id'], "int"));
        $Result = mysql_query($deleteSQL, $metrics) or die(mysql_error());
    }
}
mysql_close($metrics);
?>

The function.php file has the getsqlvaluestring function to return data in the format needed for sql.  If you want this file, send me a PM.

Regards,

Ben

13/09/2011
11:12
Avatar
jayasri
New Member
Members
Forum Posts: 2
Member Since:
13/09/2011
sp_UserOfflineSmall Offline

Hi BenRivera,

its working fine for me.but update,delete is not woking because $_POST['id'] is not coming in someurl.php.

can you give me a solution for that..

16/09/2011
01:05
Avatar
djkuddel
Member
Members
Forum Posts: 25
Member Since:
01/08/2011
sp_UserOfflineSmall Offline

Hi,

I have the same issue. It seem, that the editurl for edit do not work.Cry

It would be great if someone could help.

Best regards,

DJ

16/09/2011
17:04
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Well

It is very easy to say not work -

Please specify example code, browser, OS

This way you will save your and our time

Please do this into the future – if not – no help

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

11/01/2012
23:32
Avatar
chucky2183
Argentina
Member
Members
Forum Posts: 3
Member Since:
10/01/2012
sp_UserOfflineSmall Offline

And how i can do the same but not modifying the database? I only want to add, edit, and delete an empty grid. I have days with this.

Thanks

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
53 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information