Edgars_Grinvalds Posted April 4, 2003 Report Share Posted April 4, 2003 Nesaprotu, kas par vainu HELP <html> <head> <title>Super</title> </head> <body> <?php if(isset($domain)&&isset($sex) &&isset($domain)) { //check user input here! $dberror =""; $ret= add_to_database($domain, $sex, $mail, $dberror); if(!$ret) print "Error: $dberror<BR"; else print "Thank you very much"; } else{ write_form(); } function add_to_database($domain, $sex, $mail, &$dberror) { $user = "hacker"; $pass = "hacker"; $db = "sample"; $link = mysql_connect("localhost", $usr, $pass); if(!$link) { $dberror = "Could not connect to mysql server"; return false; } if(!mysql_select_db($db, $link)) { $dberror = mysql_error(); return false } $query = "INSERT INTO domains(domain, sex, mail) values('$domain', '$sex', '$mail')"; if(!mysql_query($query, $link)) { $dberror=mysql_error(); return false; } return true; } function write_form() { global $PHP_SELF; print "<form action="$PHP_SELF" method"POST">n"; print "<input type="text" name="domain">"; print "The domain you would like<p>n"; print "<input type="text" name="mail">"; print "Your mail address<p>n"; print "<select name="sex">n"; print "t<option value="F"> Femalen"; print "t<option value="M"> Malen"; print "</select>n"; print "<input type="submit" value="submit!">n</form>n"; } ?> </body> </html> :( Link to comment Share on other sites More sharing options...
Qued Posted April 4, 2003 Report Share Posted April 4, 2003 A kas par problēmu? Link to comment Share on other sites More sharing options...
Venom Posted April 4, 2003 Report Share Posted April 4, 2003 Uz pirmo skatienu man piemēram napatiktu shis: <code><font color="#000000"> <font color="#0000CC"><? </font><font color="#006600">{ </font><font color="#0000CC">$dberror </font><font color="#006600">= </font><font color="#0000CC">[url=http://lv.php.net/mysql_error]mysql_error[/url]</font><font color="#006600">(); return </font><font color="#0000CC">false </font><font color="#006600"><--- } ? </font> </font> </code> return false; vai, ja lieto error level=all, tad return 0; vai pirms tam define(false,0); Link to comment Share on other sites More sharing options...
Recommended Posts