Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Subject: Error in PHP MySql

Original Message
Name: neelchauhan
Date: April 22, 2008 at 06:30:51 Pacific
Subject: Error in PHP MySql
OS: Windows
CPU/Ram: 1GB
Model/Manufacturer: Does not Count.
Comment:
I am trying to create a Search Engine in PHP indexing using MySql values instead of META Tages. The script is below:


<?php
// Make a MySQL Connection
mysql_connect("localhost", "root", "nchauhan") or die(mysql_error());
mysql_select_db("search") or die(mysql_error());

// Create a MySQL table in the selected database
mysql_query("CREATE TABLE example(name VARCHAR(255), url VARCHAR(255), desc VARCHAR(255), cate varchar(10)") or die(mysql_error());
echo "Table Created!";

?>

I get a error that says "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc VARCHAR(255), cate varchar(10)' at line 1" but I cannot find the manual of MySql.
I have scripts that create databases. I am using XAMPP Lite with Apache 2.2.8 + PHP 5.2.5 + MySQL 5.0.51a + phpMyAdmin 2.11.4 + OpenSSL 0.9.8g + SQLite 2.8.15. Can you help me?

Neel Chauhan


Report Offensive Message For Removal

Response Number 1
Name: Laler
Date: April 22, 2008 at 09:34:37 Pacific
Subject: Error in PHP MySql
Reply: (edit)
This'll work:

mysql_query("CREATE TABLE `example` (
`name` VARCHAR( 255 ) ,
`url` VARCHAR( 255 ) ,
`desc` VARCHAR( 255 ) ,
`cate` VARCHAR( 10 )
)") or die(mysql_error());


Report Offensive Follow Up For Removal

Response Number 2
Name: neelchauhan
Date: April 22, 2008 at 11:22:06 Pacific
Subject: Error in PHP MySql
Reply: (edit)
Thank you for your help, Laler! even though my PHP Skills are not so good.

Neel Chauhan


Report Offensive Follow Up For Removal

Response Number 3
Name: Laler
Date: April 22, 2008 at 16:44:50 Pacific
Subject: Error in PHP MySql
Reply: (edit)
even though my PHP Skills are not so good

Do you mean you can't understand it?

You need to replace your code beginning from:

mysql_query("CREATE TABLE

to:

die(mysql_error());

... with my code above.

---
Fubar


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Error in PHP MySql

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software



Version Tracker Pro
Keep your software current and secure, effortlessly

Click Here for a Free Scan

Driver Agent
Automatically find the latest drivers for your computer.
Click Here for a Free Scan



The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC