Jump to content

HTML Form not inserting to mysql... no errors reported


Recommended Posts

@Doc, I don't know why your database structure looks like this:

Array
(
   o=> u_id

[Field] => u_id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => PRI
    [Key] => PRI
    [4] =>
    [Default] =>
    [5] => auto_increment
    [Extra] => auto_increment
)
Array
(
   

    o=> id

[Field] => id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] =>
    [Key] =>
    [4] =>
    [Default] =>
    [5] =>
    [Extra] =>
)
Array
(
   

    o=> site_id

[Field] => site_id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] =>
    [Key] =>
    [4] =>
    [Default] =>
    [5] =>
    [Extra] =>
)
Array
(
etc.....
)

 

I'd give you advise, to create the same table again..

 

  • Replies 81
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

@Doc, I don't know why your database structure looks like this:

Array
(
   o=> u_id

[Field] => u_id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => PRI
    [Key] => PRI
    [4] =>
    [Default] =>
    [5] => auto_increment
    [Extra] => auto_increment
)
Array
(
   

    o=> id

[Field] => id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] =>
    [Key] =>
    [4] =>
    [Default] =>
    [5] =>
    [Extra] =>
)
Array
(
   

    o=> site_id

[Field] => site_id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] =>
    [Key] =>
    [4] =>
    [Default] =>
    [5] =>
    [Extra] =>
)
Array
(
etc.....
)

 

I'd give you advise, to create the same table again..

 

 

How would re-creating the same table do any good?  If there is something wrong with my current setup? 

@Doc, take a look at this link -> http://www.reg.ca/faq/PhpMyAdminTutorial.html

 

All that shows me is how to use phpmyadmin.. Which I already know how to use (and use on a regular basis).

 

Here is the table we have been working on in PHPMyAdmin with the data that went in there before the form just magically "stopped working".

 

post-115128-13482403677605_thumb.png

Okay, go to phpmyadmin again and export the table.

Post out only the line(s) that begin with,

Example

