Reply
T_String err. unable to track
Old 10-06-2006, 02:25 PM T_String err. unable to track
afridy's Avatar
Extreme Talker

Posts: 184
PHP Code:
<?
$link 
mysql_connect('localhost''name''pass');
if (!
$link) {
    die(
'Could not connect to mysql server: ' mysql_error());
}
echo 
"Connected to mysql successfully.<br>""\n";
//select db
mysql_select_db ("site_visitors") or die ("But could not select the specified db!<br>");
//creating Table
CREATE TABLE useronline 
(  timestamp int(15) DEFAULT '0' NOT NULL,
   
ip varchar(40NOT NULL,
   
file varchar(100NOT NULL,
   
PRIMARY KEY (timestamp),
   
KEY ip (ip),
   
KEY file (file)
);
//NOT NULL means that all the rows in the table must have a value in this attribute.
//If it isn't specified, the field can be blank (NULL).
?>
Hai above is my php script to create a table.
The T_STRING error points to exactly the line below shown

PHP Code:
CREATE TABLE useronline 
What could be wrong friends?

Last edited by afridy : 10-06-2006 at 02:27 PM. Reason: Subscribe to the thread
afridy is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 10-06-2006, 04:27 PM Re: T_String err. unable to track
Ultra Talker

Posts: 479
You can't just dump a MySQL query into the middle of PHP like that and expect it to work.

You need to wrap some quotes around it and pass it to the mysql_query function.

Replace:
CREATE TABLE useronline
( timestamp int(15) DEFAULT '0' NOT NULL,
ip varchar(40) NOT NULL,
file varchar(100) NOT NULL,
PRIMARY KEY (timestamp),
KEY ip (ip),
KEY file (file)
);

with:
$query = "CREATE TABLE useronline ( timestamp int(15) DEFAULT '0' NOT NULL, ip varchar(40) NOT NULL, file varchar(100) NOT NULL, PRIMARY KEY (timestamp), KEY ip (ip), KEY file (file));";
mysql_query($query);

I'd also recommend a little reading on PHP + MySQL from http://php.net/manual/en/ref.mysql.php
__________________
Free PHP Obfuscator
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 10-06-2006, 06:58 PM Re: T_String err. unable to track
afridy's Avatar
Extreme Talker

Posts: 184
Hai twist...

Yes i undestand the importance of mysql_query()

Thank you very much for the support.
appriciate your continues support on the forum

TATA
afridy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to T_String err. unable to track
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12464 seconds with 13 queries