Jump to content

Data doesnt get updated


SpireLink

Recommended Posts

If you were to post the relevant script rather than give us a link to the full code, you'd probably get more responses. However, to get you started, try adding an or die statement to your query:

 

<?php
$update=" UPDATE players SET name='$name',recordid='$recordid',dob='$dob',tall='$tall',weight='$weight',picture='$picture'  WHERE id=$player_id";
$new_club=mysql_query($update,$db) or die(mysql_error().'<br />On query:'.$update);
?>

I'm afraid you've described your problem a bit ambiguously...do you mean to say that your SQL UPDATE statement does not appear to be working?  Is it returning some kind of error?  I glanced over your script, and one thing you might consider adding is something to this effect:

 

$update_successful=mysql_query($query);

if ($update_successful)

    {
         //Do stuff intended when the update goes well...

     }

else

     {
     
         die("Could not update the record<br />".mysql_error());

     }

 

That way, if your SQL statement fails for any reason, you can find out the reason why by echoing the mysql_error(); method.

If you were to post the relevant script rather than give us a link to the full code, you'd probably get more responses. However, to get you started, try adding an or die statement to your query:

 

<?php
$update=" UPDATE players SET name='$name',recordid='$recordid',dob='$dob',tall='$tall',weight='$weight',picture='$picture'  WHERE id=$player_id";
$new_club=mysql_query($update,$db) or die(mysql_error().'<br />On query:'.$update);
?>

 

Thanks for your responce , i have tried it but it didnt work for me, as for the related file ihave attached it ...

 

 

[attachment deleted by admin]

I'm afraid you've described your problem a bit ambiguously...do you mean to say that your SQL UPDATE statement does not appear to be working?  Is it returning some kind of error?  I glanced over your script, and one thing you might consider adding is something to this effect:

 

$update_successful=mysql_query($query);

if ($update_successful)

    {
         //Do stuff intended when the update goes well...

     }

else

     {
     
         die("Could not update the record<br />".mysql_error());

     }

 

That way, if your SQL statement fails for any reason, you can find out the reason why by echoing the mysql_error(); method.

 

Thank you very much, i tried the error function and i got this

 

 

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
On query: UPDATE players SET name='SpireLink',recordid='7133',dob='11/11/1984',tall='150',weight='45',picture='alsadi.jpg' WHERE id=

 

could you please explain why i cant send the player id to the query?

 

This might work:

 

$update="UPDATE `players` SET name='".$name."',recordid='".$recordid."',dob='".$dob."',tall='".$tall."',weight='".$weight."',picture='".$picture."' WHERE id='".$player_id."'";

 

i am sorry it didnt work also, it might be a mestake by me .. could you pleae update the attached files so i will upload it, i am sorry to ask you for this and i know that your time is more valuable ..

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.