last day (15 days later) » 

6:20 PM
0
A: updating information Mysqli_php

RiggsFollyThere may well be other issues but this is the first I see. text fields in any query need to be wrapped in quotes, single quotes is my preference, so this update wont compile. $query = mysqli_query($tf_handle, "UPDATE `guest`.`messages` SET `name` = ".$name.", `message...

 
doesn't work :(
$query = $query = mysqli_query($tf_handle,"UPDATE guest.messages SET name = ".$name.", message = ".$message." WHERE messages.id = ".$id); if($query && mysqli_affected_rows($tf_handle)>0) { echo "query Works"; return TRUE; } i tried this code it executed the else statement
 
See my updates answer which actually puts the database error somewhere where you can view it
 
i tried this like $this->LastError = mysqli_error($tf_handle); but i didn't get any error then i tried this line die(mysqli_error($tf_handle)); i didn't get error too :(
 
You have to look at it. I added a chnage for the calling code so when you get FALSE returned you print the error message
 
it didn't print anything :(
i tried everything :(
 
6:20 PM
Sorry , I spelt the property wrong. Look again
 
same result :( nothing
come chat ? ......
 
6:40 PM
hi
?
u there>
 
:)
you think what should i do now :(
i tried everything :(
 
Ok Simple test lets change this bit to output an error directly
if($query) {
echo "query Works";
return true;
} else {
echo mysqli_error($tf_handle);
tinyf_db_close() ;
return false;
}
What do you see with that code, do you get an error message?
or do you see "query Works"
 
"query Works";
but
if i changed it to
if($querycheck && mysqli_affected_rows($tf_handle)>0)
the else statement exutes
but doesn't print error
 
What is $querycheck
So if you get Query Works whats the problem?
 
6:49 PM
sorry $query
 
Have you checked the database for this new record?
 
what do you mean with new record
i get blank page
no erros :(
 
Ok so there are none to show
Do you see the "updated" message
 
after && mysqli_affected_rows($tf_handle)>0 i don't get it
 
No the message from this piece of code
$update = $gb->Update($id,$name,$msg);
if($update)
{
echo('updated');
}
else
{

echo("not updated");
}
 
6:55 PM
i found the errorrrrrrrr
public function Update($id,$name,$message)
{
global $tf_handle;
echo $id. '<br />';
echo "$name". '<br />';
echo "$message". '<br />';
$query = mysqli_query($tf_handle,
"UPDATE `guest`.`messages`
SET `name` = '$name', `message` = '$message' WHERE
`messages`.`id` = $id" );

if($query && mysqli_affected_rows($tf_handle)>0)
{
echo "query Works";
return true;
}
else
{
die('bye');
return false;
}


}
after trying this function the $id value is 0 !????
but ihere
here *
if(isset($_POST['submit']))
{
$uid = $_POST['id'];
$name = $_POST['name'];
$msg = $_POST['message'];
$update = $gb->Update($id,$name,$msg);
if($update)
{
echo('updated');
} else {
die(mysqli_error($tf_handle));
}
}
it print the id right
 
What does this section print
$uid = $_POST['id'];
echo $uid;
$name = $_POST['name'];
echo $name;
$msg = $_POST['message'];
echo $msg;
$update = $gb->Update($id,$name,$msg);
AHHHHHHHHHHHHHHH
 
Finxed
 
$uid = $_POST['id'];

$update = $gb->Update($id,$name,$msg);
 
yeah
 
$uid not = $id
 
6:57 PM
:D
Fixed
 
Great mind think alike
 
:D :D :D
 
7:56 PM
Do you mean the bit after SO Change to
@smile I am back in chat
 

last day (15 days later) »