illuz1on Posted July 3, 2007 Share Posted July 3, 2007 Hey I moved a php script of mine over to a windows machine and im getting the following errors after the move: Notice: Undefined index: op in C:\Nanoson Sites\Personalised Promotions\personal.co.za\ouwewerf\login.php on line 6 Anyone know what might cause this? Thanks illuz1on Link to comment https://forums.phpfreaks.com/topic/58248-migration-from-linux-windows-and-errors/ Share on other sites More sharing options...
trq Posted July 3, 2007 Share Posted July 3, 2007 Anyone know what might cause this? Poor coding practice. Your trying to access variables that dont exist. Simply put, the Linux setup must have had a lower error setting. You can simply get rid of the errors by turning error reporting down, or better still, fix them in your code. Post some code if need be. Link to comment https://forums.phpfreaks.com/topic/58248-migration-from-linux-windows-and-errors/#findComment-288786 Share on other sites More sharing options...
illuz1on Posted July 3, 2007 Author Share Posted July 3, 2007 Ok cool thanks, i see what you mean.. Also getting this when trying to add something to the db: Out of range value adjusted for column 'id' at row 1 Link to comment https://forums.phpfreaks.com/topic/58248-migration-from-linux-windows-and-errors/#findComment-288791 Share on other sites More sharing options...
per1os Posted July 3, 2007 Share Posted July 3, 2007 To fix the problems for the undefined index, something like this is what I use <?php $id = isset($_POST['id'])?$_POST['id']:''; // or better yet create a function function check_isset($array, $id) { return isset($array[$id])?$array[$id]:''; } $id = check_isset($_POST, 'id'); ?> Either way would avoid the notice undefined index error. For the out of range question, post relevant code. Link to comment https://forums.phpfreaks.com/topic/58248-migration-from-linux-windows-and-errors/#findComment-288806 Share on other sites More sharing options...
illuz1on Posted July 4, 2007 Author Share Posted July 4, 2007 This is the code for the insert.php: <? include("db.php"); $title = $_POST["title"]; $fromz = $_POST["fromz"]; $toz = $_POST["toz"]; $description = $_POST["description"]; $contactname = $_POST["contactname"]; $contacttel = $_POST["contacttel"]; $contactemail = $_POST["contactemail"]; $type = $_POST["type"]; $addoffer = MYSQL_QUERY("INSERT INTO specialoffer (id,title,fromz,toz,contacttel,contactname,contactemail,description,type)". "VALUES ('NULL', '$title', '$fromz', '$toz', '$contacttel', '$contactname', '$contactemail', '$description', '$type')") or die (mysql_error ()); echo("Special Offer Added!<br>"); echo "<br>"; echo("<b>Type of offer: $type"); echo("<br>"); echo("<b>Title:</b> $title<br>"); echo("<b>Validity - From:</b> $fromz <b>untill</b> $toz<br>"); echo("<b>Contact Name:</b> $contactname<br>"); echo("<b>Contact Tel:</b> $contacttel<br>"); echo("<b>Contact E-Mail:</b> $contactemail<br>"); echo("<b>Description:</b> $description<br>"); echo "<br>"; echo "<a href=\"display1.php\">View offers</a> | <a href=\"admin.php\">Back to administrstion</a>"; ?> Link to comment https://forums.phpfreaks.com/topic/58248-migration-from-linux-windows-and-errors/#findComment-289648 Share on other sites More sharing options...
trq Posted July 4, 2007 Share Posted July 4, 2007 Is the id field auto incrementing? If so... just leave it out of your query all together. $addoffer = MYSQL_QUERY("INSERT INTO specialoffer (title,fromz,toz,contacttel,contactname,contactemail,description,type)". "VALUES ('$title', '$fromz', '$toz', '$contacttel', '$contactname', '$contactemail', '$description', '$type')") or die (mysql_error ()); Link to comment https://forums.phpfreaks.com/topic/58248-migration-from-linux-windows-and-errors/#findComment-289715 Share on other sites More sharing options...
illuz1on Posted July 5, 2007 Author Share Posted July 5, 2007 ok cool thanks, I know this isnt really the right place for this question but How would I add auto increacement to a ID field in a windows MySQL server? Thanks for all the help illuz1on Link to comment https://forums.phpfreaks.com/topic/58248-migration-from-linux-windows-and-errors/#findComment-290269 Share on other sites More sharing options...
per1os Posted July 5, 2007 Share Posted July 5, 2007 create table tablE_name( id int(11) NOT NULL auto_increment, .....etc ); Same as on a linux server. Link to comment https://forums.phpfreaks.com/topic/58248-migration-from-linux-windows-and-errors/#findComment-290347 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.