Jump to content

Archived

This topic is now archived and is closed to further replies.

djdellux

[SOLVED] SQLITE Topics ok???

Recommended Posts

i have a qestion concerning Sqlite is that a topic that could be anwsered in here guys???

Share this post


Link to post
Share on other sites

I have to insert this into sqlite its a list of the table names from my php code i am now running in the sqlite cmd. with my voip.db open do you know how i would go about puting this into it via cmd so it would creat these tables

 

thx in advance

 

$dbquery = "INSERT INTO voip.db ( number1, number2, type, number3, linetype, c1, dial, c2, date1, date2,

  date3, c3, c4, anw, DOCUMENTATION, unix)

  VALUES ($dbquery)";

Share this post


Link to post
Share on other sites

This is not a query that would create a table... This is a query that inserts values into existing table...

Share this post


Link to post
Share on other sites

how woul i create that table here is an example of the data and tbl names

 

 

number1, number2, type, number3, linetype, c1, dial, c2, date1, date2,

  date3, c3, c4, anw, DOCUMENTATION, unix

 

("","CSEline7","1356","inter-company","""CSEline7"" ","IAX2/cse-its04-2318","SIP/PTIline3-08cdf068","Dial","SIP/PTIline3,,D(1356)","2008-12-03 09:07:29","2008-12-03 09:07:32","2008-12-03 09:10:44",195,192,"ANSWERED","DOCUMENTATION","1228295249.897","" )

Share this post


Link to post
Share on other sites

i actually need to know how to do it old skool so i can understand the concept before i get a prgm that will do it for me if ya know what i mean...thx for those i will utilize them later

Share this post


Link to post
Share on other sites

yeah but i am not sure how to CREATE TABLE(enter the info in here???) lol if your picking up what im puting down mate

Share this post


Link to post
Share on other sites

Diagrams on that page explain syntax quite good.

 

You would do something like this

 

CREATE TABLE tablename (columnname1 datatype1, columnname2 datatype2, ...);

 

See here: http://www.sqlite.org/datatype3.html for available datatypes in sqlite

Share this post


Link to post
Share on other sites

CREATE TABLE voiplog (number1 TEXT , number2 INTERGER, type TEXT , number3 TEXT, linetype TEXT, c1 TEXT, dial TEXT, c2 TEXT,

date1 INTERGER, date2 INTERGER,date3 INTERGER, c3 TEXT, c4 TEXT, anw TEXT, Documentaion TEXT, unix REAL)

 

i did this and now excuted code and its still giving an error

 

Warning: sqlite_query() [function.sqlite-query]: no such table: voiplog in c:\program files\Apache\htdocs\csv2.php on line 32

 

 

would you like to see my php???

Share this post


Link to post
Share on other sites

Sure

Let's not and say we did... only post SMALL, RELEVANT code snippets -- NOT the entire file.

Share this post


Link to post
Share on other sites

ok heres a limited version lol

 

<?php
        $dbvoip = sqlite_open('voip.db');

        if ($dbvoip == false)
        {
                die ('Unable to open database');
        } else {
                echo 'Database created.';
        }

$dbinfo=file("master.csv");

foreach ($dbinfo as  $dbquery);
{

   //$data =implode(",",$dbquery);
  

   
$dbquery = "INSERT INTO voip.db ( number1, number2, type, number3, linetype, c1, dial, c2, date1, date2,
   date3, c3, c4, anw, Documentaion, unix)
   VALUES ($dbquery)";
   //echo($dbquery);
    
}
           //sqlite_close($dbvoip)



$pageQuery = "SELECT * FROM number1 ";

$pageResult = sqlite_query($dbvoip, $pageQuery); 

echo $pageResult;

?>



 

I am stressing cuz im new and i think that i should have this stuff down but...lol

Share this post


Link to post
Share on other sites

Hold on.

Your database is called 'voip.id'

Your table is called 'voiplog'

 

So your insert query should look like

 

INSERT INTO voiplog (...

 

and your select query

 

SELECT number1 FROM voiplog

 

 

Share this post


Link to post
Share on other sites

Use one of the tools I suggested above, to check if the table was indeed created.

Share this post


Link to post
Share on other sites

tools suggested above???? sorry its been a ery long day we had too many layoffs and my head just isnt here lol thx for understanding

Share this post


Link to post
Share on other sites

SQLiteManager and/or SQLite Manager

Share this post


Link to post
Share on other sites

im not at liberty to get those prgms... i do believe there is a more conventional way right??

Share this post


Link to post
Share on other sites

Who limits you in getting those? ???

Share this post


Link to post
Share on other sites

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