Poslao: 03 Mar 2007 23:08
|
offline
- Pridružio: 30 Sep 2006
- Poruke: 137
|
when i try to create a table with space between the name it says that there is an error. I was reading some stuff and i found a post on some forum and it says that when u wrote "create table 'table1 ' (x int) " it give a error and that this is a bug in mysql, but the post was wroted in 2004, so now this bug is fixed.
now i m trying to create table with space between the name something like "table one", and this gives a error.
Ok maybe in mysql manager there is a rule that we shouldnt write spaces between the name.
But maybe this can be fixed when we will integrate in php.
...
<input type="text" name="table">
<input type="text" name="name">
<input type="text" name="question">
...
$query = "create table $table (ID int(10) unsigned not null primary key auto_increment, name varchar(64), question text)";
the input text box should be something a short version of the question
let me give a example;
i will write "How to..." in the first text box, this mean that the table name should be "How to..." , but it will return an error because the space between "How" and "to...".
second i will write my name(this is not very important) in the second text box
and third i will write the hole question in the third text box.
so my point is, is this a bug or there is a function or something like that for this problem?
u can write in serbian if u want
|
|
|
Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
|
|
Poslao: 03 Mar 2007 23:23
|
offline
- Peca
- Glavni Administrator
- Predrag Damnjanović
- SysAdmin i programer
- Pridružio: 17 Apr 2003
- Poruke: 23211
- Gde živiš: Niš
|
First, I never seen table with a 'blank' character in name.
I think it is not by SQL standard at all.
Use _ instead blank character... for example: table_one
Second, try:
$query = "create table ".$_POST['table']." (ID int(10) unsigned not null primary key auto_increment, name varchar(64), question text)";
I assume you use POST method in <form>.
|
|
|
|
Poslao: 04 Mar 2007 17:24
|
offline
- Pridružio: 30 Sep 2006
- Poruke: 137
|
Peca ::First, I never seen table with a 'blank' character in name.
I think it is not by SQL standard at all.
Use _ instead blank character... for example: table_one
yes i know that i should underscore instead a space.
Peca ::
Second, try:
$query = "create table ".$_POST['table']." (ID int(10) unsigned not null primary key auto_increment, name varchar(64), question text)";
I assume you use POST method in <form>.
Yes the method is POST.
Imagine a forum, and u want to make a new post on that forum, and when u create a new post with that u r creating the table which will hold the questions , answers of the users.
So u want the name of that post to be, let's say "How to make ....", ofcourse it will be stupid to write "How_to_make_...". That is my point.
|
|
|
|
Poslao: 04 Mar 2007 18:18
|
offline
- Peca
- Glavni Administrator
- Predrag Damnjanović
- SysAdmin i programer
- Pridružio: 17 Apr 2003
- Poruke: 23211
- Gde živiš: Niš
|
Totaly wrong logic.
You have to insert data to one or two [max three] tables that will contain all posts, questions and answers.
Creating a table for every post is totaly insane, brother
|
|
|
|
Poslao: 04 Mar 2007 18:25
|
offline
- Rastafarii
- Moderator foruma
- Pridružio: 22 Mar 2006
- Poruke: 3760
- Gde živiš: 127.0.0.1
|
I agree with Peca, creating a table for every post (or even topic) would be totally insane
You can always use str_replace(); if you want to replace spaces with underscores... something like:
$title = str_replace(" ", "_", $title);
and you'll get "How_to_make..." instead of "How to make..."
|
|
|
|
Poslao: 04 Mar 2007 22:39
|
offline
- Pridružio: 30 Sep 2006
- Poruke: 137
|
Peca ::Totaly wrong logic.
You have to insert data to one or two [max three] tables that will contain all posts, questions and answers.
Creating a table for every post is totaly insane, brother
ok i know u are right. just tell me when i click 'nova tema', i m creating a new table or a new record?
Rastafarii ::I agree with Peca, creating a table for every post (or even topic) would be totally insane
You can always use str_replace(); if you want to replace spaces with underscores... something like:
$title = str_replace(" ", "_", $title);
and you'll get "How_to_make..." instead of "How to make..."
damn man where were u till now tnx for the tip
|
|
|
|
Poslao: 04 Mar 2007 22:45
|
offline
- snoop
- Genghis Khan
- Pridružio: 18 Apr 2003
- Poruke: 8134
- Gde živiš: U kesici gumenih bombona...
|
@ Rutix
When you click 'Nova tema' you are creating new record.
|
|
|
|
|