Reply to Re: QUERY AND UPDATE PROBLEM

Your name:

Reply:


Posted by Jerry Stuckle on 02/24/06 06:19

Lag wrote:
> I added a count ($count) to see if or how many rows were being
> affected.............even though I am tagging them by id, which auto
> increments for each new event. I am not selecting any row, even though
> I know the id is correct. I went into the database to make sure.
>
> This is the code and the result of running the code.
>
> //---UPDATE ENTRY IN DATABASE---
> $result = mysql_query("SELECT * FROM calendar_events WHERE
> id='.$event'",$conn);
> $count = mysql_num_rows($result);
> $query = "UPDATE calendar_events SET event_title = '$title',
> event_start = '$date', event_shortdesc = '$desc' WHERE id = '$result'";
> mysql_query($query) or die(mysql_error());
>
> //LIST ITEMS
> echo "$event $title $date $desc";
>
> echo "<br>Record Updated! Rows Affected: $count";
> mysql_close();
>
> ?>
>
> This is the result....
>
> test2 2006-02-23 01:00:00 test
> Record Updated! Rows Affected: 0
>

What is the type of column `id`? If it's numeric, then it should NOT be
in single quotes.

Also in your update statement $result is a result set, not an id. You
need to use "UPDATE calendar_events..... WHERE id= '$event'".

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация