Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

87 users online



php5 vs php4

php5 vs php4

Currently viewing this thread: 1 (0 members and 1 guests)


nykoelle

nykoelle

Crazy Pants
Status: Offline!

php5 vs php4

I have this:

PHP:

<?
    $title 
"CSI Content Management | Add Global Content";
    
$keywords "";
    
$description "";
?>
<?php 
include("/srv/www/htdocs/cms-includes/top.php"); ?>
    <div id="content">

<?php include("/srv/www/htdocs/cms-includes/mysql_config.php"); ?>

<?

 
if ($_POST['insert'] == 1)
  {
        
mysql_query("insert into location values ('" $_POST['id'] ."','" $_POST['cu_id'] ."','" $_POST['name'] . "')");
        echo  
"<h1>Location/District added.</h1><br />\n";

  }
 else if (
$_POST['insert'] == 2)
 {
        
mysql_query("insert into building values ('" $_POST['id'] . "','" $_POST['loc_id'] ."','" $_POST['name'] . "')");
        echo  
"<h1>Building/Site added.</h1><br />\n";
 }
 else if (
$_POST['insert'] == 3)
 {
         
mysql_query("insert into server_os values (NULL,'" $_POST['os_name'] . "','" $_POST['env'] . "')");
         echo  
"<h1>Server Operating System added.</h1><br />\n";
 }
 else
  { 
?>         <h1>Add Districts/Central Locations</h1>  <? ?>

<h2 style="margin-top: 20px;">Add Location/District</h2>
        <form action="" method="POST">
        <table><tr><th>Customer</th><th>Unique ID <a href="open-loc.php" target="_blank">[li]</a></th><th>Name</th></tr>
        <tr><td>
        <select name="cu_id">
        <?
            $result 
mysql_query('SELECT * FROM customer ORDER BY name ASC');
            while (
$row mysql_fetch_assoc($result))
            {
        
?>

            <option value="<?=$row['id'];?>"><?=$row['name'];?></option>

        <?php
            
}

        echo 
mysql_error();
        
?>
        </select></td>

        <td><input type="text" name="id" maxlength="25" /></td>
        <td><input type="text" name="name" maxlength="110" /></td>
        <td><input type="hidden" name="insert" value="1" /></td>
        </tr>
        <tr><td><input type="submit" /></td></tr>
        </tr>
        </table>
        </form>

<hr style="margin: 60px;" />

<h2>Add Building/Site within a Location</h2>

        <form action="" method="POST">
        <table><tr><th>Location/District</th><th>Unique ID <a href="open-building.php" target="_blank">[li]</a></th><th>Building Name</th></tr>
        <tr><td>
        <select name="loc_id">
        <?
            $result 
mysql_query('SELECT * FROM location ORDER BY name ASC');
            while (
$row mysql_fetch_assoc($result))
            {
        
?>

            <option value="<?=$row['id'];?>"><?=$row['name'];?></option>

        <?php
            
}
        echo 
mysql_error();    ?>

        </select></td>
        <td><input type="text" name="id" maxlength="25" /></td>
        <td><input type="text" name="name" maxlength="110" /></td>
        <td><input type="hidden" name="insert" value="2" /></td>
        </tr>
        <tr><td><input type="submit" /></td></tr>
        </tr>
        </table>
        </form>

<hr style="margin: 60px;" />

<h2>Add Operating System</h2>

        <form action="" method="POST">
        <table><tr><th>Operating System <a href="open-server-os.php" target="_blank">[li]</a></th></tr>
        <tr>
        <td><input type="text" name="os_name" maxlength="40" /></td>
        <td>
            <select name="env">
                <option value="m">Microsoft</option>
                <option value="u">Unix</option>
                <option value="n">Novell</option>
            </select>
        </td>
        </tr>
        <tr><td><input type="hidden" name="insert" value="3" /><input type="submit" /></td></tr>
        </tr>
        </table>
        </form>

    </div>
</div>

<div id="bottom">
    <p>© 2002, Computer Systems Integrators, Inc, All rights reserved.</p>
</div>
</body>
</html>

On one server, apache2/php4, it works FINE.

On another server, apache2/php5 it doesn't load anything past the mysql_connect, then after that it only loads one input dropdown.

wtf is going on, what huge difference am I missing

___________________

:: pop ::

dibby

dibby

Neverside Newbie
Status: Offline!

I think in php5, the default is not to allow <? but only <?php - I don't know if this is part of your problem, but it might be.

___________________

Glasgow SEO

nykoelle

nykoelle

Crazy Pants
Status: Offline!

i tried that and it didnt make a difference, am i missing a module or something

___________________

:: pop ::

James

James

Development Forum Leader
Status: Offline!

If you make everything <?php you shouldn't have any problems. If you do, it has nothing to do with the differences between PHP4 and PHP5.

___________________

irc.efnet.net #neverside
Neverside merchandise!

angelessme

angelessme

Neversidian
Status: Offline!

considering that you dont even have the mysql_connect in the code you gave us but instead in the include this is not helpful information to work thi

___________________

angelessme, antagonising neverside members, staff and administration since 2001.

nykoelle

nykoelle

Crazy Pants
Status: Offline!

sorry, about not including the mysql_connect

james was right, it wasn't the change between them, there was something whack with taht server, we blew it away and did a fresh install of suse10.1 and the whoe LAMP bundle and now its working as a charm.

weird.

wonder what got f'd up though

___________________

:: pop ::

Xolt

Xolt

Neverside Newbie
Status: Offline!
Originally posted by dibby:

I think in php5, the default is not to allow <? but only <?php - I don't know if this is part of your problem, but it might be.

PHP5 has short hand tagging disabled by default. PHP6 will completely remove the ability to use short hand tags for PHP. Get used to using <?php echo 'Hello World!'; ?> instead of <? echo 'Hello World!'; ?> (or in that case, <?='Hello World!'?>).

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0102 seconds.