Jump to content

Data doesnt get updated


SpireLink

Recommended Posts

I am working on a club software which will allow me to manage players and get a list of all the registerd players, i can add, get list of all of the players, but when i try to modify any one of them i cant ..

 

i have attached the players edit file ..

 

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

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);
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

Try this

 

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

 

 

I have tried it and i got this error

 

Could not update the record

Query was empty

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

Could you stick this in over your query and tell me what error comes up

 

$new_club=mysql_query("UPDATE players 
SET name='$name',recordid='$recordid',dob='$dob',tall='$tall',weight='$weight',picture='$picture'  
WHERE id=$player_id") or die(mysql_error());

Link to comment
Share on other sites

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.