Jump to content

[SOLVED] AHH! more php/mysql problems!


rondog

Recommended Posts

ok this was working before I dont know why it isnt anymore. First here is my code

<?php
session_start();
if($_SESSION['loggedIn'] != 'yes'){           
     header("Location: mustbelogged.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Datron World Communications :: FCPA Training</title>
<script src="globaliefix.js"></script>
<style type="text/css" media="all">
@import url(style.css);
</style>
<?php
$con = mysql_connect("localhost","username","password");
if (!$con) {
echo "unable to connect to DB";
echo mysql_error($con);
exit();
}
$db = mysql_select_db("datron");
if (!$db) {
echo "unable to open DB";
echo mysql_error($db);
exit();
}
$uname = $_SESSION['username'];
$date = date("m-d-y")
/* THIS BREAKS MY PAGE */
$datequery = "INSERT INTO users timelogged VALUES $date WHERE username = '$uname'";
$rundate = mysql_query($datequery)
$logquery = "UPDATE users SET loggedin = 'viewed' WHERE username = '$uname'";
$runlog = mysql_query($logquery);
?>
</head>
<body>
<div id="wrapper">
  <div id="wrapbg">
    <div id="banner"></div>
    <div id="content">
      <div id="trainingforum" align="center">
        <p>Welcome & Introduction</p>
        <script type="text/javascript">art1();</script>
      </div>
    </div>
    <div id="footer">
      <p>Copyright © 2007 Datron World Communications, Inc. All rights reserved.</p>
      <!--<div id="signout"><a href="#">Sign Out</a></div>-->
    </div>
  </div>
</div>
</body>
</html>

 

ok if I comment out my querys on the bottom of my php, my page will load. If I uncomment them nothing loads..is there something wrong with my insert and update statements again??

Link to comment
https://forums.phpfreaks.com/topic/67319-solved-ahh-more-phpmysql-problems/
Share on other sites

This line:

$rundate = mysql_query($datequery)

Should have a semi-colon at the end of it:

$rundate = mysql_query($datequery);

 

EDIT:

Tyhe same applies to this line too:

$date = date("m-d-y")

 

Go through you code and make sure you have semi-colons at the end of lines

oh my..these past few days ive been coding and I keep getting these minor errors! Ok thank you for finding that..I have a question because I know this would help me a lot!

 

on some other servers ive coded on if there is a missing semi-colon or whatever it returns an error..on this current server if there is an error like that it returns nothing..a blank page..how do I turn on those errors?? I do have access to the php ini file.

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.