mysql_affected_rows() usage


Posted on 16th Feb 2014 07:03 pm by admin

Possibly a MySQL issue, but the function that is not behaving in the anticipated way is a PHP function.

Seems as though mysql_affected_rows() is not returning the desired number so I can move into my if statement.

This is just a snippet. Let me know if more code might be needed to diagnose.
Code: <?php
dbconnect();
$sql = "INSERT INTO `registration` (`id`, `the_date`, `first_name`, `last_name`, `email`, `phone`, `street_address`, `city`, `state`, `zip`, `emergency_contact`, `emergency_phone`, `high_school`, `test_score`, `major_interest`, `gpa`, `activity1`, `activity2`, `activity3`, `activity4`, `recruitment`, `recruitment_explain`, `travel`, `language`, `language_years`, `rotc`, `interests`, `accommodations`, `pay`) VALUES (NULL, '{$the_date}', '{$first_name}', '{$last_name}', '{$email}', '{$phone}', '{$street_address}', '{$city}', '{$state}', '{$zip}', '{$emergency_contact}', '{$emergency_phone}', '{$high_school}', '{$test_score}', '{$major_interest}', '{$gpa}', '{$activity1}', '{$activity2}', '{$activity3}', '{$activity4}', '{$recruitment}', '{$recruitment_explain}', '{$travel}', '{$language}', '{$language_years}', '{$rotc}', '{$interests}', '{$accommodations}', 'N')";
$result = mysql_query($sql) OR DIE ('//INSERT error<br />Please report this to the site admin <a href="/contact/index.php">here</a>.<br /><br />'.mysql_error());
if (mysql_affected_rows($result)==1)
{
//send email
?>

No comments posted yet

Your Answer:

Login to answer
279 Like 36 Dislike
Previous forums Next forums
Other forums

Search in the PHP Files
have to search asterisk(*) in the php code of the php files .
In the html page one text box

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

CHECH A STRING FOR ' " ' (DOUBLE QUOTES)
I am checking for delimiter (.!?) and if there is a " after a sentence then it should neglect a

Sequencing or queuing parallel process
Scenario is as follows
There is one parent process say P1 and 4 child processes say A B C D

import table with dependency
Hi

What is the best way to import table back which has dependency?

SQL> cre

Getting rid of quotes when printing data
Hi Guys, I use the filter_var FILTER_SANITIZE_STRING to filter the textarea input. The function esca

matching numbers inside ( )
I know I can match numbers by just [0-9]+, so I thought matching numbers inside ( ) would be somethi

Do While statement
hi guys,

This may sound trivial but im new to php and as part of an assignmenti have to const

Unifying logins of two different scripts
I have two different game scripts which I want to embed on my own site. The problem is I don't want

Session login issue
I'm wondering how to fix a problem I'm having with a session-based login system

Say I go to h

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash