# Problem, "Unknown column 'Jon' in 'field list'"

• (3 Pages)
• 1
• 2
• 3

## 37 Replies - 14168 Views - Last Post: 28 December 2012 - 04:11 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=305021&amp;s=a75e7cc529d9e4e2919b334896b230fc&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #16 sebwerner2

Reputation: 0
• Posts: 21
• Joined: 27-December 12

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:09 AM

So i put a quote around the names on all the VARCHAR feilds?

### #17 Dormilich

• 痛覚残留

Reputation: 4202
• Posts: 13,276
• Joined: 08-June 10

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:10 AM

that would be a start.

### #18 sebwerner2

Reputation: 0
• Posts: 21
• Joined: 27-December 12

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:11 AM

raghav.naganathan, on 28 December 2012 - 02:10 AM, said:

sebwerner2, on 28 December 2012 - 02:35 PM, said:

it works with numbers...

You mean to say day, month and year works with numbers right?...that is because you have given the datatype as int

regards,
Raghav

No, the VARCHAR fields only work with numbers, not letters at all...

### #19 Dormilich

• 痛覚残留

Reputation: 4202
• Posts: 13,276
• Joined: 08-June 10

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:15 AM

question, why do you have separate fields for day/month/year? you can easily get those out of SQL (date functions!) and additionally SQL can do date calculations on a proper DATE field.

### #20 sebwerner2

Reputation: 0
• Posts: 21
• Joined: 27-December 12

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:16 AM

Dormilich, on 28 December 2012 - 03:10 AM, said:

that would be a start.

I tried, unfortunately it didnt work...
But how do i put quotes around a variable?

### #21 Dormilich

• 痛覚残留

Reputation: 4202
• Posts: 13,276
• Joined: 08-June 10

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:20 AM

sebwerner2, on 28 December 2012 - 11:16 AM, said:

But how do i put quotes around a variable?

is that a trick question?

\$ex = "some '\$quotes' in a string";

### #22 sebwerner2

Reputation: 0
• Posts: 21
• Joined: 27-December 12

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:22 AM

Dormilich, on 28 December 2012 - 03:20 AM, said:

sebwerner2, on 28 December 2012 - 11:16 AM, said:

But how do i put quotes around a variable?

is that a trick question?

\$ex = "some '\$quotes' in a string";

hahah xD No i really didnt knew, but hey thanks! U really learn somthing new everyday, eh?

### #23 sebwerner2

Reputation: 0
• Posts: 21
• Joined: 27-December 12

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:30 AM

I have no idea Nothing seems to work, i've tried every thing u guys said, and i appriciate it, i really do!

### #24 Dormilich

• 痛覚残留

Reputation: 4202
• Posts: 13,276
• Joined: 08-June 10

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:37 AM

what is the current state of code?

### #25 sebwerner2

Reputation: 0
• Posts: 21
• Joined: 27-December 12

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:39 AM

```<?php
\$mysql_host="****";
\$mysql_database_name="****";

//Textbox information
\$name=\$_POST['name'];
\$surename=\$_POST['surename'];
\$day=\$_POST['day'];
\$month=\$_POST['month'];
\$year=\$_POST['year'];
\$gender=\$_POST['gender'];
\$report=\$_POST['raport'];

// Make a MySQL Connection
mysql_select_db(\$mysql_database_name) or die(mysql_error());

// Insert a row of information into the table "report"
mysql_query("INSERT INTO report(firstname,surename,day,month,year,gender,report) VALUES('\$name', '\$surename', '\$day', '\$month', '\$year', '\$gender', '\$report')") or die(mysql_error());

//Suceeed message
echo "Data Inserted!";

?>

```

iI've quoted the variables />

This post has been edited by Dormilich: 28 December 2012 - 03:42 AM

### #26 Dormilich

• 痛覚残留

Reputation: 4202
• Posts: 13,276
• Joined: 08-June 10

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:44 AM

sebwerner2, on 28 December 2012 - 11:39 AM, said:

I've quoted the variables

including the numbers, which go without quotes.

### #27 sebwerner2

Reputation: 0
• Posts: 21
• Joined: 27-December 12

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:46 AM

Dormilich, on 28 December 2012 - 03:44 AM, said:

sebwerner2, on 28 December 2012 - 11:39 AM, said:

I've quoted the variables

including the numbers, which go without quotes.

Omfg! It worked! Thank you so much man! It actually did! Im so happy, iv'e been struggeling with this for 4-5 hours now D:

### #28 Dormilich

• 痛覚残留

Reputation: 4202
• Posts: 13,276
• Joined: 08-June 10

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:48 AM

so, and now for the SQL injection problem …

### #29 sebwerner2

Reputation: 0
• Posts: 21
• Joined: 27-December 12

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:48 AM

Now i will make a login system, and a table to show the MySql table, in a list or something!

### #30 Dormilich

• 痛覚残留

Reputation: 4202
• Posts: 13,276
• Joined: 08-June 10

## Re: Problem, "Unknown column 'Jon' in 'field list'"

Posted 28 December 2012 - 03:50 AM

first you need to get rid of the SQL Injection problem.