Welcome
Welcome to <strong>txtSQL</strong>.

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>!

createtable error?

Post bugs here

createtable error?

Postby crazysherpa on Fri Aug 10, 2007 4:52 pm

Hi,

I am trying to use createtale() function like the following -
<?php
include('./txtSQL.class.php');
$sql = new txtSQL('./data');
$sql->connect('root', '');
$sql->selectdb('xpressdb');

$columns = array('id' => array('type' => 'int', 'auto_increment' => 1, 'permanent' => 1),
'name' => array('type' => 'string', 'max' => 50),
'email' => array('type' => 'string', 'max' => 50));

$sql->createtable('table' => 'xpressusers2',
'columns' => $columns);

$sql->disconnect();
?>

However, when I use the execute() function it works -
<?php
include('./txtSQL.class.php');
$sql = new txtSQL('./data');
$sql->connect('root', '');
$sql->selectdb('xpressdb');

$columns = array('id' => array('type' => 'int', 'auto_increment' => 1, 'permanent' => 1),
'name' => array('type' => 'string', 'max' => 50),
'email' => array('type' => 'string', 'max' => 50));

$sql->execute('create table',
array('table' => 'xpressusers',
'columns' => $columns));
$sql->disconnect();
?>

Any idea?

thanks
crazysherpa
 
Posts: 3
Joined: Fri Aug 10, 2007 4:48 pm

Postby FarazAli on Fri Aug 10, 2007 11:32 pm

I think that this might be your error...

inside the call to createtable(), you never put your arguments in an array...

$sql->createtable('table' => 'xpressusers2',
'columns' => $columns);

should be

$sql->createtable(array('table' => 'xpressusers2',
'columns' => $columns));
Latest txtSQL Stable Release: txtSQL 2.2 Final

Track 4.0 Development

Image
FarazAli
Site Admin
 
Posts: 73
Joined: Sun Mar 25, 2007 1:08 pm
Location: New Jersey, NJ

Postby crazysherpa on Sat Aug 11, 2007 5:48 pm

Hi Faraz,

Thanks for the reply. I think the documentation I downloaded along txtSQL2.2 Final contains incorrect use of createtable(). However the online documentation is correct. Here is what I got in the downloaded version -
Example 21: createtable() Copy to Clipboard
<?php
$columns = array('id' => array('type' => 'int', 'auto_increment' => 1, 'permanent' => 1
'name' => array('type' => 'string', 'max' => 50),
'email' => array('type' => 'string', 'max' => 50)
);

$sql->createtable('db' => 'testDb',
'table' => 'testTable',
'columns' => $columns);
?>

thanks
crazysherpa
 
Posts: 3
Joined: Fri Aug 10, 2007 4:48 pm

Postby FarazAli on Sat Aug 11, 2007 7:22 pm

hmmm.... seems as tho your rite.

I gotta quickly put up an updated version. Thanks for the lookout...
Latest txtSQL Stable Release: txtSQL 2.2 Final

Track 4.0 Development

Image
FarazAli
Site Admin
 
Posts: 73
Joined: Sun Mar 25, 2007 1:08 pm
Location: New Jersey, NJ

Re: createtable error?

Postby zzw08 on Tue Jul 14, 2009 5:33 am

http://www.fashion-products.com [url=http://www.fashion-products.com ]is a sell air force one,
air jordan,bape,kicks,nike,Jerseys,Shoes,Clothing,Bag,Glasses,Caps&Hats,sneakers,sunglasses,
watches,Jewelry,Electronics,NBA,NFL,NHL,MLB[/url]
shoes
clothing
Handbags Wallets
Hat
Sunglasses
Belts
Watches
Jewelry
zzw08
 
Posts: 53
Joined: Tue Jul 14, 2009 5:15 am


Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests

cron