Jump to content

Recommended Posts

Hello,

For some reason my Update is not working. (Update is at the end)

 

<?php
session_start();
include('Connect.php');

$User=$_SESSION['email'];
$Friend=$_GET['F'];
$PM=$_GET['C'];
$getN=mysql_query("SELECT * FROM Ysers WHERE email='$User'");
$row2 = mysql_fetch_array($getN);
$Name=$row2['Name'];
$PIC=$row2['Picture'];
$PIC="Images/$PIC"; 
list($width, $height, $type, $atrib) = getimagesize($PIC);
if($width>150||$height>200)
{
    $P=$width/100;
    $PH=$height/100;
    
    $MW=$width/$P;
    $MH=$height/$PH;
}

$pww=(360-$MW)-15;
$Time=date('Y-m-d');
$getP=mysql_query("SELECT * FROM Pms WHERE (User1='$User' AND User2='$Friend') OR (User2='$User' AND User1='$Friend')");
$Pnum=mysql_num_rows($getN);
if($Pnum!=1)
{
mysql_query("INSERT INTO Pms (User1, User2) VALUES('$User', '$Friend')") or die(mysql_error());
}
$Prow=mysql_fetch_array($getP);
$Postme=$Prow['Posts'];
$yep=explode("<break>", $Postme);
$size=sizeof($yep);
$i=0;
$count=$size-1;

$CF="<table class=comment id=$count valign=bottom height=40px width=360px>
     <tr>
     <td COLSPAN=2><font color=white><b>$Name -$Time</td>
     </tr>
     <tr>
     <td width=$MW><img src=$PIC height=$MH width=$MW/></td><td width=150px valign=top align=left><font color=white><b>$PM</b></td>
     </tr>
     </table><break>";
$i=0;
$count=0;
$CF = addslashes($CF);
$Posty=$Prow['Posts'];
$Postz="$CF $Posty";
mysql_query("UPDATE Pms SET Posts='$Postz' WHERE (User1='$User' AND User2='$Friend') OR (User2='$User' AND User1='$Friend')") or die(mysql_error());
mysql_query("UPDATE Pms SET Reply='$Friend' WHERE (User1='$User' AND User2='$Friend') OR (User2='$User' AND User1='$Friend')") or die(mysql_error());
?>
<style type="text/css">
.comment {border: 1px solid white; }
</style> 

Link to comment
https://forums.phpfreaks.com/topic/128932-update-not-working/
Share on other sites

"Not working" doesn't tell us alot...

 

How do you know it's not working? Do you get any errors?

 

Why are you doing two updates when you can do one?

 

Change

<?php
mysql_query("UPDATE Pms SET Posts='$Postz' WHERE (User1='$User' AND User2='$Friend') OR (User2='$User' AND User1='$Friend')") or die(mysql_error());
mysql_query("UPDATE Pms SET Reply='$Friend' WHERE (User1='$User' AND User2='$Friend') OR (User2='$User' AND User1='$Friend')") or die(mysql_error());
?>

into

<?php
$q = "UPDATE Pms SET Posts='$Postz', Reply='$Friend' WHERE (User1='$User' AND User2='$Friend') OR (User2='$User' AND User1='$Friend')";
$rs = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());
?>

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/128932-update-not-working/#findComment-668454
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.