DB Connection
Posted by: jencinas69 (---.west.biz.rr.com)
Date: March 16, 2010 10:49PM

Hello,

I installed WAMP on windows 7, i just transfer a simple system that consist of a form that uploads info to a db and then you can view the reports and edit and delete entries.

The problem is that when Im trying to test the form is not working because on my live server I had

server as localhost
username
password and
DB name

the thing is that with wamp I dont have a user name or password to enter the DB
how can I go around this to make my form work?

Thank you

Joaquin Encinas

Options: ReplyQuote
Re: DB Connection
Posted by: yfastud (Moderator)
Date: March 18, 2010 12:50AM


Options: ReplyQuote
Re: DB Connection
Posted by: jencinas69 (---.phnx.qwest.net)
Date: March 20, 2010 01:03AM

thsis the error I am geting

Notice: Undefined variable: HTTP_POST_FILES in C:\wamp\www\pacientes\process.php on line 16

Notice: Undefined variable: HTTP_POST_FILES in C:\wamp\www\pacientes\process.php on line 17

Notice: Undefined variable: Comments in C:\wamp\www\pacientes\process.php on line 19

Notice: Undefined variable: Name in C:\wamp\www\pacientes\process.php on line 19

Notice: Undefined variable: HTTP_POST_FILES in C:\wamp\www\pacientes\process.php on line 23

Notice: Undefined variable: HTTP_POST_FILES in C:\wamp\www\pacientes\process.php on line 28
The following errors occured while processing your form input.

* You did not enter one or more of the required fields. Please go back and try again.

this is my process file


<?php
include("global.inc.php"winking smiley;
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','LastName');
pt_register('POST','Address');
pt_register('POST','City');
pt_register('POST','State');
pt_register('POST','ZipCode');
pt_register('POST','Country');
pt_register('POST','Phone');
pt_register('POST','MobilePhone');
/*pt_register('POST','Email');*/
pt_register('POST','BirthDate');
$PhotoBefore=$HTTP_POST_FILES['PhotoBefore'];
$PhotoAfter=$HTTP_POST_FILES['PhotoAfter'];
pt_register('POST','Comments');
$Comments=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $Comments);if($Name=="" || $LastName=="" || $Address=="" || $City=="" || $State=="" || $ZipCode=="" || $Country=="" || $Phone=="" || $MobilePhone=="" || $BirthDate=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if($HTTP_POST_FILES['PhotoBefore']['tmp_name']==""winking smiley{ }
else if(!is_uploaded_file($HTTP_POST_FILES['PhotoBefore']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['PhotoBefore']['name'].", was not uploaded!";
$errors=1;
}
if($HTTP_POST_FILES['PhotoAfter']['tmp_name']==""winking smiley{ }
else if(!is_uploaded_file($HTTP_POST_FILES['PhotoAfter']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['PhotoAfter']['name'].", was not uploaded!";
$errors=1;
}

if($errors==1) echo $error;
else{
$image_part = date("h_i_s"winking smiley."_".$HTTP_POST_FILES['PhotoBefore']['name'];
$image_list[11] = $image_part;
copy($HTTP_POST_FILES['PhotoBefore']['tmp_name'], "files/".$image_part);
$image_part = date("h_i_s"winking smiley."_".$HTTP_POST_FILES['PhotoAfter']['name'];
$image_list[12] = $image_part;
copy($HTTP_POST_FILES['PhotoAfter']['tmp_name'], "files/".$image_part);
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":""winking smiley."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"winking smiley);
$message="Name: ".$Name."
Last Name: ".$LastName."
Address: ".$Address."
City: ".$City."
State: ".$State."
Zip Code: ".$ZipCode."
Country: ".$Country."
Phone: ".$Phone."
Mobile Phone: ".$MobilePhone."

Birth Date: ".$BirthDate."
Photo Before: ".$where_form_is."files/".$image_list[11]."
Photo After: ".$where_form_is."files/".$image_list[12]."
Comments: ".$Comments."
";


$link = mysql_connect("localhost", "root"winking smiley;
mysql_select_db("jencinas_pacientes",$link);
$query="insert into pacientes (Name,Last_Name,Address,City,State,Zip_Code,Country,Phone,Mobile_Phone,Birth_Date,Photo_Before,Photo_After,Comments) values ('".$Name."','".$LastName."','".$Address."','".$City."','".$State."','".$ZipCode."','".$Country."','".$Phone."','".$MobilePhone."','".$BirthDate."','".$where_form_is."files/".$image_list[11]."','".$where_form_is."files/".$image_list[12]."','".$Comments."')";
mysql_query($query);
$make=fopen("admin/data.dat","a"winking smiley;
$to_put="";
$to_put .= $Name."|".$LastName."|".$Address."|".$City."|".$State."|".$ZipCode."|".$Country."|".$Phone."|".$MobilePhone."|".$BirthDate."|".$where_form_is."files/".$image_list[11]."|".$where_form_is."files/".$image_list[12]."|".$Comments."
";
fwrite($make,$to_put);
?>


<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Last Name: </td><td> <?php echo $LastName; ?> </td></tr>
<tr><td>Address: </td><td> <?php echo $Address; ?> </td></tr>
<tr><td>City: </td><td> <?php echo $City; ?> </td></tr>
<tr><td>State: </td><td> <?php echo $State; ?> </td></tr>
<tr><td>Zip Code: </td><td> <?php echo $ZipCode; ?> </td></tr>
<tr><td>Country: </td><td> <?php echo $Country; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Mobile Phone: </td><td> <?php echo $MobilePhone; ?> </td></tr>

<tr><td>Birth Date: </td><td> <?php echo $BirthDate; ?> </td></tr>
<tr><td>Photo Before: </td><td> <?php echo $PhotoBefore; ?> </td></tr>
<tr><td>Photo After: </td><td> <?php echo $PhotoAfter; ?> </td></tr>
<tr><td>Comments: </td><td> <?php echo $Comments; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->
<br><br><form>
<a href="resultados.php"><INPUT type="button" value="Ver Reporte"></a>&nbsp;&nbsp;
<a href="index.html"><INPUT type="button" value="Regresar ala Forma de Captura" ></a></form>
<?php
}
?>

Options: ReplyQuote
Re: DB Connection
Posted by: yfastud (Moderator)
Date: March 23, 2010 12:28AM

they're just notices and you can disable them

Open file php.ini through wamp tray icon

Find
error_reporting = E_ALL

Replace w/
error_reporting = E_ALL & ~E_NOTICE

Then save file and restart wamp

Have fun,

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

Options: ReplyQuote
Re: DB Connection
Posted by: jencinas69 (---.west.biz.rr.com)
Date: March 23, 2010 12:34AM

Ok i will do that when I get home and let you know if it works

Thank you

Options: ReplyQuote
Re: DB Connection
Posted by: jencinas69 (---.phnx.qwest.net)
Date: March 23, 2010 02:06AM

this is what is on the php.ini file

error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED

under php in the wamp icon tray

what do you think is causing the errors?

Options: ReplyQuote
Re: DB Connection
Posted by: gfreak000 (---.lightspeed.rcsntx.sbcglobal.net)
Date: March 26, 2010 12:20AM

hold ctrl and F and search for error_reporting. it should be the second one you find.

it will have:

; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
; [php.net]
error_reporting = E_ALL <=========== CHANGE THIS LINE TO



error_reporting = E_ALL & ~E_NOTICE

Options: ReplyQuote


Sorry, only registered users may post in this forum.