?
Solved

I use this code with php 4 work but not work with php5

Posted on 2006-06-01
6
Medium Priority
?
259 Views
Last Modified: 2012-06-27
it have 2 gile edite.php that will submit to allentries.php it just simple insert data in to mysql database
the below is code of 2 fikle


edite.php
*******************
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>

 <form target="rightFrame" method="post"  action="allentries.php">
<script type="text/javascript">parent.frames.rightFrame.location.reload(true)</script>
 
  <table width="380" border="0" cellspacing="1" cellpadding="1">
    <tr>
      <td>
        <input type="hidden" name="id" value="<?php echo $myrow["id"]?>">
        CusName:</td>
      <td>
        <input type="Text" name="CusName" size="35">
      </td>
    </tr>
    <tr>
       <td>Tel: </td>
      <td>
        <input type="Text" name="Tel"size="35" >
      </td>
    </tr>
    <tr>
      <td>Equip: </td>
      <td>
    <textarea name="Equip" rows="3" cols="32"><?php echo $myrow["Equip"]?></textarea>
      </td>
    </tr>
    <tr>
      <td>Symptom: </td>
      <td>
       <textarea name="Symptom" rows="5" cols="32"><?php echo $myrow["Symptom"]?></textarea>
      </td>
    </tr>
    <tr>
      <td><p>Apointment</p>
        <p>yyyy-mm-dd</p>
        </td>
      <td>
        <input name="Date" type="Text" value="<? echo date("Y-m-d H:i:s") ?>">
      </td>
    </tr>
    <tr>
      <td>SeCharge:</td>
      <td>
        <input type="Text" name="SeCharge">
      </td>
    </tr>
    <tr>
      <td>Staff:</td>
      <td>
        <input type="Text" name="Staff">
      </td>
    </tr>
    <tr>
      <td>Remark: </td>
      <td>
    <textarea name="Remark" rows="2" cols="32"><?php echo $myrow["Remark"]?></textarea>
     </td>
    </tr>
   </table>
    <input type="Submit" name="submit" value="Enter information">
  </form>
</body>

</html>


***********************************


allentries.php
************
<?

include("include/dbconnect.php");
if($submit)
{

$sql = "INSERT INTO $table (CusName,Tel, Equip, Symptom, Date, SeCharge, Staff, Remark) VALUES ('$CusName','$Tel','$Equip','$Symptom','$Date','$SeCharge','$Staff','$Remark')";
$result = mysql_query($sql);
echo "<br><br>Information entered into Symptom book.\n";
}

$result = mysql_query("SELECT * FROM $table ORDER BY Date",$db);
echo "<table cellpadding=2 cellspacing=1 border=0>";
echo "<table width=100% cellpadding=0 cellspacing=0 border=1 align=center>

      <tr>
         <td width= 8%><b><font size='1'>Apoint</font></b></td>
        <td width= 8%><b><font size='1'>Name</font></b></td>
        <td width= 12%><b><font size='1'>Tel</font></b></td>
        <td width= 50%><b><font size='1'>Equipment</font></b></td>
        <td width= 8%><b><font size='1'>Symptom</font></b></td>
        <td width= 8%><b><font size='1'>Staff</font></b></td>
        <td width= 8%><b><font size='1'>Blance</font></b></td>
        <td><b><font size='1'>CHe</font></b></td>
        <td><b><font size='1'>CHe</font></b></td>
       </tr>";
$alternate = "2";
while ($row = mysql_fetch_array($result)) {
$id = $row["id"];
$Date = $row["Date"];
$CusName = $row["CusName"];
$Tel = $row["Tel"];
$Equip = $row["Equip"];
$Symptom = $row["Symptom"];
$Date = $row["Date"];
$Staff = $row["Staff"];
if ($alternate == "1") {
$color = "#ffffff";
$alternate = "2";
}
else {
$color = "#efefef";
$alternate = "1";
}
echo "<tr bgcolor=$color><td>$Date</td><td>$CusName</td><td>$Tel</td><td>$Equip</td><td>$Symptom</td><td>$Staff</td><td><a href='view.php?id=$id'>see</a></td><td><a href='edit.php?id=$id'>edit</a></td><td><a href='delete.php?id=$id' onClick=\"return confirm('Are you sure?')\">delete</a></td></tr>";
}
echo "</table>";

include ("include/footer.inc.php");
?>


0
Comment
Question by:teera
6 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16813590
what is the error message or the different behaviour?
0
 
LVL 10

Accepted Solution

by:
ClickCentric earned 600 total points
ID: 16813606
With php5, I believe you need to use the mysqli interface for mysql queries.

http://us3.php.net/manual/en/ref.mysqli.php
0
 

Author Comment

by:teera
ID: 16813703
it not show any erro but it not insert into database but it can select form database
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 600 total points
ID: 16813782
what is the value of the system setting REGISTER_GLOBALS.
I guess that it is ON on your PHP4, but (by default) OFF in your PHP5.
please check
0
 
LVL 12

Assisted Solution

by:AmigoJack
AmigoJack earned 400 total points
ID: 16813960
try the following code prefix:

<?php
foreach($_REQUEST as $key=> $value) $$key= $value;
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>
...and the rest of your file
0
 
LVL 16

Assisted Solution

by:dr_dedo
dr_dedo earned 200 total points
ID: 16816018
just add this to the begining of allentries.php

extract ($_REQUEST);

and it should work fine
but i DO recommend that you update you code. register_gloabals is disabled for a reason!!
e.g.
$CusName = $_REQUEST('$CusName');
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question