query
Posted by: prawin (59.92.40.---)
Date: February 27, 2009 10:56AM

I updated the version of php. so that i got error for php programs which works normally good in the previous version. ERROR:Notice: Undefined variable: errorMsg in C:\wamp\www\prawin\new\locations\test\addlocation.php on line 10
PROGRAM IS
<?PHP
$locname = $_POST['loc_name'];
if (isset($_POST['submit'])) {
$isInsert=true;
if ($_POST['loc_name'] == ""winking smiley
{
$isInsert = false;
$errorMsg= " Location Name should not be blank";
}
if ($errorMsg != ""winking smiley {
echo"<p class=\" errormess\"> <font color='#FF0000'>$errorMsg</font></p>";
}
AND ALSO I GOT ANOTHER ERROR ASNotice: Undefined index: loc_name in C:\wamp\www\prawin\new\locations\test\addlocation.php on line 2. pLEASE ANY ONE CLARIFY MY DOUBT

Options: ReplyQuote
Re: query
Posted by: c2dan (---.sotn.cable.ntl.com)
Date: February 27, 2009 06:23PM

Notices are not errors.

Before using variables such as $_POST or any other superglobal variable you should check to see if it exists first before using it. however here are two simple fixes

I'd move this line
$locname = $_POST['loc_name'];

after the following line
if (isset($_POST['submit'])) {

Change this line
if ($errorMsg != ""winking smiley {

to
if (isset($errorMsg ) && !empty($errorMsg)) {

Options: ReplyQuote
Re: query
Posted by: prawin (59.92.96.---)
Date: February 28, 2009 06:33AM

THANK U VERY MUCH c2dan, I REALLY APPRECIATE UR WORK ON MY ISSUES.
IT WORKS GOOD .Please fix my another problem
<?php

$act = $_REQUEST['act'];
$id = $_REQUEST['id'];
$qry = "select * from tbl_project where pro_code='$id'";
$rst = mysql_query($qry,$con);
if($rst){
$row = mysql_fetch_array($rst);
$projectname = $row['pro_name'];
}

if (isset($_POST['submit'])) {
$isUpdate=true;
$proname = $_POST['pro_name'];
/*if ($_POST['pro_name'] == ""winking smiley
{
$isInsert = false;
$errorMsg= " Project Name should not be blank";

}*/
if($row['pro_active'] == "yes"winking smiley
{
$isUpdate=false;
$errorMsg= " <img src='button10.png'> Project is in process , cannot be deleted ";
}
else{
$isUpdate;
$errorMsg1="project deleted";
}


if ($isUpdate)
{
$sql="delete from tbl_project where pro_name='$projectname' and pro_code='$id'";

if(!mysql_query($sql,$con))
{
die("error" .mysql_error());
}
}
}
?>
When i run this code , i got the error as

Notice: Undefined index: act in C:\wamp\www\prawin\new\locations\test\deleteproject.php on line 2

Notice: Undefined index: pro_name in C:\wamp\www\prawin\new\locations\test\deleteproject.php on line 12


I want to Know Why it gives these kind of notices to me when i installed the new WAMP SERVER. and it works properly in previous version.


bcoz its works good in the WAMP SERVER 1 without givinging these NOTICES.

Options: ReplyQuote
Re: query
Posted by: prawin (59.92.96.---)
Date: February 28, 2009 11:07AM

and i have another problem AS

Notice: Use of undefined constant upload - assumed 'upload' in C:\wamp\www\prawin\new\locations\test\testupload.php on line 13

MY CODING IS :



if(isset($_POST['submit']))
{
$filesize=$_FILES['uploadfile']['size'];
$filetype=$_FILES['uploadfile']['type'];
$quote = $_POST['img_qut'];
$filename=basename($_FILES['uploadfile']['name']);
$isInsert = true;
if((!empty($_FILES['uploadfile'])) && ($_FILES['uploadfile']['error'] == ""winking smiley && $quote != ""winking smiley
{

$ext = substr($filename, strrpos($filename, '.') + 1);
if (($ext == "gif" || $ext == "jpg" || $ext == "bmp" || $ext == "png" )&& ($_FILES["uploadfile"]["type"] == ("image/gif" || "image/jpeg" || "images/png" || "images/bmp"winking smiley) &&($_FILES["uploadfile"]["size"] < 350000))
{

LINE NO 13 $newname = dirname(upload).'/upload/'.$filename;
if(!file_exists($newname))
{

if((move_uploaded_file($_FILES['uploadfile']['tmp_name'],$newname)))
{
$isInsert ;
$errorMsg1 = "File Sucessfully Uploaded";
}
else
{ $isInsert == false;
$errorMsg2 = "Error:file not saved";
}
}
else
{
$isInsert == false;
$errorMsg3 = "File ".$_FILES["uploadfile"]["name"]." already exists";
}
}
else
{
$isInsert == false;
$errorMsg4 = "Unknown picture type, please upload a different picture.";
}
}
else
{
$isInsert == false;
$errorMsg5 = "Select File Name";
$errorMsg6= "Leave UR Comment Here";
}


if($isInsert)
{
$sql= "Insert into tbl_album(image_name,image_type,image_size,image_date,image_time,image_quote) values('$filename','$filetype','$filesize', now(), now() ,'$quote')";

if(!mysql_query($sql,$con))
{
die("error" .mysql_error());
}
}

mysql_close($con);
}
?>
Please solve my issue

Options: ReplyQuote
Re: query
Posted by: yfastud (Moderator)
Date: March 01, 2009 02:47AM

prawin, this is wampserver forums, not coding forums, so I suggest you guys communicate through pm or email if you don't want to spend time to look for coding forums; thanks

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: query
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: March 01, 2009 08:41AM

go into the php.ini and turn off notices showing up.. thats whats difference between wamp1 and 2

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.