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

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

37 Replies - 6086 Views - Last Post: 28 December 2012 - 04:11 AM Rate Topic: -----

#16 sebwerner2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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?
Was This Post Helpful? 0
  • +
  • -

#17 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,236
  • Joined: 08-June 10

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

Posted 28 December 2012 - 03:10 AM

that would be a start.
Was This Post Helpful? 2
  • +
  • -

#18 sebwerner2  Icon User is offline

  • New D.I.C Head

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

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

Posted 28 December 2012 - 03:11 AM

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

View Postsebwerner2, 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...
Was This Post Helpful? 0
  • +
  • -

#19 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,236
  • 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.
Was This Post Helpful? 0
  • +
  • -

#20 sebwerner2  Icon User is offline

  • New D.I.C Head

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

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

Posted 28 December 2012 - 03:16 AM

View PostDormilich, 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?
Was This Post Helpful? 0
  • +
  • -

#21 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,236
  • Joined: 08-June 10

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

Posted 28 December 2012 - 03:20 AM

View Postsebwerner2, 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";
Was This Post Helpful? 1
  • +
  • -

#22 sebwerner2  Icon User is offline

  • New D.I.C Head

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

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

Posted 28 December 2012 - 03:22 AM

View PostDormilich, on 28 December 2012 - 03:20 AM, said:

View Postsebwerner2, 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?
Was This Post Helpful? 0
  • +
  • -

#23 sebwerner2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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!
Was This Post Helpful? 0
  • +
  • -

#24 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,236
  • 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?
Was This Post Helpful? 0
  • +
  • -

#25 sebwerner2  Icon User is offline

  • New D.I.C Head

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

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

Posted 28 December 2012 - 03:39 AM

<?php
//Database login information
$mysql_host="****";
$mysql_username="****";
$mysql_password="****";
$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_connect($mysql_host, $mysql_username, $mysql_password) or die(mysql_error());
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

Was This Post Helpful? 0
  • +
  • -

#26 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,236
  • Joined: 08-June 10

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

Posted 28 December 2012 - 03:44 AM

View Postsebwerner2, on 28 December 2012 - 11:39 AM, said:

I've quoted the variables

including the numbers, which go without quotes.
Was This Post Helpful? 1
  • +
  • -

#27 sebwerner2  Icon User is offline

  • New D.I.C Head

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

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

Posted 28 December 2012 - 03:46 AM

View PostDormilich, on 28 December 2012 - 03:44 AM, said:

View Postsebwerner2, 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:
Was This Post Helpful? 0
  • +
  • -

#28 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,236
  • 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
Was This Post Helpful? 0
  • +
  • -

#29 sebwerner2  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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! :D
Was This Post Helpful? 0
  • +
  • -

#30 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,236
  • 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.
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3