Sql Query - Mistake?

Pages: 1, 2
free web hosting

Read Latest Entries..: (Post #19) by alex1985 on Mar 11 2008, 11:03 AM. (Line Breaks Removed)
Thanks you guys. I will try to use yours, it seems better for me.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Sql Query - Mistake?

alex1985
Hi, everyone! What is the mistake over here?

CODE
CREATE TABLE '1_users' (
'id' INT(11) NOT NULL AUTO_INCREMENT,
'username' VARCHAR(255) NOT NULL,
'password' VARCHAR(255) NOT NULL,
PRIMARY KEY ('id')
) TYPE MYISAM;


The PHPMyAdmin states:

QUOTE
#1064 - 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 ''1_users' (
'id' INT(11) NOT NULL AUTO_INCREMENT,
'username' VARCHAR(255) NOT ' at line 1


Please, let me know as soon as possible?

Reply

rvalkass
This is a simple case of the wrong quotes. You need to use ` rather than '. The following should work:

SQL
CREATE TABLE `1_users` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`username` VARCHAR(255) NOT NULL,
`password` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`)
) TYPE MYISAM;

Reply

alex1985
Oh, so easy!!! Thanks for answering, it's good to learn through your forum, replies got answered so fast.

Reply

alex1985
Sorry, but the PHPMyAdmin still gives the following:

QUOTE
SQL query:

CREATE TABLE `users` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT ;

MySQL said: Documentation
#1064 - 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 '' at line 2

Reply

rvalkass
OK, try the following:

SQL
CREATE TABLE `1_users` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`username` VARCHAR( 255 ) NOT NULL ,
`password` VARCHAR( 255 ) NOT NULL
) ENGINE = MYISAM


