Jump to content

Recommended Posts

I can't figure out what I'm doing wrong. Does anyone see what I'm doing wrong with this update inquiry? All of the code works elsewhere except the update inquiry, I think that's where the problem is.

 

$username = 'testname3';
$title = strip_tags($_POST['title_u']);
$email = strip_tags($_POST['email_u']);
$phone = strip_tags($_POST['phone_u']);
$state = strip_tags($_POST['state_u']);
$availability = strip_tags($_POST['availability_u']);
$description = strip_tags($_POST['description_u']);

$linkID = @mysql_connect('localhost', 'root', 'pasyes')
or die('Could not connect');

@mysql_select_db('breederlist') or die ('Could not get DB');
$query = "UPDATE listing SET title='$title', email='$email',
phone='$phone', state='$state', availability='$availability', description='$description'
WHERE rowID='$username'";

$result = mysql_query($query);

if ($result) echo $username . " updated.";
else echo "Trouble updating";

Link to comment
https://forums.phpfreaks.com/topic/65140-trouble-upadating-a-mysql-row/
Share on other sites

It echos my error message 'trouble updating.' The database connection works. If I replace the update query with another query, like this one:

 

$query = "INSERT INTO listing SET username='$username', title='$title', email='$email',
phone='$phone', state='$state', availability='$availability', description='$description'";

 

It works fine.

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.