Jump to content

cnagra

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by cnagra

  1. i fixed that error but now im gettin this error Warning: mail(): Failed to Receive in c:\project\htdocs\sendemail.php on line 1426 the line of code mail("myemail@hotmail.com", $subject, $message, $from);
  2. hi i keep gettin this error: Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\project\htdocs\sendemail.php on line 1426 when i try using my email form, im using apache, mysql. what are the default settings, can anyone help thanks
  3. hi, im gettin the following error, when i put the code with some html. Warning: session_register(): Cannot send session cookie - headers already sent by (output started at c:\project\htdocs\checklogin.php:1) in c:\project\htdocs\checklogin.php on line 34 Warning: session_register(): Cannot send session cache limiter - headers already sent (output started at c:\project\htdocs\checklogin.php:1) in c:\project\htdocs\checklogin.php on line 34 Warning: Cannot modify header information - headers already sent by (output started at c:\project\htdocs\checklogin.php:1) in c:\project\htdocs\checklogin.php on line 35 my php code : <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="dv8_database"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername and redirect to file "login_success.php" session_register("myusername"); header("location:login_successful.php"); } else { echo "Wrong Username or Password"; } ?> its a simple login form and happens when the username and password is correct. thanks
  4. hi, im gettin the following error, when i put the code with some html. Warning: session_register(): Cannot send session cookie - headers already sent by (output started at c:\project\htdocs\checklogin.php:1) in c:\project\htdocs\checklogin.php on line 34 Warning: session_register(): Cannot send session cache limiter - headers already sent (output started at c:\project\htdocs\checklogin.php:1) in c:\project\htdocs\checklogin.php on line 34 Warning: Cannot modify header information - headers already sent by (output started at c:\project\htdocs\checklogin.php:1) in c:\project\htdocs\checklogin.php on line 35 my php code : <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="dv8_database"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername and redirect to file "login_success.php" session_register("myusername"); header("location:login_successful.php"); } else { echo "Wrong Username or Password"; } ?> its a simple login form thanks
  5. hi im tryin to change my code so it outputs the number in £'s instead of $'s here is wat i got blueFont("tahoma"," $NoShipping"); } else { $SC=number_format($SC,"2",".","thousands_sep"); blueFont("tahoma"," $$SC"); } what do i change? thanks
  6. hi i got the text to be a certain size, but cant get it to be Tahoma text...can anyone give me the code. the code i got so far is: echo "<FONT SIZE=4>Stock Updated Successfully - Update Another ?</FONT>"; thanks its ok i got it to work, thanks anyway
  7. hi i need this text to be red, tahoma, and size 16. what do i have to do to add to the code? thanks echo "Record Updated Successfully - Update Another ?";
  8. hi. i got a form that edits fields in my database, but once it edits the databas i want the boxes to be empty so i can enter new records to be edited. where do i put the code and what is the code? thanks php code : <?php mysql_pconnect('localhost'); mysql_select_db('dv8_database'); if ($submit) { // here if no ID then adding else we're editing if ($id) { $sql = "UPDATE stock_control SET category='$category',model='$model',price='$price',stock_amount='$stock_amount' WHERE id=$id"; } else { $sql = "INSERT INTO stock_control (model,category,price,stock_amount) VALUES ('$model','$category','$price','$stock_amount')"; } // run SQL against the DB $result = mysql_query($sql); echo "Record Updated Successfully - Update Another ?"; printf("<a href=\"%s?id=%s\">%s %s</a> \n", $PHP_SELF, $myrow["id"], $myrow["category"], $myrow["model"], $myrow["price"], $myrow["stock_amount"]); } ?> </div> <form method="post" action="<?php echo $PHP_SELF?>"> <p align="center"> <?php if ($id) { // editing so select a record $sql = "SELECT * FROM stock_control WHERE id=$id"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); $id = $myrow["id"]; $category = $myrow["category"]; $model = $myrow["model"]; $price = $myrow["price"]; $stock_amount = $myrow["stock_amount"]; // print the id for editing ?> <input type=hidden name="id" value="<?php echo $id ?>"> <?php } ?></p> <p align="center"> <input type="Text" name="id" value="<?php echo $id ?>"> </p> <p align="center"> <input type="Text" name="category" value="<?php echo $category ?>"> </p> <p align="center"> <input type="Text" name="model" value="<?php echo $model ?>"> </p> <p align="center"> <input type="Text" name="price" value="<?php echo $price ?>"> </p> <p align="center"> <input type="Text" name="stock_amount" value="<?php echo $stock_amount ?>"> </p> <p align="right"> <input type="Submit" name="submit" value="Update Record"> <input name="reset" input type="reset" id="reset" value="Clear Form" /> </p> </form> <div align="center"> <?php ?>
  9. hi, im very new to php, will i put that code in a php file, what kind of html file would i have to make. i didnt understand that tutprial, can you please break it down what i have to do for me. thanks
  10. can anyone please please help....i jus need the html and php code to input one ID, then view, edit and delete...please help
  11. hi i need to figure out how to view certain records, edit existing records and delete records...does anyone know of any good tutorial sites, or can help me out? thanks
  12. hi that worked great, now i need to figure out how to view certain records, edit existing records and delete records...does anyone know of any good tutorial sites, or can help me out? thanks
  13. hi yeah that worked, do u know how to make the table boxes wider?...all the data is outputted in narrow boxes.. thanks
  14. i get the following error with this code Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\project\htdocs\testoutput.html on line 1475 thanks
  15. hi, i got my data to output successfully, but i need each record to output into a table in a website. can anyone help me. so far they are seperated by a new line but all the data is outputted together. php code: <?php mysql_pconnect('localhost'); mysql_select_db('dv8_database'); $query="SELECT * FROM stock_control"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $category=mysql_result($result,$i,"category"); $model=mysql_result($result,$i,"model"); $price=mysql_result($result,$i,"price"); $stock_amount=mysql_result($result,$i,"stock_amount"); echo "<br>ID: $id| Category: $category | Model: $model | Price: $price | Stock Amount: $stock_amount |<br><hr><br>"; $i++; } ?> thanks
  16. thanks anyway.. please someone help...it still only adds numbers!!
  17. [!--quoteo(post=365625:date=Apr 17 2006, 01:46 PM:name=Richard181)--][div class=\'quotetop\']QUOTE(Richard181 @ Apr 17 2006, 01:46 PM) [snapback]365625[/snapback][/div][div class=\'quotemain\'][!--quotec--] what you mean it only works with number? the database should receive anything you put in the text area [/quote] yeah thats what i thougt, but if input numbers in the fields, it works...but dont except text?....so strange....do u know why?
  18. [!--quoteo(post=365621:date=Apr 17 2006, 01:34 PM:name=Richard181)--][div class=\'quotetop\']QUOTE(Richard181 @ Apr 17 2006, 01:34 PM) [snapback]365621[/snapback][/div][div class=\'quotemain\'][!--quotec--] $sql = mysql_query("INSERT INTO test(name,topic) VALUES('$name','$topic')"); [/quote] hi, that worked fine, but only with numbers, they are both set to VARCHAR, so i dont get why this is ?
  19. i got it to work, but suddenly jus stopped. only data to the first field out of two gets data added to it. there is something wrong with the html file or the php file. database is called data2, the fields are name and topic [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]html file code[!--colorc--][/span][!--/colorc--] <form name="form" method="post" action="add_workin.php"> Name: <input type="text" name="name"><br> Test: <input type="text" name="topic"><br> <input type="Submit"> </form> [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]php code[!--colorc--][/span][!--/colorc--] <?php mysql_pconnect('localhost'); mysql_select_db('test2'); mysql_query("insert into test values ('$name','$topic')"); ?> thanks...please help
  20. [!--quoteo(post=365426:date=Apr 16 2006, 09:13 PM:name=litebearer)--][div class=\'quotetop\']QUOTE(litebearer @ Apr 16 2006, 09:13 PM) [snapback]365426[/snapback][/div][div class=\'quotemain\'][!--quotec--] Have a look at this tutorial. [a href=\"http://www.createafreewebsite.net/phpmysql/insert.html\" target=\"_blank\"]http://www.createafreewebsite.net/phpmysql/insert.html[/a] Note a couple of things - when you have more than 1 field in a database table you need to tell it which field is to receive the information --- to keep related data together enter them in to the database at the same time.. Lite... [/quote] hi, yeah this doesn't really help, as im adding data through a html file, the data gets added when there is one field, but if i add an extra field to that database then try adding data, then no data gets added, not even to the one that was working in the original place. any more help?
  21. hi, please can someone help me, im new to php and have to create a stock control system i been trying to add data to mysql database through php. i am having trouble with adding to the database when there is multiple fields. everything is fine when the database has one field, but if it has more than one, no data is added to it, not even the workinf original field. i dont know why...can someone help? my form html - for when there is one field <form name="form" method="post" action="add_workin.php"> Name: <input type="text" name="name"><br> <input type="Submit"> </form> my php code for one field <?php mysql_pconnect('localhost'); mysql_select_db('test2'); mysql_query("insert into test values ('$name')"); ?> my html for 2 fields....(NOTHING GETS ADDED not even the working field) <form name="form" method="post" action="add_workin.php"> Name: <input type="text" name="name"><br> Category: <input type="text" category="name"><br> <input type="Submit"> </form> my php code for two fields <?php mysql_pconnect('localhost'); mysql_select_db('test2'); mysql_query("insert into test values ('$name')"); mysql_query("insert into test values ('$category')"); ?> please help...thanks
×
×
  • 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.