Jump to content

newtomysql

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Posts posted by newtomysql

  1. Hi,

     

    I am trying to update multiple records in one of my tables and I can't find the problem why is not updating the table.

    Can someone take a look at my code and see what I am doing wrong.

     

    Thank you.

     

    Page Reference: http://www.phpeasystep.com/mysql/10.html

     

    My Page:

     

    <?php

    $host="localhost"; // Host name

    $username=""; // Mysql username

    $password=""; // Mysql password

    $db_name=""; // Database name

    $tbl_name="tbl"; // 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";

    $result=mysql_query($sql);

     

    // Count table rows

    $count=mysql_num_rows($result);

    ?>

    <table width="500" border="0" cellspacing="1" cellpadding="0">

    <form name="form1" method="post" action="">

    <tr>

    <td>

    <table width="500" border="0" cellspacing="1" cellpadding="0">

     

     

    <tr>

    <td align="center"> </td>

    <td align="center"><div align="left"><strong>Type</strong></div></td>

    <td align="center"><div align="center"><strong>Order Type</strong></div></td>

    </tr>

    <?php

    while($rows=mysql_fetch_array($result)){

    ?>

    <tr>

    <td align="center"><? $boardTypeID[]=$rows['boardTypeID']; ?></td>

    <td align="center"><div align="left"><? echo $rows['type']; ?>

    </div>

      <div align="left"></div></td>

    <td align="center"><input name="orderType[]" type="text" id="orderType" value="<? echo $rows['orderType']; ?>" size="2"></td>

    </tr>

    <?php

    }

    ?>

    <tr>

    <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td>

    </tr>

    </table>

    </td>

    </tr>

    </form>

    </table>

    <?php

    // Check if button name "Submit" is active, do this

    if($Submit){

    for($i=0;$i<$count;$i++){

    $sql1="UPDATE tbl SET orderType='$orderType[$i]' WHERE boardTypeID='$boardTypeID[$i]'";

    $result=mysql_query($sql1);

    }

    }

     

    mysql_close();

    ?>

     

     

     

     

  2. I am looking for a GOOD PHP MYSQL developer to help with some small coding.

    All I need help is with a grouping option for displaying data that is realated to another table.

    This are my tables;

    -- Table structure for table `boardMembers_tbl`

    --

     

    CREATE TABLE `boardMembers_tbl` (

      `boardID` int(11) NOT NULL auto_increment, 

      `name` varchar(80) default NULL,

      `lastName` varchar(60) default NULL,

      `email` varchar(60) default NULL,

      `tel` varchar(15) default NULL,

      `boardTypeID` int(11) default NOT NULL

        PRIMARY KEY  (`boardID`)

    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=38 ;

     

    CREATE TABLE `boardType_tbl` (

      `boardTypeID` int(11) NOT NULL auto_increment,

      `userID` int(11) NOT NULL default '0',

      `type` varchar(100) NOT NULL default '',

      `orderType` int(11) default NULL,

      PRIMARY KEY  (`boardTypeID`)

    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=23 ;

     

    TABLE `boardType_tbl` is realted to `boardMembers_tbl` by boardTypeID.

     

    I will like to have the data group and display by type first on top and bellow the people names related to that type. I can pay only thru PayPal and I can send payment tomorrow after I see an example of the code and the data being display by groups. Budget is $35 to $50 for the project.

    This is very similar to a menu and submenu. First you have the menu and bellow the sub menu related to that menu title.

     

    Thank you.

     

×
×
  • 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.