Jump to content

Update not working.


GB_001

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

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.