Forum Stats

  • 3,826,755 Users
  • 2,260,705 Discussions
  • 7,897,072 Comments

Discussions

trying to insert values in table but it shows empty

pauljohny100
pauljohny100 Member Posts: 184
edited Jun 7, 2016 1:31AM in PHP

HI Can any one help?

Pls see the code ..But i cant  see any value being inserted in test_table

What am i missing

<?php

$number_passed=20;//this is calculated earlier in the code

$number_total=100;//also calculated earlier in the code

$date=date('m/d/y');

$connection = oci_connect('Adsf2', 'XAQ4TMsdfM1', 'yellow.maxapddex.net:1555/xe');

$sql="INSERT INTO TEST_TABLE (num_pass,num_total) VALUES

('${number_passed}','${number_total}')";

$st= oci_parse($$connection, $sql);

oci_execute($st);

?>

Answers

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited Jun 1, 2016 11:15PM

    Hi pauljohny100,


    The double $ "$$" in this line is the issue, it is causing your script to fail:

    $st= oci_parse($$connection, $sql);

    Remove it so it looks like this:

    $st= oci_parse($connection, $sql); 

    Cheers,

    Gaz.

  • Unknown
    edited Jun 7, 2016 1:31AM

    You can insert for the new row in excel sheet.Now there spcific effect you and acheive insert rows for the excel sheet.

    You have to quote (using ") around your index name in your SQL request because $_POST

    $sql="INSERT INTO categories (name, parent_id,description)

    VALUES

    ('".$_POST["name"]."','".$_POST["parent_id"]."','".$_POST["description"]."')";

This discussion has been closed.