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

batch file not building to webapps folder
Hello. I just started running Vista :P and can't seem to get my projects deployed. I found out how

pagination - need help on passing of search query.
Hi, i have been trying for days but couldn't get this sorted out. Would like some professional help

Displaying pictures
i have worked my way through storing images in directory and storing the location in mySQL db.Now i

imap: how to save a copy of sent emails to sent elements
Hello my friends,

I am writing an online emailing application with inbox outbox/sent elements

Turning Data into URLs?
This may seem very basic to you, but I'm having a hard time figuring out how to do this since I don'

problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo

PHP mail() rejected by SMTP
I'm currently working on a newsletter application which is installed on a windows 2003 server runnin

How to know if online site made with PHP
Hello,
I see some sites that does not display extensions at all , for example:

www.site.co

mail() problem
Hi Guys,

I've set up a contact email form. It sends the information fine, but it sends it to

php automatically escaping single quotes
I'm trying to test out my security a bit and I've noticed that php is escaping my single quotes. For

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