GB_001 Posted October 18, 2008 Share Posted October 18, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/128932-update-not-working/ Share on other sites More sharing options...
MadTechie Posted October 18, 2008 Share Posted October 18, 2008 any errors ? maybe also echo mysql_affected_rows() to check if any update occured Quote Link to comment https://forums.phpfreaks.com/topic/128932-update-not-working/#findComment-668452 Share on other sites More sharing options...
kenrbnsn Posted October 18, 2008 Share Posted October 18, 2008 "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 Quote Link to comment https://forums.phpfreaks.com/topic/128932-update-not-working/#findComment-668454 Share on other sites More sharing options...
GB_001 Posted October 18, 2008 Author Share Posted October 18, 2008 Sorry, it doesn't work and no errors showed up. Thanks though. Quote Link to comment https://forums.phpfreaks.com/topic/128932-update-not-working/#findComment-668463 Share on other sites More sharing options...
xtopolis Posted October 18, 2008 Share Posted October 18, 2008 Try echoing $q to see if the query is outputting the correct PHP vars, and try that output on a mysql console (such as through phpmyadmin) to see what it says. Quote Link to comment https://forums.phpfreaks.com/topic/128932-update-not-working/#findComment-668467 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.