CREATE TABLE IF NOT EXISTS `tbl_name` (
  `id` int(11) NOT NULL,
  `name` varchar(244) NOT NULL,
  `email` varchar(14) NOT NULL,
  `date` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Okay, go to phpmyadmin again and export the table.

Post out only the line(s) that begin with,

Example

CREATE TABLE IF NOT EXISTS `tbl_name` (
  `id` int(11) NOT NULL,
  `name` varchar(244) NOT NULL,
  `email` varchar(14) NOT NULL,
  `date` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

CREATE TABLE IF NOT EXISTS `applications` (
  `u_id` int(11) NOT NULL AUTO_INCREMENT,
  `id` int(11) NOT NULL,
  `site_id` int(11) NOT NULL,
  `timestamp` int(55) NOT NULL,
  `ip` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `username` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `steam` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `xfire` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `email` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `games` varchar(1000) COLLATE utf8_unicode_ci NOT NULL,
  `why_join` longtext COLLATE utf8_unicode_ci NOT NULL,
  `clan_history` longtext COLLATE utf8_unicode_ci NOT NULL,
  `recruit` varchar(300) COLLATE utf8_unicode_ci NOT NULL,
  `age` int(3) NOT NULL,
  `location` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `microphone` int(11) NOT NULL,
  `recruit_style` int(11) NOT NULL,
  `app_status` int(11) NOT NULL,
  `division` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `notes` longtext COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`u_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ;

Also you're saying you don't get an error from the or die(mysql_error()) part, but the query doesn't execute? Do you have error reporting turned on and error logging off for dev?

 

Error Reporting should be turned on.  When I added "ini_set('display_errors', 1); error_reporting(E_ALL);" to the page, an error was shown.. But I fixed it, and now no errors.  However, the query still does not execute successfully.

There is nothing wrong, I just created few minutes ago the same table and that's correct result:

Array
(
    [0] => u_id
    [Field] => u_id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => PRI
    [Key] => PRI
    [4] => 
    [Default] => 
    [5] => auto_increment
    [Extra] => auto_increment
)

Array
(
    [0] => id
    [Field] => id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => site_id
    [Field] => site_id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => timestamp
    [Field] => timestamp
    [1] => int(55)
    [Type] => int(55)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => ip
    [Field] => ip
    [1] => varchar(100)
    [Type] => varchar(100)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => name
    [Field] => name
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => username
    [Field] => username
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => steam
    [Field] => steam
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => xfire
    [Field] => xfire
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => email
    [Field] => email
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => games
    [Field] => games
    [1] => varchar(1000)
    [Type] => varchar(1000)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => why_join
    [Field] => why_join
    [1] => longtext
    [Type] => longtext
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => clan_history
    [Field] => clan_history
    [1] => longtext
    [Type] => longtext
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => recruit
    [Field] => recruit
    [1] => varchar(300)
    [Type] => varchar(300)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => age
    [Field] => age
    [1] => int(3)
    [Type] => int(3)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => location
    [Field] => location
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => microphone
    [Field] => microphone
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => recruit_style
    [Field] => recruit_style
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => app_status
    [Field] => app_status
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => division
    [Field] => division
    [1] => varchar(150)
    [Type] => varchar(150)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => notes
    [Field] => notes
    [1] => longtext
    [Type] => longtext
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

In your original code, replace this line


$app_application = mysql_query("INSERT INTO applications 
(id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip) VALUES('$application_id', '$site_id', '$timestamp', '$_POST[name]', '$_POST[i_name]', '$_POST[username]', '$_POST[steam]', '$_POST[xfire]', '$_POST[email]', '$_POST[games]', '$_POST[why_join]', '$_POST[age]', '$_POST[location]', '$_POST[microphone]', '$_POST[recruit_style]', '$_POST[clan_history]', '$_POST[recruit]', '$_POST[userIP]') ", $recruit_link) or die(mysql_error()); 

 

With this


$sql = "INSERT INTO applications 
(id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip) VALUES('$application_id', '$site_id', '$timestamp', '$_POST[name]', '$_POST[i_name]', '$_POST[username]', '$_POST[steam]', '$_POST[xfire]', '$_POST[email]', '$_POST[games]', '$_POST[why_join]', '$_POST[age]', '$_POST[location]', '$_POST[microphone]', '$_POST[recruit_style]', '$_POST[clan_history]', '$_POST[recruit]', '$_POST[userIP]') ";
echo $sql;
die();

 

What gets output?

Has it exceeded the max value for a signed int?

 

It shouldn't be.  The random number is limited to 6 characters.  Is the max INT not 2147483647 (10 characters)?

I can't tell from your screenshot which it is, but one of the columns is much larger than 6. Since you said it randomly stopped working, my first guess is a column is at it's maximum. It's clearly not the one that's 6 tho :)

In your original code, replace this line


$app_application = mysql_query("INSERT INTO applications 
(id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip) VALUES('$application_id', '$site_id', '$timestamp', '$_POST[name]', '$_POST[i_name]', '$_POST[username]', '$_POST[steam]', '$_POST[xfire]', '$_POST[email]', '$_POST[games]', '$_POST[why_join]', '$_POST[age]', '$_POST[location]', '$_POST[microphone]', '$_POST[recruit_style]', '$_POST[clan_history]', '$_POST[recruit]', '$_POST[userIP]') ", $recruit_link) or die(mysql_error()); 

 

With this


$sql = "INSERT INTO applications 
(id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip) VALUES('$application_id', '$site_id', '$timestamp', '$_POST[name]', '$_POST[i_name]', '$_POST[username]', '$_POST[steam]', '$_POST[xfire]', '$_POST[email]', '$_POST[games]', '$_POST[why_join]', '$_POST[age]', '$_POST[location]', '$_POST[microphone]', '$_POST[recruit_style]', '$_POST[clan_history]', '$_POST[recruit]', '$_POST[userIP]') ";
echo $sql;
die();

 

What gets output?

 

INSERT INTO applications (id, site_id, timestamp, name, c_name, username, steam, xfire, email, games, why_join, age, location, microphone, recruit_style, clan_history, recruit, ip) VALUES('3315', '3', '1344286825', 'Doc20', 'Doc', 'Doc', 'steam', 'xfire', 'test@test.com', 'games', 'why', '21', 'USA', '2', '1', 'history', 'C33Z', 'x.x.x.x')

There is nothing wrong, I just created few minutes ago the same table and that's correct result:

Array
(
    [0] => u_id
    [Field] => u_id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => PRI
    [Key] => PRI
    [4] => 
    [Default] => 
    [5] => auto_increment
    [Extra] => auto_increment
)

Array
(
    [0] => id
    [Field] => id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => site_id
    [Field] => site_id
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => timestamp
    [Field] => timestamp
    [1] => int(55)
    [Type] => int(55)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => ip
    [Field] => ip
    [1] => varchar(100)
    [Type] => varchar(100)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => name
    [Field] => name
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => username
    [Field] => username
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => steam
    [Field] => steam
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => xfire
    [Field] => xfire
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => email
    [Field] => email
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => games
    [Field] => games
    [1] => varchar(1000)
    [Type] => varchar(1000)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => why_join
    [Field] => why_join
    [1] => longtext
    [Type] => longtext
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => clan_history
    [Field] => clan_history
    [1] => longtext
    [Type] => longtext
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => recruit
    [Field] => recruit
    [1] => varchar(300)
    [Type] => varchar(300)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => age
    [Field] => age
    [1] => int(3)
    [Type] => int(3)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => location
    [Field] => location
    [1] => varchar(250)
    [Type] => varchar(250)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => microphone
    [Field] => microphone
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => recruit_style
    [Field] => recruit_style
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => app_status
    [Field] => app_status
    [1] => int(11)
    [Type] => int(11)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => division
    [Field] => division
    [1] => varchar(150)
    [Type] => varchar(150)
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

Array
(
    [0] => notes
    [Field] => notes
    [1] => longtext
    [Type] => longtext
    [2] => NO
    [Null] => NO
    [3] => 
    [Key] => 
    [4] => 
    [Default] => 
    [5] => 
    [Extra] => 
)

 

I'm beyond stumped.

For one, your table doesn't have the column c_name so it should fail there.

Secondly age is an int and you're inserting a string. '21' != 21 when it comes to SQL. Same for the other ints.

 

Copy and paste that query directly into phpMyAdmin. Does it give you an error now?

For one, your table doesn't have the column c_name so it should fail there.

Secondly age is an int and you're inserting a string. '21' != 21 when it comes to SQL. Same for the other ints.

 

Copy and paste that query directly into phpMyAdmin. Does it give you an error now?

 

Well... It's now working again.  It was the missing column that threw it for a loop.  It would have been nice if the error was output from the start =/  I can't believe it was something that simple.. Especially after when I checked, double and triple checked my columns to make sure the names I had in the code matched/existed..  Thanks to Jesirose and Jazzman1 for working through all the possibilities.

 

Also the int columns, the number 21 is all that is inserted.  The ' ' do not follow it.  Those are just in the VALUES section of that statement.  I guess the statement would execute without those, but I kind of like them there I suppose.

 

Thanks for all the help!

Here's something that will probably help with the 'no errors reported' condition.

 

Since you have two database connections, you MUST use the appropriate link identifier in the mysql_error(.....) statements so that you will get errors that were generated on the same link that the mysql_query statement is using. For the same reason you are putting the link identifier into the mysql_query statement, you must put it into the corresponding mysql_error statements.

 

What you are getting now, with no link identifier being used in the mysql_error() statements, is the mysql_error, if any, that occurred on the last link that was opened, which would be the $webspell_db connection.

Here's something that will probably help with the 'no errors reported' condition.

 

Since you have two database connections, you MUST use the appropriate link identifier in the mysql_error(.....) statements so that you will get errors that were generated on the same link that the mysql_query statement is using. For the same reason you are putting the link identifier into the mysql_query statement, you must put it into the corresponding mysql_error statements.

 

What you are getting now, with no link identifier being used in the mysql_error() statements, is the mysql_error, if any, that occurred on the last link that was opened, which would be the $webspell_db connection.

 

Duly noted!  Thanks :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.