Jump to content

[SOLVED] error in insert query


aconite

Recommended Posts

im tryin to insert a row into a table named transaction.the specification for this table are

 

if (mysql_query("CREATE TABLE transaction

    (id INT(4) AUTO_INCREMENT NOT NULL PRIMARY KEY,

      source INT(7) UNSIGNED,

                              destination  INT(7) UNSIGNED,

                              amount INT(3) NOT NULL,

                              date DATE ,

      strt_time TIME ,

                              end_time  TIME ,

                              status ENUM(\"TRUE\",\"FALSE\") NOT NULL)")

  )

{

echo("created transaction table");

}

 

 

the php file is

 

 

<?php

$con = mysql_connect("127.0.0.1","root","12345");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }

 

else echo "connected";

 

if(!mysql_select_db("mydatabase"))

{

    die('Could not select database: mydatabase ' . mysql_error());

}

 

$tranSource=5487335;

$thePswd=1111;

$theDest=1234567;

$theAmmount = 60;

 

$today = getdate();

 

$year = $today['year'];

$month = $today['mon'];

$mday = $today['mday'];

 

// zero-substitutes MONTH if less than 10, concatenates 'mon' var

 

if ($month < 10)

{

$month = "0";

$month .= $today['mon'];

}

 

// concatenates date in MySQL date format YYYY-MM-DD

 

$date = $year;

$date .= "-";

$date .= $month;

$date .= "-";

$date .= $mday;

echo "  ";

echo $date;

echo "  ";

 

$hour1 = $today['hours'];

$minute1 = $today['minutes'];

$second1 = $today['seconds'];

 

$time1 = $hour1;

$time1 .= "-";

$time1 .= $minute1;

$time1 .= "-";

$time1 .= $second1;

 

echo "  ";

echo $time1;

echo "  ";

 

$today2 = getdate();

 

$hour2 = $today2['hours'];

$minute2 = $today2['minutes'];

$second2 = $today2['seconds'];

 

$time2 = $hour2;

$time2 .= "-";

$time2 .= $minute2;

$time2 .= "-";

$time2 .= $second2;

 

echo "  * ";

echo $time2;

echo " * ";

 

 

 

/*qq="insert into transaction(source,destination,amount,date,strt_time,end_time,status)

values($tranSource,$theDest,$theAmmount,$date,$time1,$time2,'TRUE')";

mysql_query($qq) or die (mysql_error());*/

mysql_close($con);

?>

 

this gives the output

connected 2007-03-15 19-20-7 * 19-20-7 *

 

but if i uncomment the query part i get no output.

i cant figure out what is the problem with my query. ???helpppp

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.