Jump to content

A simple one..Plz help..


teongkia

Recommended Posts

Hi i got this code.The problem is it can't detect the <?php in the first line.May i know which sign i have to add in to make the <?php function?Thanks.
[code]mysql_query("UPDATE example1 SET name='<anchor>Facilities Booking<br/><go href="<?php echo $fbooklink ?>"

                    method="post"><postfield name="user_id" value="<?php echo $user_name ?>" /><postfield name="user_uno"   

                    value="<?php echo $uno ?>" /></go></anchor>' WHERE id='8'")
                    or die(mysql_error());[/code]

Link to comment
https://forums.phpfreaks.com/topic/29072-a-simple-oneplz-help/
Share on other sites

I'm assume you're already in PHP at this point, therefore you don't need to use the "<?php" in the quoted string. You also have to many unescaped quotes.

[code]<?php
mysql_query("UPDATE example1 SET name='<anchor>Facilities Booking<br/><go href=\"' . $fbooklink . '\"

                    method=\"post\"><postfield name=\"user_id\" value=\"' . $user_name . '\" /><postfield name=\"user_uno\"   

                    value=\"' . $uno . '\" /></go></anchor>' WHERE id='8'")
                    or die(mysql_error());
?>[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/29072-a-simple-oneplz-help/#findComment-133229
Share on other sites

[quote author=kenrbnsn link=topic=116945.msg476791#msg476791 date=1164953105]
I'm assume you're already in PHP at this point, therefore you don't need to use the "<?php" in the quoted string. You also have to many unescaped quotes.

[code]<?php
mysql_query("UPDATE example1 SET name='<anchor>Facilities Booking<br/><go href=\"' . $fbooklink . '\"

                    method=\"post\"><postfield name=\"user_id\" value=\"' . $user_name . '\" /><postfield name=\"user_uno\"   

                    value=\"' . $uno . '\" /></go></anchor>' WHERE id='8'")
                    or die(mysql_error());
?>[/code]

Ken
[/quote]
Ooh, good call, didn't even pay attention to the fact that he already had a mysql query going in that.
Link to comment
https://forums.phpfreaks.com/topic/29072-a-simple-oneplz-help/#findComment-133232
Share on other sites

[code]<?php require_once('mConn.php'); ?>
<?php require_once('../link.php');?>
<?php
if (isset($_GET['user_name']) && isset($_GET['user_id']) && isset($_GET['uno']) && isset($_GET['homeid']))

  $user_name = $_GET['user_name'];  // Setting The $user Variable
  $user_id = $_GET['user_id'];
  $uno = $_GET['uno'];
  $homeid = $_GET['homeid'];
   
  $fbooklink = "fbook.php";
  $freqlink = "freq.php";
  $ehomelink = "chome.php";
  $viewbookinglink = "viewbooking.php";
  $viewreqlink = "viewreq.php";
  $viewehomelink = "viewehome.php";
  $viewsecuritylink = "viewsecurity.php";
 
}else{
$user_name = "Guest";
$fbooklink = "index.php#redirectlogin";
  $freqlink = "index.php#redirectlogin";
  $ehomelink = "index.php#redirectlogin";
  $viewbookinglink = "index.php#redirectlogin";
  $viewreqlink = "index.php#redirectlogin";
  $viewehomelink = "index.php#redirectlogin";
  $viewesecuritylink = "index.php#redirectlogin";
}
if (isset($_POST['user_id']) && isset($_POST['user_uno']) && isset($_POST['homeid']))

  $user_name = $_POST['user_id'];  // Setting The $user Variable
  $uno = $_POST['user_uno'];
  $homeid = $_POST['homeid'];
 
  $fbooklink = "fbook.php";
  $freqlink = "freq.php";
  $ehomelink = "chome.php";
  $viewbookinglink = "viewbooking.php";
  $viewreqlink = "viewreq.php";
  $viewehomelink = "viewehome.php";
  $viewsecuritylink = "viewsecurity.php";
 
}

?>
<?php 
header("content-type: text/vnd.wap.wml; charset=iso-8859-1");

echo "<?xml version=\"1.0\"?>";
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> 

<wml>
<card title="EC Home Page">

<?php //$m = checkaccess() ?>
<?php //echo "<p>".$m."</p>" ?>
<?php //currLoc(2); ?>
<?php //$user_name = $_POST["user_id"]; ?>
<?php //$uno = $_POST["user_uno"]; ?>

<?php //$user_id = "U004" ?>
<?php //$user_uno = "48" ?>

<p align="center"><img src="welcome.wbmp" alt="x" /><br/>
<b><?php echo $user_name ?></b><br/>
<b>MainMenu</b><br/>

<?php echo $row_rs12['name'] ?>
 
  <anchor>Maintenance Request<br/>
 
    <go href="<?php echo $freqlink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  </go>
  </anchor>
 
  <anchor>E-Home Automation<br/>
 
    <go href="<?php echo $ehomelink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  <postfield name="homeid" value="<?php echo $homeid ?>" />
  </go>
  </anchor>
 
  <anchor>View Booking History<br/>
    <go href="<?php echo $viewbookinglink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  </go>
  </anchor>
 
  <anchor>View Request History<br/>
    <go href="<?php echo $viewreqlink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  </go>
  </anchor>
 
  <anchor>View Automation Status<br/>
    <go href="<?php echo $viewehomelink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  <postfield name="homeid" value="<?php echo $homeid ?>" />
  </go>
  </anchor>
 
 
<?php if($user_name == "Guest"){ ?>

  <anchor>Login<br/>
    <go href="login.php" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  </go>
  </anchor>
 
<?php }else{ ?>

<anchor>Logout<br/>
    <go href="#redirectlogout" method="post" />
 
  </anchor>
<?php } ?>

</p>


</card>
<card id="redirectlogin" title="Redirect Page" ontimer="login.php">
<timer value="40" />
<p align="center"><b>
You are not Login yet.<br/>
Redirecting <br/>to LOGIN Page....
</b>

</p>
</card>
<card id="redirectlogout" title="Redirect Page" ontimer="index.php">
<timer value="40" />
<p align="center"><b>
Logging Out..Please wait a moment...<br/>
Redirecting <br/>to E-Connect Home Page....
</b>

</p>
</card>
</wml>[/code]
The whole code is here..Did that you told me work?Thanks..
Link to comment
https://forums.phpfreaks.com/topic/29072-a-simple-oneplz-help/#findComment-133238
Share on other sites

[quote author=teongkia link=topic=116945.msg476801#msg476801 date=1164953691]
[code]<?php require_once('mConn.php'); ?>
<?php require_once('../link.php');?>
<?php
if (isset($_GET['user_name']) && isset($_GET['user_id']) && isset($_GET['uno']) && isset($_GET['homeid']))

  $user_name = $_GET['user_name'];  // Setting The $user Variable
  $user_id = $_GET['user_id'];
  $uno = $_GET['uno'];
  $homeid = $_GET['homeid'];
   
  $fbooklink = "fbook.php";
  $freqlink = "freq.php";
  $ehomelink = "chome.php";
  $viewbookinglink = "viewbooking.php";
  $viewreqlink = "viewreq.php";
  $viewehomelink = "viewehome.php";
  $viewsecuritylink = "viewsecurity.php";
 
}else{
$user_name = "Guest";
$fbooklink = "index.php#redirectlogin";
  $freqlink = "index.php#redirectlogin";
  $ehomelink = "index.php#redirectlogin";
  $viewbookinglink = "index.php#redirectlogin";
  $viewreqlink = "index.php#redirectlogin";
  $viewehomelink = "index.php#redirectlogin";
  $viewesecuritylink = "index.php#redirectlogin";
}
if (isset($_POST['user_id']) && isset($_POST['user_uno']) && isset($_POST['homeid']))

  $user_name = $_POST['user_id'];  // Setting The $user Variable
  $uno = $_POST['user_uno'];
  $homeid = $_POST['homeid'];
 
  $fbooklink = "fbook.php";
  $freqlink = "freq.php";
  $ehomelink = "chome.php";
  $viewbookinglink = "viewbooking.php";
  $viewreqlink = "viewreq.php";
  $viewehomelink = "viewehome.php";
  $viewsecuritylink = "viewsecurity.php";
 
}

?>
<?php 
header("content-type: text/vnd.wap.wml; charset=iso-8859-1");

echo "<?xml version=\"1.0\"?>";
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> 

<wml>
<card title="EC Home Page">

<?php //$m = checkaccess() ?>
<?php //echo "<p>".$m."</p>" ?>
<?php //currLoc(2); ?>
<?php //$user_name = $_POST["user_id"]; ?>
<?php //$uno = $_POST["user_uno"]; ?>

<?php //$user_id = "U004" ?>
<?php //$user_uno = "48" ?>

<p align="center"><img src="welcome.wbmp" alt="x" /><br/>
<b><?php echo $user_name ?></b><br/>
<b>MainMenu</b><br/>

<?php echo $row_rs12['name'] ?>
 
  <anchor>Maintenance Request<br/>
 
    <go href="<?php echo $freqlink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  </go>
  </anchor>
 
  <anchor>E-Home Automation<br/>
 
    <go href="<?php echo $ehomelink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  <postfield name="homeid" value="<?php echo $homeid ?>" />
  </go>
  </anchor>
 
  <anchor>View Booking History<br/>
    <go href="<?php echo $viewbookinglink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  </go>
  </anchor>
 
  <anchor>View Request History<br/>
    <go href="<?php echo $viewreqlink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  </go>
  </anchor>
 
  <anchor>View Automation Status<br/>
    <go href="<?php echo $viewehomelink ?>" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  <postfield name="homeid" value="<?php echo $homeid ?>" />
  </go>
  </anchor>
 
 
<?php if($user_name == "Guest"){ ?>

  <anchor>Login<br/>
    <go href="login.php" method="post">
  <postfield name="user_id" value="<?php echo $user_name ?>" />
    <postfield name="user_uno" value="<?php echo $uno ?>" />
  </go>
  </anchor>
 
<?php }else{ ?>

<anchor>Logout<br/>
    <go href="#redirectlogout" method="post" />
 
  </anchor>
<?php } ?>

</p>


</card>
<card id="redirectlogin" title="Redirect Page" ontimer="login.php">
<timer value="40" />
<p align="center"><b>
You are not Login yet.<br/>
Redirecting <br/>to LOGIN Page....
</b>

</p>
</card>
<card id="redirectlogout" title="Redirect Page" ontimer="index.php">
<timer value="40" />
<p align="center"><b>
Logging Out..Please wait a moment...<br/>
Redirecting <br/>to E-Connect Home Page....
</b>

</p>
</card>
</wml>[/code]
The whole code is here..Did that you told me work?Thanks..
[/quote]

There is no need to keep opening and closing php.  Just open it once, and close it when you're finished, no need to do it after every chunk of code.
Link to comment
https://forums.phpfreaks.com/topic/29072-a-simple-oneplz-help/#findComment-133240
Share on other sites

[quote author=teongkia link=topic=116945.msg476810#msg476810 date=1164954339]
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '. . '" method="post"><postfield name=
This is the error i found...How can i solve it?
[/quote]
Looks like you're not ending the query since you're getting some form fields in there.  Make sure you have the right amount of parentheses around your mysql_query(), the error is telling you that you're trying to send that data to your SQL server and it is rejecting it because it is bad syntax.
Link to comment
https://forums.phpfreaks.com/topic/29072-a-simple-oneplz-help/#findComment-133252
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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