Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Mysql executing the content in a field!?

Codes here !

Moderators: macek, egami, gesf

Mysql executing the content in a field!?

Postby gesf » Tue Jun 10, 2003 3:38 pm

Hi guy.
I made a script to my tutorials section. All the information is in a db. So i have to save the tutorials code in the db. But when i saving something like an guestbook code that include mysql command, i´t gives me an error, as if it was to execute the code of the tutorial that I am saving. The field of the tutorial content or code had TEXT type.
Well... how can i save in a database tutorials code that includes mysql commands?
thx
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Re: Mysql executing the content in a field!?

Postby WiZARD » Wed Jun 11, 2003 2:00 am

gesf wrote:Hi guy.
I made a script to my tutorials section. All the information is in a db. So i have to save the tutorials code in the db. But when i saving something like an guestbook code that include mysql command, i´t gives me an error, as if it was to execute the code of the tutorial that I am saving. The field of the tutorial content or code had TEXT type.
Well... how can i save in a database tutorials code that includes mysql commands?
thx

what particularlyis error?
what MySQL tell to you?
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby gesf » Wed Jun 11, 2003 12:36 pm

Sorry WiZARD, i forgot that!
Ok, here goes:

// It gives me the same error with an update or an insert command!
1º: // I´m just inserting the name of the tutorial "test" and the content
Code: Select all
Error in MySQL-Query
in query: INSERT INTO tutorials VALUES ("", "0", "test", "", "", "", " //CREATE TABLE guestbook ( // id int(11) NOT NULL auto_increment, // name varchar(30) NOT NULL default '', // email varchar(75) NOT NULL default '', // url varchar(30) NOT NULL default '', // info text NOT NULL, // time varchar(40) NOT NULL default '', // PRIMARY KEY (id), // KEY id (id) //) TYPE=MyISAM;

2º // part of the tutorial appear executed, after the 1º error.
Code: Select all
Name:  Email:  Http:  Comment:
0) { while($row = mysql_fetch_array($result)){ $time = date("d-m-y H:i",$row[time]); echo "$row[name]: "; if($row[email] != "") { echo "| email "; } if($row[url] != "") { echo "| www "; } echo "$time
"; echo "$row[info]

"; } } echo "
"; mysql_close(); ?>", "0", "", "", "")



Code: Select all
server's comment: You have an error in your SQL syntax near '0" cellspacing="0">
Name: ' at line 1


Code: Select all
in module: insert.inc.php on line: 11

It seems that it is execunting that. Can the problem be on my mysql client?
well...thx!
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby WiZARD » Thu Jun 12, 2003 12:53 am

1º:
Code: Select all
Error in MySQL-Query
in query: INSERT INTO tutorials VALUES ("", "0", "test", "", "", "", " //CREATE TABLE guestbook ( // id int(11) NOT NULL auto_increment, // name varchar(30) NOT NULL default '', // email varchar(75) NOT NULL default '', // url varchar(30) NOT NULL default '', // info text NOT NULL, // time varchar(40) NOT NULL default '', // PRIMARY KEY (id), // KEY id (id) //) TYPE=MyISAM;

it's a delirium! how you may insert info and create table in one time???? :? maby you miss something....

2º // part of the tutorial appear executed, after the 1º error.
Code: Select all
Name:  Email:  Http:  Comment:
0) { while($row = mysql_fetch_array($result)){ $time = date("d-m-y H:i",$row[time]); echo "$row[name]: "; if($row[email] != "") { echo "| email "; } if($row[url] != "") { echo "| www "; } echo "$time
"; echo "$row[info]

"; } } echo "
"; mysql_close(); ?>", "0", "", "", "")



Code: Select all
server's comment: You have an error in your SQL syntax near '0" cellspacing="0">
Name: ' at line 1

i recommend to use EMS MySQL Manager very good!!!

Code: Select all
in module: insert.inc.php on line: 11

try publish all code.....
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol

Postby gesf » Thu Jun 12, 2003 2:45 am

I´m not insert info and creting a table at the same time! That "CREAT TABLE code", is from the tutorial that i am inserting, that´s why i´m saying that it´s executing the info that i am inserting.
I think that the problem is here: ' '. When it is updating the value, it generate an error when it find the same ' ' on the info.
I´ll try to comment all the info that i´m inserting like puting \" or /*, just to make sure that the problem is not on the ''.

Can u tell me where i can download that EMS MySQL Manager ?
Thx!
Last edited by gesf on Fri Jun 13, 2003 3:36 am, edited 1 time in total.
User avatar
gesf
Moderator
Moderator
 
Posts: 1718
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby WiZARD » Fri Jun 13, 2003 12:16 am

EMS MySQL Manager: http://ems-hitech.com/mymanager/

>And how can i Publish the code?
i mean in forum put code, or
just give link to code whare you get it
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.