Re: Please tell me what's wrong
| From: | Jaskirat Singh | Date: | Sun, 19 Nov 2000 12:17:45 +0000 |
| Subject: | Re: Please tell me what's wrong | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-4549@lists.php.net to get a copy of this message | ||
Hi,
I just had a cursory look at your code ..
one of the functions mysql_db_query .. is actually mysql_query
so may be that helps u out..
Jaskirat
At 09:57 AM 11/19/00 +0100, you wrote:
>Hi,
>
>I am working on an assignment for school and I have written a piece of
>php code to interact with a mysql database.
>But it doens't work, when I load the script, it times out after a while.
>
>Could anyone please help me out? I am totally new to php and have
>written it by studying tutorials.
>
>Thanks in advance,
>
>Niels Schenk
>
>The code:
>
><?php
>$host = "host";
>$user = "webmaster";
>$wachtw = "webmaster";
>$database = "systeembeheer";
>
>/* functie show_form */
>
>function show_form($soort) {
>$lc = $PHP_AUTH_USER;
>
>if($soort = 'storing') {
>echo "<form action=\"leraar.php\" method=\"POST\">\n";
>echo "<input type=\"hidden\" name='lc'
>value=\"'$lc'\">\n";
>echo "<input type=\"hidden\" name=\"action\"
>value=\"nstoring_insert\">\n";
>echo "<input type=\"text\" name=\"omschr\">\n";
>echo "</form>";
>}
>
>else {
>echo "<form action=\"leraar.php\" method=\"POST\">\n";
>echo "<input type=\"hidden\" name='lc'
>value=\"'$lc'\">\n";
>echo "<input type=\"hidden\" name='action'
>value=\"nsoftware_insert\">\n";
>echo "<input type=\"text\" name=\"ns\">\n";
>}
>}
>
>/* einde funtie show_form */
>
>
>/* functie nstoring_insert */
>
>function nstoring_insert($lc, $omschr){
>global $host, $user, $wachtw;
>
>$query = "INSERT INTO nieuwe_storing (da, lc, omschr) VALUES ('$lc',
>'$omschr')";
>
>mysql_connect($host, $user, $wachtw) or die ("<br>Foutmelding: het is
>niet gelukt om uw storings melding in te voeren, probeer het
>opnieuw.<br>\n");
>
>$result = mysql_db_query($database,$query)
> or die ("<br>Foutmelding: het is niet gelukt om uw software aanvraag
>in te voeren, probeer het opnieuw.<br>\n");
>
>mysql_close();
>}
>
>/* einde functie nstoring_insert */
>
>/* functie: nsoftware_insert; stop software aanvraag van docenten in de
>tabel */
>
>function nsoftware_insert($ns, $lok, $afd, $licen, $sd, $lc) {
>global $host, $user, $wachtw;
>
>$query = "INSERT INTO nieuwe_software (ns, lok, afd, licen, sd, lc)
>VALUES ('$ns', '$lok', '$afd', '$licen',
>'$lc')";
>
>mysql_connect($host, $user, $wachtw) or die ("<br>Foutmelding: kan geen
>verbinding maken met de server.<br>\n");
>
>$result = mysql_db_query($database,$query)
> or die ("<br>Foutmelding: het is niet gelukt om uw software aanvraag
>in te voeren, probeer het opnieuw.<br>\n");
>
>mysql_close();
>}
>
>/* Einde functie nsoftware_insert */
>
>
>
>if($action = 'nsoftware_insert') {
>nsoftware_insert($ns, $lok, $afd, $licen, $sd, $lc);
>}
>elseif($action = 'nstoring_insert') {
>nstoring_insert($lc, $omschr);
>}
>else {
>show_form($soort);
>}
>
>?>
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
>For additional commands, e-mail: php-db-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>