MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:tlr7425 Date:November 25 2003 2:38am
Subject:Re: web data entry problem
View as plain text  
Adding this file (g_common_func.php).  This is 'included' by the web 
form file's code along with the connection script), I thought I should 
include all referenced files and forgot this one:
<?php
# g_common_func.php
# common functions to gotcha application

# display header information
function header1(){
echo "<CENTER><B> $today  Delivery etc Gotcha
Database</B></CENTER>";
echo "<HR SIZE=1>";
}

# display what screen we are in
function title($text) {
echo "<CENTER><B>$text</B></CENTER>";
echo "<HR SIZE=1 WIDTH=40%>";
}

# display footer information
function footer(){
$today=(date("j F Y"));
echo "<HR SIZE=1 WIDTH=50%>";
echo "<CENTER><I>Copyright Delivery etc </I> [ $today ]</CENTER>";
echo "<HR SIZE=1 WIDTH=50%>";
}
# display HREF link to main menu
function main_menu_scr(){
echo "<BR><A HREF=\"gotcha_menu.php\"> Main Menu</A>";
}


# display HREF link to view records
function view_all_scr(){
echo "<BR><A HREF=\"g_view_all.php\"> Search Records</A>";
}


# display HREF link to add a gotcha
function add_gotcha_scr(){
echo "<BR><A HREF=\"g_add_gotcha.php\"> Back to Add a Gotcha</A>";
}

# display HREF link to add a subject
function add_subject_scr(){
echo "<BR><A HREF=\"g_add_subject.php\"> Add a Technical Subject</A>";
}

# display HREF link to add a system
function add_system_scr(){
echo "<BR><A HREF=\"g_add_system.php\"> Add a System Type</A>";
}

?>

Ted

On Nov 24, 2003, at 7:25 PM, tlr7425@stripped wrote:

> Here is my connection script (conn_inc.php):
> <?php
> # conn_inc.php
> $connection=mysql_pconnect("localhost","mysuperusername","mypassword");
>
> if (!$connection) {
>  echo "Could not connect to MySQL server!";
>  exit;
> }
>
> $db=mysql_select_db("test_gotcha",$connection);
> if (!$db) {
>  echo "Could not change into the database test_gotcha";
>  exit;
> }
>
> ?>
>
> Here is a web form (g_add_gotcha.php -- I have inserted a space around 
> each " <  > "s, hoping it will not render as html in your email 
> program):
> < HTML >
> < BODY >
> <?php
> # g_add_system.php
>
> include ("conn_inc.php");
> include ("g_common_func.php");
> header1();
> title("Add a new technical system area");
>
>
> $sql="SELECT system_type FROM system";
> $mysql_result=mysql_query($sql,$connection);
> $num_rows=@mysql_num_rows($mysql_result);
>
> echo "<  FORM METHOD=GET  ACTION=\"g_write_system.php\" >";
> echo "<B>What is the new system < /B >< BR >
> < INPUT TYPE=\"TEXT\" NAME=\"system\" >< BR >";
> if  ( $num_rows == 0 ) {
> echo "There are currently no entries in the system table<BR>";
> } else {
> # we have some records
> echo "< B >Here are the existing entries in the system table < /B >< 
> BR >";
> echo "< SELECT NAME=\"current_system\" >";
> while ($row=mysql_fetch_array($mysql_result))
> {
> $system_type=$row["system_type"];
> # display results
> echo "< OPTION >$system_type";
> }
> echo "< /SELECT >";
> } # end else
> echo "< BR >< BR >";
> echo "< INPUT TYPE=\"SUBMIT\" VALUE=\"Add the new System\" >";
> echo "< BR >< BR >< INPUT TYPE=\"RESET\" VALUE=\"Clear me!\" >";
> mysql_close($connection);
> ?>
> < /FORM >
> <?php
> main_menu_scr();
> footer();
> ?>
> < /BODY >
> < /HTML >
>
> Thanks for any help,
> Ted
>
>
>
>
>>> From: Colleen Dick <platypus@stripped>
>>> Date: November 24, 2003 10:24:05 AM EST
>>> To: tlr7425@stripped
>>> Cc: MySQL List <mysql@stripped>
>>> Subject: Re: web data entry problem
>>> Reply-To: platypus@stripped
>>>
>>> There could be a number of things going on.
>>> It would help troubleshoot your problem if your
>>> script check for errors and print them if there are any.   You cant
>>> just assume a connection is being made just because phpmyadmin 
>>> connects.
>>> Your web app has to make its own connection.
>>> So how about showing us one of your scripts.  I bet it is something
>>> simple youre overlooking in your setup.
>>>
>>> tlr7425@stripped wrote:
>>>> I hope someone might be willing to help out.
>>>> I'm trying [still] to learn MySQL and php - to create some simply 
>>>> web  based database.
>>>> I have installed quite a few php/MySQL web database apps from 
>>>> books,  however, none of them will get data entered into my 
>>>> database.
>>>> When I create the database exactly as instructed, everything works  
>>>> great, but when I create the form to send/add a new record to my db 
>>>>  then look at the db the new data is not there.
>>>> This happens repeatedly with every example I build.  I can add 
>>>> records  using a terminal or phpMyAdmin.
>>>> I'm running MySQL 4.0.14, Mac OS X 10.3, PHP 4.3.2.
>>>> I installed 'tasks' -  
>>>> http://www.versiontracker.com/dyn/moreinfo/macosx/17996
>>>> and it works just fine!  but it is too big for me to use to compare 
>>>> to  my very simple scripts.
>>>> Here is one I have recently installed whose data will not enter:
>>>> http://hotwired.lycos.com/webmonkey/99/21/index3a_page4.html? 
>>>> tw=programming
>>>> I believe my db connection is being made (I may be wrong), after 
>>>> all my  phpMyAdmin app also works fine.
>>>> I would be very grateful is there might be a kind soul who would 
>>>> work  with me to help me to find out what is wrong?  I have had dbs 
>>>> before  that worked fine, I don't understand this problem at all.
>>>> Thanks,
>>>> Ted
>>>
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    
> http://lists.mysql.com/mysql?unsub=1
>

Thread
web data entry problemtlr742524 Nov
  • Re: web data entry problemPeter Burden24 Nov
  • Re: web data entry problemColleen Dick24 Nov
Re: web data entry problemtlr742525 Nov
  • Re: web data entry problemtlr742525 Nov
    • Re: web data entry problemtlr742525 Nov
      • Re: web data entry problemRyan Yagatich26 Nov