Jump to content

How do I tweak this coding to do what I want?


JSGTPD

Recommended Posts

Hey All

Ok so looking for a bit of help for a rookie PHP coder here. The guys who designed our website have dissapeared into the night so I have to do all the tweaking myself and I am stumped.

This code displays the coming movies by week (from our database) but it only shows the current months movies, and once we are past the date they dissapear. I need it to show the next 4 weeks worth of movies at any given time even if it goes into the necxt month. Make sense? Here is our site notice the big grey EMPTY box, (it will only be empty till Feb 1st then all of February's titles will show up)

http://www.newthisweek.ca/index.php?action=newthisweek&cat=dvd

And here is the php

<?
include("admin/config.php");

if(isset($_REQUEST['month']) && $_REQUEST['month']!='' && isset($_REQUEST['cat']) && $_REQUEST['cat']!='')
{

$month=$_REQUEST['month'];
$cat=$_REQUEST['cat'];
$current = date("Y-m-d", mktime(0, 0, 0, date("m")  , date("d")+7, date("Y")));
$thisweek1 = date("Y-m-d",mktime(0, 0, 0, date("m")  , date("d")+1, date("Y")));
$current_org=date("Y-m-d", mktime(0, 0, 0, date("m")  , date("d"), date("Y")));
$thissql="SELECT * FROM dvd WHERE MONTH(rel_date) = '$month' AND status='DVD' AND rel_date > '$current_org' GROUP BY rel_date";

}
else
{
$current = date("Y-m-d", mktime(0, 0, 0, date("m")  , date("d"), date("Y")));
list($year, $month, $day) = split('[/.-]', $current);
$thissql="SELECT * FROM dvd WHERE MONTH(rel_date) = '$month' AND status='DVD' AND rel_date > '$current' GROUP BY rel_date";
//echo $thissql;
}
$thisresult=mysql_query($thissql) or die(mysql_error());


?>
<STYLE type=text/css>
A:link {COLOR: #0000FF; font-size:12px; font-family:Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none}
A:visited {COLOR: #000000; font-size:12px; font-family:Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none}
A:hover {COLOR: #FF0000; font-size:12px; font-family:Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none}
A:active {COLOR: #FF0000; font-size:12px; font-family:Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none}
</STYLE>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<?
$thissql1="SELECT * FROM dvd WHERE MONTH(rel_date) = '$month' AND status='DVD' AND rel_date > '$current_org' GROUP BY rel_date";
//echo $thissql1;
//die();

$thisresult1=mysql_query($thissql) or die(mysql_error());
if(mysql_num_rows($thisresult1)!=0)
{
while($nrowdvd=mysql_fetch_array($thisresult1))
{

?>
  <tr>
    <td width="100%" valign="top">
      <table border="0" cellpadding="0" cellspacing="0" width="100%" style="margin-top: 1; margin-bottom: 1">
        <tr>
          <td width="100%" valign="top">
            <p style="margin-left: 10; margin-right: 10; margin-top: 5; margin-bottom: 5"><font face="Verdana" size="2">
<b>
<?
$rel_date=$nrowdvd['rel_date'];
list($year,$month,$date)=explode("-",$rel_date);
echo date("F j, Y", mktime(0, 0, 0, $month, $date, $year));
?>
</b></font></td>
        </tr>
<?
$sql="SELECT * FROM dvd WHERE status='DVD' AND rel_date='$rel_date'";
$result=mysql_query($sql) or die(mysql_error());
while($newrowdvd=mysql_fetch_array($result))
{
?>

        <tr>
          <td width="100%" valign="top">
            <p style="margin-left: 10; margin-right: 10; margin-top: 5; margin-bottom: 5"><font face="Verdana" size="2">

<a target="_parent" href="index.php?action=listdvd&cat=dvd&dvd_id=<?=$newrowdvd['dvd_id']?>"><?=$newrowdvd['title']?></a></font></td>
        </tr>
<?
}
?>

      </table>
    </td>
  </tr>
  <?
  }
  }
  ?>
</table>
Link to comment
Share on other sites

Here is my server info

Operating system  Linux
Service Status Click to View
Kernel version 2.6.9-42.0.3.ELsmp
Machine Type i686
Apache version 1.3.36 (Unix)
PERL version 5.8.7
Path to PERL /usr/bin/perl
Path to sendmail /usr/sbin/sendmail
Installed Perl Modules Click to View
PHP version 4.4.3
MySQL version 4.1.21-standard
cPanel Build 10.9.0-RELEASE 44
Theme cPanel X v2.6.0
Link to comment
Share on other sites

[code]ok type in the shell:
[code]mysql -u apache -p[/code]

it will then prompt you to put in your password (which you setup when you installed mysql)... type in the password, and now the command line should show something like:
[code]
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 851375 to server version: 3.23.58

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
[/code]

now you have to choose which database to use. type in:
[code]mysql> SHOW databases;[/code] then hit enter.

to connect to the right database that you want type in:[code]mysql> USE your_database_name;[/code]
you will see something like:[code]Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>[/code]

from here type in:[code]mysql> SHOW tables;[/code]

and now you can see all the tables in your database. type in:[code]mysql> SELECT * FROM your_table;[/code]

now, copy and paste the output of that command into your post on this topic. and we'll go from there, bud =)[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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