Rkboss Rkboss - 8 months ago 30
PHP Question

How do I get 'id' from database to update a particular row?

I am trying to update a row which is already in database, and i am using above code for that but it gives me error as 'undefined id', so how can i do this.....please help me!!!

$getid="select id from login";


foreach($ride as $entry){
$flt .= $entry.",";
foreach($city as $entry){
$ct .= $entry.",";

$query ="UPDATE login SET rides='$flt',price=$pri,about='$about',city='$ct' WHERE id='$ids'";

$result = mysql_query($query);
echo $result;
if(!$result) {
echo '<script language="javascript">';
echo 'alert("something went Wrong...:(");
echo '</script>';
echo '<script language="javascript">';
echo 'alert("successfully updated!!!");
echo '</script>';

$res=mysql_query($getid); $ids=$_GET[$row['id']];

You need to fetch the id by executing and fetching If you want all ids then you must store it in array and then implode it or concatenate in a single variable then use it in where condition of update query use IN clause