dezkit Posted November 4, 2008 Share Posted November 4, 2008 I have this code: <?php session_start(); if(!session_is_registered(us)){ header("location:/admin"); } include("config.php"); $tbl_name="gallery"; // Table name // select record from mysql $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); function cropImage($nw, $nh, $source, $stype, $dest) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; switch($stype) { case 'gif': $simg = imagecreatefromgif($source); break; case 'jpg': $simg = imagecreatefromjpeg($source); break; case 'png': $simg = imagecreatefrompng($source); break; } $dimg = imagecreatetruecolor($nw, $nh); $wm = $w/$nw; $hm = $h/$nh; $h_height = $nh/2; $w_height = $nw/2; if($w> $h) { $adjusted_width = $w / $hm; $half_width = $adjusted_width / 2; $int_width = $half_width - $w_height; imagecopyresampled($dimg,$simg,-$int_width,0,0,0,$adjusted_width,$nh,$w,$h); } elseif(($w <$h) || ($w == $h)) { $adjusted_height = $h / $wm; $half_height = $adjusted_height / 2; $int_height = $half_height - $h_height; imagecopyresampled($dimg,$simg,0,-$int_height,0,0,$nw,$adjusted_height,$w,$h); } else { imagecopyresampled($dimg,$simg,0,0,0,0,$nw,$nh,$w,$h); } imagejpeg($dimg,$dest,100); } ?> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td><table width="500%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bgcolor="#FFFFFF"> </td> <td colspan="4" bgcolor="#FFFFFF"><strong></strong> </td> </tr> <tr> <td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Thumbnail</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>URL</strong></td> <td align="center" bgcolor="#FFFFFF"> </td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td> <td bgcolor="#FFFFFF"><img src="<? echo $rows['thumb_url']; ?>"></td> <td bgcolor="#FFFFFF" align="center"><a href="<? echo $rows['full_url']; ?>"><? echo $rows['full_url']; ?></a></td> <td bgcolor="#FFFFFF"><a href="delete_ac.php?id=<? echo $rows['id']; ?>">delete</a></td> </tr> <? // close while loop } // close connection; mysql_close(); ?> </table></td> </tr> </table> <br><br><br><br> <?php $submit = $_POST["submit"]; if($submit == "Upload File"){ if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png")) || ($_FILES["file"]["type"] == "image/jpg") && ($_FILES["file"]["size"] < 20000000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "<font color=\"red\" size=\"+1\">Image has been uploaded!</font><br><br>"; echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { $filename = $_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); echo "Stored in: " . "uploads/" . $_FILES["file"]["name"]; cropImage(83, 60, '/uploads/$filename', 'jpg', '/uploads/th-$filename'); } } } else { echo "Invalid file"; } } ?> <br><br><br><br><h2>Upload</h2> <form enctype="multipart/form-data" action="" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <table border=0> <tr> <td>Select File: <td><input name="file" type="file" /> <tr> <td><input type="submit" name="submit" value="Upload File" /> <td><input type="reset" name="reset" value="Reset Field" /> </form> </table> When I run it, it displays the following errors: Warning: getimagesize(/uploads/$filename) [function.getimagesize]: failed to open stream: No such file or directory in /home/cobi/public_html/admin_gallery.php on line 12 Warning: imagecreatefromjpeg(/uploads/$filename) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home/cobi/public_html/admin_gallery.php on line 20 Warning: Division by zero in /home/cobi/public_html/admin_gallery.php on line 37 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/cobi/public_html/admin_gallery.php on line 40 Warning: imagejpeg() [function.imagejpeg]: Unable to open '/uploads/th-$filename' for writing: No such file or directory in /home/cobi/public_html/admin_gallery.php on line 44 How do i fix this? Thanks so much guys. Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/ Share on other sites More sharing options...
F1Fan Posted November 4, 2008 Share Posted November 4, 2008 Replace this: cropImage(83, 60, '/uploads/$filename', 'jpg', '/uploads/th-$filename'); with this: cropImage(83, 60, "/uploads/$filename", 'jpg', "/uploads/th-$filename"); Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682228 Share on other sites More sharing options...
dezkit Posted November 4, 2008 Author Share Posted November 4, 2008 Amazing, THANKS! Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682237 Share on other sites More sharing options...
dezkit Posted November 4, 2008 Author Share Posted November 4, 2008 Hey again! I got this code, but it isn't doing what i want to do. <?php session_start(); if(!session_is_registered(myusername)){ header("location:/admin"); } include("config.php"); $tbl_name="gallery"; // Table name // select record from mysql $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); function cropImage($nw, $nh, $source, $stype, $dest) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; switch($stype) { case 'gif': $simg = imagecreatefromgif($source); break; case 'jpg': $simg = imagecreatefromjpeg($source); break; case 'png': $simg = imagecreatefrompng($source); break; } $dimg = imagecreatetruecolor($nw, $nh); $wm = $w/$nw; $hm = $h/$nh; $h_height = $nh/2; $w_height = $nw/2; if($w> $h) { $adjusted_width = $w / $hm; $half_width = $adjusted_width / 2; $int_width = $half_width - $w_height; imagecopyresampled($dimg,$simg,-$int_width,0,0,0,$adjusted_width,$nh,$w,$h); } elseif(($w <$h) || ($w == $h)) { $adjusted_height = $h / $wm; $half_height = $adjusted_height / 2; $int_height = $half_height - $h_height; imagecopyresampled($dimg,$simg,0,-$int_height,0,0,$nw,$adjusted_height,$w,$h); } else { imagecopyresampled($dimg,$simg,0,0,0,0,$nw,$nh,$w,$h); } imagejpeg($dimg,$dest,100); } ?> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td><table width="500%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bgcolor="#FFFFFF"> </td> <td colspan="4" bgcolor="#FFFFFF"><strong></strong> </td> </tr> <tr> <td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Thumbnail</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>URL</strong></td> <td align="center" bgcolor="#FFFFFF"> </td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td> <td bgcolor="#FFFFFF"><img src="<? echo $rows['thumb_url']; ?>"></td> <td bgcolor="#FFFFFF" align="center"><a href="<? echo $rows['full_url']; ?>"><? echo $rows['full_url']; ?></a></td> <td bgcolor="#FFFFFF"><a href="delete_ac.php?id=<? echo $rows['id']; ?>">delete</a></td> </tr> <? // close while loop } // close connection; mysql_close(); ?> </table></td> </tr> </table> <br><br><br><br> <?php $submit = $_POST["submit"]; if($submit == "Upload File"){ if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png")) || ($_FILES["file"]["type"] == "image/jpg") && ($_FILES["file"]["size"] < 20000000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "<font color=\"red\" size=\"+1\">Image has been uploaded!</font><br><br>"; echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { $filename = $_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); echo "Stored in: " . "uploads/" . $_FILES["file"]["name"]; cropImage(83, 60, "/uploads/$filename", 'jpg', "/uploads/th-$filename"); mysql_query("INSERT INTO gallery (id, thumb_url, full_url) VALUES('th-$filename', '$filename' ) ") or die(mysql_error()); } } } else { echo "Invalid file"; } } ?> <br><br><br><br><h2>Upload</h2> <form enctype="multipart/form-data" action="" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <table border=0> <tr> <td>Select File: <td><input name="file" type="file" /> <tr> <td><input type="submit" name="submit" value="Upload File" /> <td><input type="reset" name="reset" value="Reset Field" /> </form> </table> Basicly it doesn't insert anything to the mysql table. Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682252 Share on other sites More sharing options...
Michdd Posted November 4, 2008 Share Posted November 4, 2008 mysql_query("INSERT INTO gallery (id, thumb_url, full_url) VALUES('th-$filename', '$filename' ) ") or die(mysql_error()); There you don't have anything set to insert into id, if you're talking about the auto incrementing id in the database you don't need to include that. Also you might want to set the thumbnail to a variable before putting into the database. $thumbnail = "th-".$filename; mysql_query("INSERT INTO gallery (thumb_url, full_url) VALUES('$thumbnail', '$filename' ) ") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682259 Share on other sites More sharing options...
dezkit Posted November 4, 2008 Author Share Posted November 4, 2008 Now i am getting these errors: Warning: getimagesize(/uploads/haydog.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/cobi/public_html/admin_gallery.php on line 12 Warning: imagecreatefromjpeg(/uploads/haydog.jpg) [function.imagecreatefromjpeg]: failed to open stream: No such file or directory in /home/cobi/public_html/admin_gallery.php on line 20 Warning: Division by zero in /home/cobi/public_html/admin_gallery.php on line 37 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/cobi/public_html/admin_gallery.php on line 40 Warning: imagejpeg() [function.imagejpeg]: Unable to open '/uploads/th-haydog.jpg' for writing: No such file or directory in /home/cobi/public_html/admin_gallery.php on line 44 Here is my current code: <?php session_start(); if(!session_is_registered(myusername)){ header("location:/admin"); } include("config.php"); $tbl_name="gallery"; // Table name // select record from mysql $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); function cropImage($nw, $nh, $source, $stype, $dest) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; switch($stype) { case 'gif': $simg = imagecreatefromgif($source); break; case 'jpg': $simg = imagecreatefromjpeg($source); break; case 'png': $simg = imagecreatefrompng($source); break; } $dimg = imagecreatetruecolor($nw, $nh); $wm = $w/$nw; $hm = $h/$nh; $h_height = $nh/2; $w_height = $nw/2; if($w> $h) { $adjusted_width = $w / $hm; $half_width = $adjusted_width / 2; $int_width = $half_width - $w_height; imagecopyresampled($dimg,$simg,-$int_width,0,0,0,$adjusted_width,$nh,$w,$h); } elseif(($w <$h) || ($w == $h)) { $adjusted_height = $h / $wm; $half_height = $adjusted_height / 2; $int_height = $half_height - $h_height; imagecopyresampled($dimg,$simg,0,-$int_height,0,0,$nw,$adjusted_height,$w,$h); } else { imagecopyresampled($dimg,$simg,0,0,0,0,$nw,$nh,$w,$h); } imagejpeg($dimg,$dest,100); } ?> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td><table width="500%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bgcolor="#FFFFFF"> </td> <td colspan="4" bgcolor="#FFFFFF"><strong></strong> </td> </tr> <tr> <td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Thumbnail</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>URL</strong></td> <td align="center" bgcolor="#FFFFFF"> </td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td> <td bgcolor="#FFFFFF"><img src="<? echo $rows['thumb_url']; ?>"></td> <td bgcolor="#FFFFFF" align="center"><a href="<? echo $rows['full_url']; ?>"><? echo $rows['full_url']; ?></a></td> <td bgcolor="#FFFFFF"><a href="delete_ac.php?id=<? echo $rows['id']; ?>">delete</a></td> </tr> <? // close while loop } // close connection; mysql_close(); ?> </table></td> </tr> </table> <br><br><br><br> <?php $submit = $_POST["submit"]; if($submit == "Upload File"){ if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png")) || ($_FILES["file"]["type"] == "image/jpg") && ($_FILES["file"]["size"] < 20000000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "<font color=\"red\" size=\"+1\">Image has been uploaded!</font><br><br>"; echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { $filename = $_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); echo "Stored in: " . "uploads/" . $_FILES["file"]["name"]; cropImage(83, 60, "/uploads/$filename", 'jpg', "/uploads/th-$filename"); include("config.php"); $thumbnailss = "th-".$filename; mysql_query("INSERT INTO gallery (thumb_url, full_url) VALUES('$thumbnailss', '$filename' ) ") or die(mysql_error()); } } } else { echo "Invalid file"; } } ?> <br><br><br><br><h2>Upload</h2> <form enctype="multipart/form-data" action="" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <table border=0> <tr> <td>Select File: <td><input name="file" type="file" /> <tr> <td><input type="submit" name="submit" value="Upload File" /> <td><input type="reset" name="reset" value="Reset Field" /> </form> </table> Also: Can somebody fix my broken code, I love you guys <3 Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682270 Share on other sites More sharing options...
wildteen88 Posted November 4, 2008 Share Posted November 4, 2008 Never start a file path with a forward slash, as PHP interprets this as the root of your file system (just like C:/ on windows). Use ./ instead (the . at the start of the path means current working directory). Or remove the forward slash completely. Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682272 Share on other sites More sharing options...
dezkit Posted November 4, 2008 Author Share Posted November 4, 2008 So what do you want me to fix?? Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682276 Share on other sites More sharing options...
wildteen88 Posted November 4, 2008 Share Posted November 4, 2008 Your file paths. This cropImage(83, 60, "/uploads/$filename", 'jpg', "/uploads/th-$filename"); Should be cropImage(83, 60, "./uploads/$filename", 'jpg', "./uploads/th-$filename"); Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682280 Share on other sites More sharing options...
F1Fan Posted November 4, 2008 Share Posted November 4, 2008 Also, you need to be more careful of which quote type you use. You appear to be relying on single quotes when you should be using doubles. I urge you to study this page: http://us.php.net/manual/en/language.types.string.php Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682286 Share on other sites More sharing options...
dezkit Posted November 4, 2008 Author Share Posted November 4, 2008 Nevermind, I fixed it myself. Oh and guys. I need some sort of more help I now have this code(I know): <?php session_start(); if(!session_is_registered(myusername)){ header("location:/admin"); } include("config.php"); $tbl_name="gallery"; // Table name // select record from mysql $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); function cropImage($nw, $nh, $source, $stype, $dest) { $size = getimagesize($source); $w = $size[0]; $h = $size[1]; switch($stype) { case 'gif': $simg = imagecreatefromgif($source); break; case 'jpg': $simg = imagecreatefromjpeg($source); break; case 'png': $simg = imagecreatefrompng($source); break; } $dimg = imagecreatetruecolor($nw, $nh); $wm = $w/$nw; $hm = $h/$nh; $h_height = $nh/2; $w_height = $nw/2; if($w> $h) { $adjusted_width = $w / $hm; $half_width = $adjusted_width / 2; $int_width = $half_width - $w_height; imagecopyresampled($dimg,$simg,-$int_width,0,0,0,$adjusted_width,$nh,$w,$h); } elseif(($w <$h) || ($w == $h)) { $adjusted_height = $h / $wm; $half_height = $adjusted_height / 2; $int_height = $half_height - $h_height; imagecopyresampled($dimg,$simg,0,-$int_height,0,0,$nw,$adjusted_height,$w,$h); } else { imagecopyresampled($dimg,$simg,0,0,0,0,$nw,$nh,$w,$h); } imagejpeg($dimg,$dest,100); } ?> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td><table width="500%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bgcolor="#FFFFFF"> </td> <td colspan="4" bgcolor="#FFFFFF"><strong></strong> </td> </tr> <tr> <td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Thumbnail</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>URL</strong></td> <td align="center" bgcolor="#FFFFFF"> </td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td> <td bgcolor="#FFFFFF"><img src="./uploads/<? echo $rows['thumb_url']; ?>"></td> <td bgcolor="#FFFFFF" align="center"><a href="./uploads/<? echo $rows['full_url']; ?>"><? echo $rows['full_url']; ?></a></td> <td bgcolor="#FFFFFF"><a href="delete_ac.php?id=<? echo $rows['id']; ?>">delete</a></td> </tr> <? // close while loop } // close connection; mysql_close(); ?> </table></td> </tr> </table> <br><br><br><br> <?php $submit = $_POST["submit"]; if($submit == "Upload File"){ if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/png")) || ($_FILES["file"]["type"] == "image/jpg") && ($_FILES["file"]["size"] < 20000000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "<font color=\"red\" size=\"+1\">Image has been uploaded!</font><br><br>"; echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { $filename = $_FILES["file"]["name"]; move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); echo "Stored in: " . "./uploads/" . $_FILES["file"]["name"]; cropImage(83, 60, "./uploads/$filename", 'jpg', "./uploads/th-$filename"); include("config.php"); $thumbnailss = "th-".$filename; mysql_query("INSERT INTO gallery (thumb_url, full_url) VALUES('$thumbnailss', '$filename' ) ") or die(mysql_error()); } } } else { echo "Invalid file"; } } ?> <br><br><br><br><h2>Upload</h2> <form enctype="multipart/form-data" action="" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <table border=0> <tr> <td>Select File: <td><input name="file" type="file" /> <tr> <td><input type="submit" name="submit" value="Upload File" /> <td><input type="reset" name="reset" value="Reset Field" /> </form> </table> How come when i upload an image, i have to reload the page in order to see it on the UPLOADED FILES column? Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682288 Share on other sites More sharing options...
F1Fan Posted November 4, 2008 Share Posted November 4, 2008 Because you are inserting the data AFTER you select it. Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682292 Share on other sites More sharing options...
dezkit Posted November 4, 2008 Author Share Posted November 4, 2008 So how do I make to insert after selecting it? I'm completely confused on doing that. Edit: When i upload a png image it says: Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home/cobi/public_html/admin_gallery.php on line 20 Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: './uploads/background.png' is not a valid JPEG file in /home/cobi/public_html/admin_gallery.php on line 20 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/cobi/public_html/admin_gallery.php on line 35 Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682296 Share on other sites More sharing options...
F1Fan Posted November 4, 2008 Share Posted November 4, 2008 You are already inserting it after selecting it. If you do this: SELECT * FROM sometable... INSERT INTO sometable... you're selecting everything, then inserting a new row. You need to change it to this: INSERT INTO sometable... SELECT * FROM sometable... Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682307 Share on other sites More sharing options...
dezkit Posted November 4, 2008 Author Share Posted November 4, 2008 i don't get it, can you look into my code and fix it, please? Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682311 Share on other sites More sharing options...
F1Fan Posted November 4, 2008 Share Posted November 4, 2008 I'm not gonna write your code for you. Look, where is your select statement? Where is your insert statement?? The insert NEEDS TO BE BEFORE the select. Currently, the insert is AFTER the select. Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682315 Share on other sites More sharing options...
dezkit Posted November 4, 2008 Author Share Posted November 4, 2008 I got it now, thanks so much <3 Quote Link to comment https://forums.phpfreaks.com/topic/131368-error-need-urgent-help/#findComment-682317 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.