If that doesn't work, add the database name before the table name, so the first line would become:
SQL
CREATE TABLE `databasename`.`1_users` (

Reply

alex1985
So, I need to make spaces between words and brackets?! Correct me, I I'm being wrong!

Reply

rvalkass
Well, I just ran that code on my own MySQL installation and it worked perfectly. I have found in the past that it can be a little picky about what it lets through and what it doesn't.

If that code still doesn't work, use phpMyAdmin to create the table, and copy the MySQL query it actually runs (it will be displayed to you after the table is created). Then you can be certain that code will work.

Reply

alex1985
QUOTE(rvalkass @ Mar 8 2008, 06:36 PM) *
Well, I just ran that code on my own MySQL installation and it worked perfectly. I have found in the past that it can be a little picky about what it lets through and what it doesn't.

If that code still doesn't work, use phpMyAdmin to create the table, and copy the MySQL query it actually runs (it will be displayed to you after the table is created). Then you can be certain that code will work.


What's about my previous question?

Reply

truefusion
QUOTE(alex1985 @ Mar 8 2008, 09:24 AM) *
So, I need to make spaces between words and brackets?

Spaces (and new lines) are optional. It should work so long as you follow the syntax, like the error says. SQL query parse errors can be annoying.

Reply

alex1985
Thank you. I got it. If I have any more questions I let you know.

Reply

Latest Entries

alex1985
Thanks you guys. I will try to use yours, it seems better for me.

Reply

rvalkass
QUOTE(jlhaslip @ Mar 10 2008, 07:01 PM) *
Check the code that is posted above. It is using a salt value already.

SQL
INSERT INTO login (username,password,email,activated) value ('admin',sha1(concat('yourpasswordhere','0dAfghRqSTgx')),'youremailhere','1');


Personally I prefer a random salt rather than a fixed one. A fixed salt requires one edited dictionary file. Whereas a system with a different hash for each person requires an entirely separate dictionary, and corresponding hashes, for each user.

Reply

jlhaslip
QUOTE
A good idea is to 'salt' the password


Check the code that is posted above. It is using a salt value already.

SQL
INSERT INTO login (username,password,email,activated) value ('admin',sha1(concat('yourpasswordhere','0dAfghRqSTgx')),'youremailhere','1');

Reply

rvalkass
QUOTE(alex1985 @ Mar 10 2008, 05:40 PM) *
Well, I just wanna ask you if it's good or appropriate way to encrypt the password. I checked the entry on PHPMyAdmin, and it does really encrypt the password. So, I can do that?!


SHA1 is a good way to encrypt passwords at the moment. You would also be wise to 'salt' the passwords. This is a way to prevent against dictionary attacks. Many people are still stupid enough to pick a single dictionary word as a password. That is incredibly insecure, even if the password is hashed.

A good idea is to 'salt' the password. That simply means adding some random values to the end of the password, before hashing it and saving it in the database. To do this, when the password is created, also create some random data using the rand() function, or something similar. Put this random value on the end of the user's password, then hash it, then put it in the database. You also need to store the random data in the database!!!

Then, to check the password entered by a user, take their username, and pull the relevant piece of random data, along with the hash for their password from the database. Tag the stored random data onto the end of the password they entered, and hash that whole string. If that matches the one in the database then the password they entered is correct.

It can seem a little complicated at first, but it is much more secure than just hashing a user-entered password.

Reply

galexcd
QUOTE(alex1985 @ Mar 10 2008, 10:40 AM) *
Well, I just wanna ask you if it's good or appropriate way to encrypt the password. I checked the entry on PHPMyAdmin, and it does really encrypt the password. So, I can do that?!


Well I'm not quite sure if sha1() is an sql function but I may be wrong, but it is a php function. And yes sha1 is a good encryption to use for encrypting passwords. It is similar to md5 but the hash is longer.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Similar Topics

Keywords : sql, query, mistake,

  1. Will Muslims Have 72 Virgins In Heaven? Probably Not...
    According to the varying translations, this could be a mistake (10)
  2. Qupis Sub-domain Query
    (1)
    Hi Qupis Moderators I want to cancel my current Qupis subdomain name to register another one...is
    that possible? my current qupis domain name : http://mintcamp.qupis.com please do delete that
    package and allow me to create new one...i want to register newer subdomain name n package.I
    didn't find any option to delete the current package,but i do find the option to create new
    one..But instead of increasing overhead with a unused sub-domain name i think u can delete my
    current sub-domain name.. Thanks and Cheers Mahehs ....
  3. Java Applet Query
    (1)
    Hey there, I have made an applet that shows images moving about the screen. I have pause/resume
    buttons that work. But i've noticed that when the applet is interuppted by something i.e moving
    another window over it, it will automatically repaint. My question is how can I stop this? How can
    I make it so that the only time that paint is called is when I want it to be called? Thanks in
    advance!....
  4. Mysql Query Problems
    I need some help or a tutorial? (6)
    I seem to be having trouble with getting my Query to post my user's ID numbers. CODE //
    Make a MySQL Connection mysql_connect("localhost", "user",
    "password") or die(mysql_error());
    mysql_select_db("databasename") or die(mysql_error()); // Retrieve
    all the data from the members table $result = mysql_query("SELECT * FROM members WHERE
    id='$id'") or die(mysql_error());   // store the record of the
    id table into $row $row = m....
  5. Newjoke.php [resolved]
    Mistake? (15)
    Hi, do you know what is the mistake in the following PHP code: It does give me the following
    message: QUOTE Parse error: syntax error, unexpected $end in
    /home/alex1985/public_html/mulhim/library_project/test_dir/newjoke.php on line 68 CODE
    <?php $dbcnx = @mysql_connect('localhost', 'root',
    'mypasswd'); if (!$dbcnx) { exit('<p>Unable to connect
    to the ' . 'database server at this time.</p>'); } if
    (!@mysql_select_db('ijdb')) { e....
  6. Where Am I Making Mistake
    (10)
    hello i have just started to learn java by myself and i am stuck here with this example i want to
    show a file in console please tell me where am i making mistake. i am getting erroe variable fin
    maight not be initialised here is the code CODE /** Display a text file To use this
    program,specify the name of file that you want to see */ import java.io.*; class showfile {
        public static void main(String args[])throws IOException     {         int i;
            FileInputStream fin;         try             {             BufferedReader br=new....
  7. Query Optimizations
    (2)
    http://www.kisekaeworld.com/Intractable/SQLOPT.pdf
    http://www.seas.upenn.edu/~netaylor/files/systems1005.pdf 2 links that i stumbled upon. Has some
    easy, useful and good query optimizations. Might be of some use to some. If you know few more
    please post it so that others might benefit from this.....
  8. Trap17 Home Page Banner Mistake
    (3)
    I just now noticed that the flash banner at the top of trap17's home page has an error. It says
    "THE BEST YOU CAN FIND ON WEB". Obviously it should read "on THE web" since "the web" is the phrase
    always used to refer to the internet, and not just web. This is about as major and noticeable a
    mistake as the site could make, so I think this especially needs to get fixed.....
  9. Has There Been A Mistake?
    I do not seem to have the default package. (8)
    Hi, I was wondering if there has been a mistake when my webspace was set up. I read that Trap 17
    offers 150 Mb webspace and 5Gb bandwidth per month. Yet, when I go to my control panel I seem to
    have only 20 Mb and 512 Mb bandwidth. That is why I temporarily had to move my site away from
    Trap17 as I ran out of webspace (I have filled 52.2 Mb of webspace so far). Could someone clarify
    this, please? Thanks. ....
  10. Business Intelligence Solutions, Bi Software, Query Analysis, Reporting Software, Report Writing Software
    BI solutions, Query analyzer, reporting software and Report Writer (0)
    Business intelligence QUOTE Business intelligence (BI) is a business management term,
    which refers to applications and technologies that are used to gather, provide access to, and
    analyze data and information about company operations. Business intelligence systems can help
    companies have a more comprehensive knowledge of the factors affecting their business, such as
    metrics on sales, production, internal operations, and they can help companies to make better
    business decisions. Business Intelligence should not be confused with competitive intelligence,
    which is....
  11. A Question Regarding Credits
    A query about upgrading. (8)
    Hi i understand that the starter package is 10 credits, and the advanced package is 30 credits do
    you offer any more space for additional credits? if no thats ok I just wanted to know as I was
    unsure on it, what I mean is once i get 30 credits for the second package can i request extra space
    for more credits...i hope i explained that right /sad.gif" style="vertical-align:middle" emoid=":("
    border="0" alt="sad.gif" />....
  12. Silly Mistake In Awarding Credits
    My sincere apology to Velma and Trap17 Members (14)
    Hello Members, It had come to my notice that we have distributed the credits to our members who
    have posted 12 hours before the ceremony time. I apologize for this mistake. I had to take a long
    drive on that very same day and I had requested Yratorm to open the topic at 5:30 IST PM instead of
    AM. The credits would be added to the members again. Initially, I was ignoring this issue because
    I didn't expect so much of dissatisfaction by some members. Also, I have been working on a new
    clustering project for a client's site. The credits awarding thing is a very t....
  13. Can't Delete A Folder On Server!
    a small mistake in a script.... (7)
    I maintain my college's website and since I update it frequently, I decided to
    write a php script that would backup all the data in a folder on the server itself. To backup all th
    e data I would only need to run the script once in a while: function dircpy($basePath,
    $source, $dest, $overwrite = false) { print
    "============================================================================ ";
    if(!is_dir($basePath . $dest)) mkdir($basePath . $dest);
    if($handle = opendir($basePath . $source)) {....
  14. Trap17 Ftp Settings
    There is a mistake in the trap17 FTP server address (3)
    After you are approved for free host account you must activate by going to a link sent in an email.
    On the confirmation page that appears after the activation script is finished you will see all sorts
    of data including your web URL and how to access control panel etc. .. At the bottom of the page for
    those who would rather configure an FTP program like Dreamweaver or CuteFTP you will see the FTP
    server address listed as: ftp.projectorange.trap17.com.com This is wrong and should read:
    ftp.projectorange.trap17.com Do not use passive ftp Host directory is optional (set....
  15. Simple Mysql Query Limiting
    (9)
    Simple MySQL Query Limiting CODE <?php // If mypage?limit=blah is not defined returs 5
    if ( $_GET['limit'] == NULL ) {     $limit = 5; } // Else else {
        $limit = $_GET['limit']; } $query = mysql_query("SELECT
    * FROM members LIMIT '$limit'") or die(mysql_error()); while
    ($sql = mysql_fetch_array ($query) ) {     echo
    $sql['mem_name'] . '<br>'; } ?> Have fun......
  16. Mysql Query
    (2)
    theres a bug somewhere in this query and i can't seem to find it. does anyone else see it?
    CODE $query = "insert into templates
    (tuid,tname,tdescription,template,archivedefault) values (1,'Sample Archive
    Template','A sample archive template that only shows the name of the article with a link to
    the default article viewer.','<a
    href='viewarticle1.php?aid=[id]'>[articletitle]</a>',FALSE&#
    41;"; ....
  17. Html Query
    HTML Query (2)
    OK, so I want to know if it's possible to have my links as a seperate file and simply reference
    that file in the rest of my site's pages so that if I change the links, I don't have to go
    and edit every single page of my site. Does anyone know how to do this?....
  18. Using And?or In A Mysql Query
    (2)
    hi everyone,


    I have been trying to get a script to come up with the total number of comments a news item has
    under it
    news ....
  19. Error Importing Sql Query Via Php
    Works in PHPmyAdmin (6)
    CODE     function sql()     {         $fp =
    fopen("sql.sql","r");         $sql =
    fread($fp,filesize("sql.sql"));         fclose($fp);
            return $sql;     } Thats $this->sql and here is the other source CODE
    function insert_sql()     {     if($_GET['insert'])  {
            $template = new template;         $db = new db;
            $db->connect();         $query = $this->sql();       ....
  20. Query On Buying Links
    (0)
    Hi, I am stranded here, i need your help. Can anyone kindly explain me to a company from which I
    can buy quality backlinks within the field of hardware-IT? I want to buy a link here:
    http://www.linkcountdown.com/ because I can sell it in future if I change my mind. Also there are
    other companies that offer 10,000 links , some are of high PR rank others are useless and not
    relative to the subject, if so does it mean that one has to buy & go through several companies
    before collecting good 100 related links? Do i have to buy thousands of links in all fields prior to
    col....
  21. Price Query
    (1)
    Its highly likely within the next week I will be needing to opt for paid hosting as I need more
    diskspace. Could you let me know the cost in GB Pounds how much it would be for Plan3S and a .net
    domain. Thanks....
  22. Disk Usage Query
    (2)
    The xoops script I installed was taking up nearly all my available disk usage (18.44mb) so I decided
    to uninstall xoops & start again using a smaller script. I deleted everything relating to xoops,
    including the mysql database, checked the disk usage screen which showed hardly anything, went to
    install another script but I am still using 18.44 mb. Am I missing something blatantly obvious
    which I need to do to lower this? Thanks ....
  23. Sony Spelling Mistake?
    (22)
    Found this, this morning and had to chuckle. The site has images of Select being spelt wrong on the
    PS3 controller. This on the back of reading the other day, the components don't even fit into
    the casing properly Oh, I do love Monday morning humour: Sony Spelling Mistake ....
  24. Whoops
    I think I made a mistake in requesting hosting. [/moronic] (2)
    Hey all. I think I accidentally used this form: http://www.trap17.com/process/create_account.htm
    instead of this form: http://www.forum500.com/req_form.php?siten...o&introname=new So, my bad (I
    think). What exactly am I supposed to do now, since I wanted the second free hosting plan thing. I
    would just submit the new one, but then that might look as if I was applying for two hosting
    services (which is not what I want to do, nor appear to be doing). Thanks for your understanding,
    and again, I apologize for my stupidity =D....
  25. Query About Maximum Number Of Free Hosting Accounts
    (5)
    How many accounts can a user have in the free hosting service.....
  26. Query Not Running When Submitting A Form
    (3)
    Im having trouble getting my PHP to work. Basically i have a form with a button linking to a php
    file. When i click submit it calls this file and is suppost to add the data to a database. Im using
    a my sql databse and it connects fine. Unfortunately when i click submit all i get is the
    "Inspection did not add". From this i know i have made a connection with the database and im
    absolutely 100% sure that all field names are correct on the forms and database. Any ideas? Heres
    the script.... PHP Code: CODE <html> <head> <meta http-equiv="C....
  27. Have You Ever Break Up With Someone
    and realise it was a mistake? (15)
    I have a burning question, Has anyone dumped someone only to realize that it was a mistake. I ended
    a relationship about six months ago, and after three months, I started to miss my ex-girlfriend. At
    first i felt like she was the one who wanted to break up, so trying to protect myself, i did the
    dumping. It wasn't so hard, cause i felt I came out unscathed...but after a few months, I
    realized that i was wrong. I was not going through that guilt period that many went through in a
    break up, I really I did some bad stuff pushing my ex-girlfriend away. We haven't tal....
  28. .htaccess Query
    (0)
    I wasn't sure where exactly to post this, so I'm just going to post it in the HTML section.
    Alright, basically what I want to know is if tehre is some sort of .htaccess code i could use on a
    domain so that a certain file is shown in the header and/or footer of any subdomain? So, for
    example I added this code and made it include a file Pageheader.php into every subdomain, with the
    contents I am a test file in it, if i hosted someone as a subdomain, it would show up as "I am a
    test file" then the rest of their page? also, if this is possible, would there be any ....
  29. Is Php5 & Downloads Supported?
    Query : Services offered by Trap17 (4)
    There are only a few small differences between php 4 and php 5 but some php 5 doesnt work on this
    site. Does the site allow php 5. Im wondering cause all i no is php 5 and some stuff isnt working.
    Also would it be alright if i took some stuff and uploaded it on my website for people to download.
    Or is there restrictions and stuff....
  30. Sig Of The Week #6 Winner (truefusion)
    terribly sorry for the mistake (3)
    My bad guys. I can't read, so I ended up putting down Michael as the winner for Sig of the Week
    #6. Anyway, the real winner is truefusion. Here is your tab: CODE
    [IMG]http://img316.imageshack.us/img316/91/minibanner2bu.gif[/IMG] I hope
    you don't mind, but I cut off the trap17 part because your name is too long. And if you're
    interested, here is the sig that helped him win: ....

    1. Looking for sql, query, mistake,

Searching Video's for sql, query, mistake,
advertisement



Sql Query - Mistake?



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE