Jump to content

perrij3

Members
  • Posts

    58
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.joeperri.com

Profile Information

  • Gender
    Male

perrij3's Achievements

Member

Member (2/5)

0

Reputation

  1. This is the code that I used on a mobile website I just finished. The website I worked on works fine on a iPod, iPhone, iPad and Android devices. <meta name="HandheldFriendly" content="true" /> <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes" /> Hope this helps.
  2. Thanks Fenway for the help. What I needed to do was not use a WHERE statement, but instead use an AND statement. You were correct that I needed to place it in a different location than were I was using the WHERE statement.
  3. I forgot to add that the version of MySQL I am using is MySQL 5.0.81.
  4. OK, I got it to work somewhat when I added WHERE (pp.PrayerDate = '$date' to the bottom of the SQL statement. Now, this has recreated another issue. I really don't know how to solve this problem. The have 3 tables in this database (time, user, prayer). Time has all the times one can pray during. User is just data about a user. Prayer is where I am storing information about when a person is going to pray. What I am trying to do is when a person is signed up for a spot, to display their username. If nobody is signed up for this spot, I want it to say available. What it looks like is something like this: 12:00am Available 12:20am User1 12:40am User2 1:00am Available and so on for the day. With the SQL I have right now, it will only display where users have signed up for, but it will not show the times that are available. If I take out the WHERE statement, I will get all my time slots, but the same user will be displayed no matter what day I select. So the above example will display on every day, not just on the day that person is praying on. Could someone help point me in the right direction on how to solve this problem? Thanks for your time and help.
  5. I am having an issue with my left join SQL statement. Here is what I have so far: $sql = "SELECT pt.TimeID, pt.Time, pp.FK_UserID, pp.FK_TimeID, pp.PrayerDate, pu.UserID, pu.UserName FROM time AS pt LEFT JOIN prayer AS pp ON pt.TimeID = pp.FK_TimeID LEFT JOIN user AS pu ON pp.FK_UserID = pu.UserID"; The issue that I am having is I need to just retrieve information just for a certain date. Right now it will just displays the same information for each day, I need it to change depending on what day the user selects. I'm just not sure where to insert the following code (if this is how one is suppose to do it). WHERE pp.PrayerTime = $date I have tried placing it at the end of the above statement as well as right after 'FROM time AS pt'. Could someone please help me figure out how to just display one date worth of information?
  6. Does anyone know if my problem could be a setting within my php.ini file? Is there a setting there that controls the header function?
  7. I developed a website a few months ago and I am now having an issue with logging into it. The place that it is hosted just did some upgrades to their servers and for some reason, now my login page doesn't work correct. I do know that it connects to the database, receives the information, and the session is set. The problem is that it doesn't forward itself to the next page. The way I know that the session has started is I have manually typed in the URL of the menu page (the page it is suppose to go to once the user logs in). I am completely stumped on what is wrong here. I have other pages that use the same method to go to the next page once a user fills in a form and they work correctly. Here is the code I use //process the script only if the form has been submitted if (array_key_exists('login', $_POST)) { //start the session session_start(); include('include/connection.php'); //clean the $_POST array and assign to shorter variables nukeMagicQuotes(); $username = trim($_POST['username']); $pwd = trim($_POST['pwd']); //connect to the database as a user $conn = dbConnect(); //prepare username for use in SQL query $username = mysql_real_escape_string($username); //get the username's details from the database $sql = "Select * FROM user WHERE Username = '$username'"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($result); if (sha1($pwd.$row['Salt']) == $row['pwd']) { $_SESSION['authenticated'] = 'abc'; } //if no match, destroy the session and prepare error message else { $_SESSION = array(); session_destroy(); $error = 'Invalid username or password'; } //if the session variaable has been set, redirect if (isset($_SESSION['authenticated'])) { //get the time the session started $_SESSION['start'] = time(); header('Location: homepage.php'); exit; } } When I hit the login button, all i get is the information from the header.php file (which contains the <head> information) and the URL says it's still the index file. Any help would be greatly appreciated. The PHP version they are now using is 5.2.9. I'm not sure what the previous version was, but it was a PHP 5.x.x version.
  8. What if you used WHILE for the URLs? That would allow you to cycle through all the URLs. Something like: <?php while($row = mysql_fetch_assoc($sql_stat)) { ?> some code here <?php } ?>
  9. I have used the same code for a contact page on several website. I have used it on 2 different web hosting servers. I am trying to set up a contact form on a different web hosting company server and get the following message: Fatal error: Call to undefined function preg_match() in /home/html/contact_us.php on line 38 Is there a setting in the php.ini file that I would need to change? This is the code around line 38: //if the variable is an array, loop through each element //and pass it recursively back to the same function if (is_array($val)) { foreach ($val as $item) { isSuspect($item, $pattern, $suspect); } } else { //if one of the suspect phrases is found, set Boolean to true if (preg_match($pattern, $val)) { $suspect = true; } } } line 38 is this line: if (preg_match($pattern, $val)) { The version of php on this new server is php 5.2.1. I have used echo '<pre>'.print_r($_POST, true).'</pre>'; to see if the data was being posted and it is. Does anyone know why I am getting this message on one server and not the other? Thanks for your help in advance.
  10. Thanks, that was the problem. I was missing FROM. Stupid mistake, but I am thankful for your help.
  11. I think you need to use exploded http://us.php.net/manual/en/function.explode.php I'm not really sure how to put it back together, I am still pretty new to PHP. Hopefully this helps to point you in the right direction though.
  12. What I am trying to do is delete all records in a database that a user selects to delete using a check box. The from works and the array I have set up collects the data correctly. Where the issue is is with the mysql statement. This is what I am using: mysql_query("DELETE image WHERE image_ID IN ($removeImage)") or trigger_error(mysql_error(),E_USER_ERROR); This is the error message I am getting: 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 'WHERE image_ID IN ('9,10')' at line 1 I used the tutorial on this site to get the rest of the code to work, but the tutorial is set up for updating the records, not deleting them. Could someone please help me with what I am doing wrong?
  13. They are both stored as MEDIUMINT.
  14. The * selects all information in every field. Table needs to be changed to the name of the table you want to get the information from. after ORDER BY you place the field name you want to have the information sorted by. DESC will place the results in descending order. Hope that helps.
  15. Ok, here is what I have discovered. It seems that the $user_ID and the $comment_ID when I hit the submit button are not being passed as numbers. I have tried creating hidden fields collecting the numbers from the table they are being held in, but that isn't working either. When I hit submit, the code runs those this line //abandon the process if primary key invalid if (!is_numeric($user_ID)) { die('Invalid Request'); } I use a get statement to receive these numbers from the page before. //Remove backslashes nukeMagicQuotes(); //initialize flag $done = false; //prepare an array of expected items $expected = array('name', 'Email', 'Address', 'Address2', 'City', 'State', Zip', 'user_ID', 'comment_ID', 'Approved'); //create database connection $conn = dbConnect(''); //get details of selected record if ($_GET && !$_POST) { if (isset($_GET['user_ID']) && is_numeric($_GET['user_ID'])) { $user_ID = $_GET['user_ID']; $comment_ID = $_GET['user_ID']; } else { $user_ID = NULL; } if ($user_ID) { //Retreive information about whom the guestbook is for $sql = "SELECT * FROM obituaries WHERE user_ID = $user_ID"; $result = mysql_query($sql) or die (mysql_error()); $row = mysql_fetch_assoc($result); //Retrieve all content for single comment entry based on user ID and comment ID $gb_sql = "SELECT * FROM comment WHERE user_ID = $user_ID AND comment_ID = $comment_ID"; $gb_result = mysql_query($gb_sql) or die (mysql_error()); $gbrow = mysql_fetch_assoc($gb_result); } } I have echo these numbers and they do show up, so I know they are being passed. Does anyone know why the variables I am trying to use will come in as a number, but when I hit the post button, they don't seem to stay as a number?
×
×
  • 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.