Jump to content

Add single record by script


Recommended Posts

Hi,

I created table with name USERS.

Inside I have defined 3 items : NAME, PASSWORD, EMAIL

Is it possible to add record to this table by some script?

When I do it locally, I'm using script like this :

 

<?php
//Variables for the connection
    $servername = "localhost";
    $s_username =  "root";
    $s_password = "abcdef";
    $my_Table = "USERS";
    
//Variable from the user    
    $NAME = "JOHN";    $PASSWORD = "abc";    $EMAIL = "john@john.com";
   
    //Make Connection
    $conn = new mysqli($servername, $s_username, $s_password, $my_Table);
    //Check Connection
    if (!$conn) die("Failed. ". mysqli_connect_error());
    
    $sql = "INSERT INTO users (NAME, PASSWORD, EMAIL)
            VALUES ('".$NAME."','".$PASSWORD."','".$EMAIL."')";
    $result = mysqli_query($conn ,$sql);
    
    if(!result) echo "error";
    else echo "ok.";
?>

 

Is it possible to upload PHP like this to caspio server? Into which directory?

What about my_Table name ? What is correct filename, I mean web address for browser.

 

Thank You in advance for any help.

Regards,

Milos.

 

 

 

 

 

Link to comment
Share on other sites

On 3/6/2017 at 5:33 PM, MilosT said:

Hi,

I created table with name USERS.

Inside I have defined 3 items : NAME, PASSWORD, EMAIL

Is it possible to add record to this table by some script?

When I do it locally, I'm using script like this :

 

<?php
//Variables for the connection
    $servername = "localhost";
    $s_username =  "root";
    $s_password = "abcdef";
    $my_Table = "USERS";
    
//Variable from the user    
    $NAME = "JOHN";    $PASSWORD = "abc";    $EMAIL = "john@john.com";
   
    //Make Connection
    $conn = new mysqli($servername, $s_username, $s_password, $my_Table);
    //Check Connection
    if (!$conn) die("Failed. ". mysqli_connect_error());
    
    $sql = "INSERT INTO users (NAME, PASSWORD, EMAIL)
            VALUES ('".$NAME."','".$PASSWORD."','".$EMAIL."')";
    $result = mysqli_query($conn ,$sql);
    
    if(!result) echo "error";
    else echo "ok.";
?>

 

Is it possible to upload PHP like this to caspio server? Into which directory?

What about my_Table name ? What is correct filename, I mean web address for browser.

 

Thank You in advance for any help.

Regards,

Milos.

 

 

 

 

 

Hi Milos,

As far as I know, you can't upload this php code to caspio server. Perhaps API intergation will help. Check the "post table row" table operation in this article

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...